From 53b3a6face8c9f29001b70dc921f5499ab303baf Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Thu, 12 Oct 2000 00:26:34 +0000 Subject: [PATCH] start of polygon drawing support... SVN revision: 3574 --- legacy/evas/doc/Makefile.am | 2 +- legacy/evas/src/Evas.h | 7 +- legacy/evas/src/Evas_private.h | 17 +++ legacy/evas/src/Makefile.am | 1 + legacy/evas/src/evas_gl_routines.c | 21 ++++ legacy/evas/src/evas_gl_routines.h | 5 + legacy/evas/src/evas_image_routines.c | 10 ++ legacy/evas/src/evas_image_routines.h | 5 + legacy/evas/src/evas_imlib_routines.c | 98 +++++++++++++++- legacy/evas/src/evas_imlib_routines.h | 5 + legacy/evas/src/evas_misc.c | 13 +++ legacy/evas/src/evas_object.c | 27 ++++- legacy/evas/src/evas_poly.c | 158 ++++++++++++++++++++++++++ legacy/evas/src/evas_render.c | 41 +++++++ legacy/evas/src/evas_x11_routines.c | 14 +++ legacy/evas/src/evas_x11_routines.h | 5 + legacy/evas/test/evas_test_old.c | 19 +++- 17 files changed, 439 insertions(+), 9 deletions(-) create mode 100644 legacy/evas/src/evas_poly.c diff --git a/legacy/evas/doc/Makefile.am b/legacy/evas/doc/Makefile.am index 2d1d64c3a5..b752846c58 100644 --- a/legacy/evas/doc/Makefile.am +++ b/legacy/evas/doc/Makefile.am @@ -1,3 +1,3 @@ EXTRA_DIST = \ index.html \ -loogo.gif +logo.gif diff --git a/legacy/evas/src/Evas.h b/legacy/evas/src/Evas.h index d90b2be703..2157e69a0e 100644 --- a/legacy/evas/src/Evas.h +++ b/legacy/evas/src/Evas.h @@ -104,7 +104,8 @@ Evas_Object evas_add_text(Evas e, char *font, int size, char *text); Evas_Object evas_add_rectangle(Evas e); Evas_Object evas_add_line(Evas e); Evas_Object evas_add_gradient_box(Evas e); - +Evas_Object evas_add_poly(Evas e); + /* set object settings */ void evas_set_image_file(Evas e, Evas_Object o, char *file); /* ** ** not implimented yet ** ** */void evas_set_image_data(Evas e, Evas_Object o, void *data, Evas_Image_Format format, int w, int h); @@ -118,7 +119,8 @@ void evas_set_angle(Evas e, Evas_Object o, double angle); void evas_set_zoom_scale(Evas e, Evas_Object o, int scale); void evas_set_line_xy(Evas e, Evas_Object o, double x1, double y1, double x2, double y2); void evas_set_pass_events(Evas e, Evas_Object o, int pass_events); - +void evas_add_point(Evas e, Evas_Object o, double x, double y); + /* cache settings for performance */ void evas_set_font_cache(Evas e, int size); int evas_get_font_cache(Evas e); @@ -159,6 +161,7 @@ Evas_Object evas_object_at_position(Evas e, double x, double y); Evas_Object evas_object_get_named(Evas e, char *name); void evas_object_set_name(Evas e, Evas_Object o, char *name); char *evas_object_get_name(Evas e, Evas_Object o); +Evas_List evas_get_points(Evas e, Evas_Object o); /* object visibility */ void evas_show(Evas e, Evas_Object o); diff --git a/legacy/evas/src/Evas_private.h b/legacy/evas/src/Evas_private.h index b6f91168d7..5df7680b8e 100644 --- a/legacy/evas/src/Evas_private.h +++ b/legacy/evas/src/Evas_private.h @@ -11,6 +11,7 @@ typedef struct _Evas_Object_Any * Evas_Object_Any; typedef struct _Evas_Render_Data Evas_Render_Data; typedef struct _Evas_Data * Evas_Data; typedef struct _Evas_Layer * Evas_Layer; +typedef struct _Evas_Point * Evas_Point; typedef struct _Evas_Color_Point * Evas_Color_Point; typedef struct _Evas_Callback * Evas_Callback; typedef struct _Evas_Rectangle * Evas_Rectangle; @@ -19,12 +20,14 @@ typedef struct _Evas_Object_Text * Evas_Object_Text; typedef struct _Evas_Object_Rectangle * Evas_Object_Rectangle; typedef struct _Evas_Object_Line * Evas_Object_Line; typedef struct _Evas_Object_Gradient_Box * Evas_Object_Gradient_Box; +typedef struct _Evas_Object_Poly * Evas_Object_Poly; #define OBJECT_IMAGE 1230 #define OBJECT_TEXT 1231 #define OBJECT_RECTANGLE 1232 #define OBJECT_LINE 1233 #define OBJECT_GRADIENT_BOX 1234 +#define OBJECT_POLYGON 1235 #define IF_OBJ(_o, _t) if (((Evas_Object)_o)->type != _t) @@ -74,6 +77,11 @@ struct _Evas Imlib_Updates updates; }; +struct _Evas_Point +{ + double x, y; +}; + struct _Evas_Color_Point { int r, g, b, a; @@ -207,6 +215,15 @@ struct _Evas_Object_Gradient_Box } current, previous; }; +struct _Evas_Object_Poly +{ + struct _Evas_Object_Any object; + struct { + int r, g, b, a; + Evas_List points; + } current, previous; +}; + #endif diff --git a/legacy/evas/src/Makefile.am b/legacy/evas/src/Makefile.am index 3679658fd7..9e25abcf29 100644 --- a/legacy/evas/src/Makefile.am +++ b/legacy/evas/src/Makefile.am @@ -43,6 +43,7 @@ evas_line.c \ evas_list.c \ evas_misc.c \ evas_object.c \ +evas_poly.c \ evas_rectangle.c \ evas_render.c \ evas_text.c \ diff --git a/legacy/evas/src/evas_gl_routines.c b/legacy/evas/src/evas_gl_routines.c index 43662105a8..7b50f83682 100644 --- a/legacy/evas/src/evas_gl_routines.c +++ b/legacy/evas/src/evas_gl_routines.c @@ -2181,6 +2181,22 @@ __evas_gl_gradient_draw(Evas_GL_Graident *gr, +/************/ +/* polygons */ +/************/ +void +__evas_gl_poly_draw (Display *disp, Imlib_Image dstim, Window win, + int win_w, int win_h, + Evas_List points, + int r, int g, int b, int a) +{ +} + + + + + + @@ -2328,6 +2344,11 @@ void __evas_gl_gradient_free(Evas_GL_Graident *gr){} void __evas_gl_gradient_color_add(Evas_GL_Graident *gr, int r, int g, int b, int a, int dist){} void __evas_gl_gradient_draw(Evas_GL_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle){} +/************/ +/* polygons */ +/************/ +void __evas_gl_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a) {} + /***********/ /* drawing */ /***********/ diff --git a/legacy/evas/src/evas_gl_routines.h b/legacy/evas/src/evas_gl_routines.h index 4d2e616a92..b5a3369f90 100644 --- a/legacy/evas/src/evas_gl_routines.h +++ b/legacy/evas/src/evas_gl_routines.h @@ -194,6 +194,11 @@ void __evas_gl_gradient_free(Evas_GL_Graident *gr); void __evas_gl_gradient_color_add(Evas_GL_Graident *gr, int r, int g, int b, int a, int dist); void __evas_gl_gradient_draw(Evas_GL_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle); +/************/ +/* polygons */ +/************/ +void __evas_gl_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a); + /***********/ /* drawing */ /***********/ diff --git a/legacy/evas/src/evas_image_routines.c b/legacy/evas/src/evas_image_routines.c index 1093a7f427..a04e1433e8 100644 --- a/legacy/evas/src/evas_image_routines.c +++ b/legacy/evas/src/evas_image_routines.c @@ -683,6 +683,16 @@ __evas_image_gradient_draw(Evas_Image_Graident *gr, Display *disp, Imlib_Image d +/************/ +/* polygons */ +/************/ +void +__evas_image_poly_draw (Display *disp, Imlib_Image dstim, Window win, + int win_w, int win_h, + Evas_List points, + int r, int g, int b, int a) +{ +} diff --git a/legacy/evas/src/evas_image_routines.h b/legacy/evas/src/evas_image_routines.h index 2d065f024e..3db9164646 100644 --- a/legacy/evas/src/evas_image_routines.h +++ b/legacy/evas/src/evas_image_routines.h @@ -100,6 +100,11 @@ void __evas_image_gradient_free(Evas_Image_Graident *gr); void __evas_image_gradient_color_add(Evas_Image_Graident *gr, int r, int g, int b, int a, int dist); void __evas_image_gradient_draw(Evas_Image_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle); +/************/ +/* polygons */ +/************/ +void __evas_image_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a); + /***********/ /* drawing */ /***********/ diff --git a/legacy/evas/src/evas_imlib_routines.c b/legacy/evas/src/evas_imlib_routines.c index 90ae9caa45..add91b533e 100644 --- a/legacy/evas/src/evas_imlib_routines.c +++ b/legacy/evas/src/evas_imlib_routines.c @@ -1,3 +1,4 @@ + #include "evas_imlib_routines.h" static void __evas_imlib_image_cache_flush(Display *disp); @@ -481,8 +482,8 @@ void __evas_imlib_line_draw(Display *disp, Imlib_Image dstim, Windo imlib_context_set_color_modifier(NULL); imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); imlib_context_set_anti_alias(1); - imlib_context_set_blend(1); - w = x2 - x1; + imlib_context_set_blend(1); + w = x2 - x1; if (w < 0) w = -w; h = y2 - y1; if (h < 0) h = -h; @@ -537,7 +538,7 @@ void __evas_imlib_line_draw(Display *disp, Imlib_Image dstim, Windo -/*****************************************************************************/ +/****************************************************************************/ /* gradient externals ********************************************************/ /*****************************************************************************/ @@ -608,6 +609,97 @@ __evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display *disp, Imlib_Image d +/************/ +/* polygons */ +/************/ +void +__evas_imlib_poly_draw (Display *disp, Imlib_Image dstim, Window win, + int win_w, int win_h, + Evas_List points, + int r, int g, int b, int a) +{ + Evas_List l, l2; + int x, y, w, h; + + imlib_context_set_color(r, g, b, a); + imlib_context_set_angle(0.0); + imlib_context_set_operation(IMLIB_OP_COPY); + imlib_context_set_color_modifier(NULL); + imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); + imlib_context_set_anti_alias(1); + imlib_context_set_blend(1); + + x = y = w = h = 0; + if (points) + { + Evas_Point p; + + p = points->data; + x = p->x; + y = p->y; + w = 1; + h = 1; + } + for (l2 = points; l2; l2 = l2->next) + { + Evas_Point p; + + p = l2->data; + if (p->x < x) + { + w += x - p->x; + x = p->x; + } + if (p->x > (x + w)) + w = p->x - x; + if (p->y < y) + { + h += y - p->y; + y = p->y; + } + if (p->y > (y + h)) + h = p->y - y; + } + for(l = drawable_list; l; l = l->next) + { + Evas_Imlib_Drawable *dr; + + dr = l->data; + + if ((dr->win == win) && (dr->disp == disp)) + { + Evas_List ll; + + for (ll = dr->tmp_images; ll; ll = ll->next) + { + Evas_Imlib_Update *up; + + up = ll->data; + + /* if image intersects image update - render */ + if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, + x, y, w, h)) + { + ImlibPolygon pol; + + if (!up->image) + up->image = imlib_create_image(up->w, up->h); + imlib_context_set_image(up->image); + pol = imlib_polygon_new(); + for (l2 = points; l2; l2 = l2->next) + { + Evas_Point p; + + p = l2->data; + imlib_polygon_add_point(pol, p->x - up->x, p->y - up->y); + } + imlib_image_fill_polygon(pol); + imlib_polygon_free(pol); + } + } + } + } +} diff --git a/legacy/evas/src/evas_imlib_routines.h b/legacy/evas/src/evas_imlib_routines.h index 6114b1362d..d85de104da 100644 --- a/legacy/evas/src/evas_imlib_routines.h +++ b/legacy/evas/src/evas_imlib_routines.h @@ -100,6 +100,11 @@ void __evas_imlib_gradient_free(Evas_Imlib_Graident *gr); void __evas_imlib_gradient_color_add(Evas_Imlib_Graident *gr, int r, int g, int b, int a, int dist); void __evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle); +/************/ +/* polygons */ +/************/ +void __evas_imlib_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a); + /***********/ /* drawing */ /***********/ diff --git a/legacy/evas/src/evas_misc.c b/legacy/evas/src/evas_misc.c index 9b368969e0..dc447cbe77 100644 --- a/legacy/evas/src/evas_misc.c +++ b/legacy/evas/src/evas_misc.c @@ -219,6 +219,19 @@ evas_set_color(Evas e, Evas_Object o, int r, int g, int b, int a) o->changed = 1; e->changed = 1; break; + case OBJECT_POLYGON: + { + Evas_Object_Poly oo; + + oo = (Evas_Object_Poly)o; + oo->current.r = r; + oo->current.g = g; + oo->current.b = b; + oo->current.a = a; + } + o->changed = 1; + e->changed = 1; + break; default: break; } diff --git a/legacy/evas/src/evas_object.c b/legacy/evas/src/evas_object.c index 36217c7340..a8affa4fbc 100644 --- a/legacy/evas/src/evas_object.c +++ b/legacy/evas/src/evas_object.c @@ -410,8 +410,30 @@ evas_move(Evas e, Evas_Object o, double x, double y) if ((o->current.visible) && (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) event_update = 1; - o->current.x = x; - o->current.y = y; + if ((o->type == OBJECT_POLYGON)) + { + Evas_Object_Poly oo; + Evas_List l; + Evas_Point p; + double dx, dy; + + dx = x - o->current.x; + dy = y - o->current.y; + o->current.x = x; + o->current.y = y; + oo = o; + for (l = oo->current.points; l; l = l->next) + { + p = l->data; + p->x += dx; + p->y += dy; + } + } + else + { + o->current.x = x; + o->current.y = y; + } o->changed = 1; e->changed = 1; if ((o->current.visible) && @@ -429,6 +451,7 @@ evas_resize(Evas e, Evas_Object o, double w, double h) if (!o) return; if ((o->type == OBJECT_LINE)) return; if ((o->type == OBJECT_TEXT)) return; + if ((o->type == OBJECT_POLYGON)) return; if ((o->current.visible) && (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) event_update = 1; diff --git a/legacy/evas/src/evas_poly.c b/legacy/evas/src/evas_poly.c new file mode 100644 index 0000000000..8a0fa104a8 --- /dev/null +++ b/legacy/evas/src/evas_poly.c @@ -0,0 +1,158 @@ +#include "Evas_private.h" +#include "Evas.h" +#include +#include +#include +#include + +static void +_evas_free_poly(Evas_Object o) +{ + Evas_Object_Poly oo; + Evas_List l; + Evas_Point p; + + IF_OBJ(o, OBJECT_POLYGON) return; + oo = o; + for (l = oo->current.points; l; l = l->next) + { + p = l->data; + free(p); + } + evas_list_free(oo->current.points); + free(o); +} + +static void +_evas_free_poly_renderer_data(Evas e, Evas_Object o) +{ + switch (e->current.render_method) + { + case RENDER_METHOD_ALPHA_SOFTWARE: + break; + case RENDER_METHOD_BASIC_HARDWARE: + break; + case RENDER_METHOD_3D_HARDWARE: + break; + case RENDER_METHOD_ALPHA_HARDWARE: + break; + case RENDER_METHOD_IMAGE: + break; + default: + break; + } +} + +/* adding objects */ +Evas_Object +evas_add_poly(Evas e) +{ + Evas_Object_Poly oo; + Evas_Object_Any o; + Evas_List l; + Evas_Layer layer; + + if (!e) return NULL; + o = oo = malloc(sizeof(struct _Evas_Object_Poly)); + memset(o, 0, sizeof(struct _Evas_Object_Poly)); + o->type = OBJECT_POLYGON; + o->object_free = _evas_free_poly; + o->object_renderer_data_free = _evas_free_poly_renderer_data; + + o->current.x = 0; + o->current.y = 0; + o->current.w = 0; + o->current.h = 0; + + for (l = e->layers; l; l = l->next) + { + layer = l->data; + if (layer->layer == o->current.layer) + { + layer->objects = evas_list_append(layer->objects, o); + return o; + } + } + + layer = malloc(sizeof(struct _Evas_Layer)); + memset(layer, 0, sizeof(struct _Evas_Layer)); + e->layers = evas_list_append(e->layers, layer); + layer->objects = evas_list_append(layer->objects, o); + + return o; +} + +/* modifying object */ +evas_clear_points(Evas e, Evas_Object o) +{ + Evas_Point p; + Evas_Object_Poly oo; + Evas_List l; + + IF_OBJ(o, OBJECT_POLYGON) return; + oo = o; + if (oo->current.points) + { + for (l = oo->current.points; l; l = l->next) + { + p = l->data; + free(p); + } + evas_list_free(oo->current.points); + oo->current.points = NULL; + o->current.w = 0; + o->current.h = 0; + o->changed = 1; + e->changed = 1; + } +} + +Evas_List +evas_get_points(Evas e, Evas_Object o) +{ + Evas_Object_Poly oo; + + IF_OBJ(o, OBJECT_POLYGON) return NULL; + oo = o; + return oo->current.points; +} + +void +evas_add_point(Evas e, Evas_Object o, double x, double y) +{ + Evas_Point p; + Evas_Object_Poly oo; + + IF_OBJ(o, OBJECT_POLYGON) return; + oo = o; + p = malloc(sizeof(struct _Evas_Point)); + p->x = x; + p->y = y; + oo->previous.points = NULL; + if (!oo->current.points) + { + oo->current.points = evas_list_append(oo->current.points, p); + o->current.x = x; + o->current.y = y; + o->current.w = 1; + o->current.h = 1; + } + else + { + oo->current.points = evas_list_append(oo->current.points, p); + if (x > (o->current.x + o->current.w)) o->current.w = x - o->current.x + 1; + else if (x < o->current.x) + { + o->current.w += o->current.x - x; + o->current.x = x; + } + if (y > (o->current.y + o->current.h)) o->current.h = y - o->current.y + 1; + else if (y < o->current.y) + { + o->current.h += o->current.y - y; + o->current.y = y; + } + } + o->changed = 1; + e->changed = 1; +} diff --git a/legacy/evas/src/evas_render.c b/legacy/evas/src/evas_render.c index 48b755661d..923a6abacf 100644 --- a/legacy/evas/src/evas_render.c +++ b/legacy/evas/src/evas_render.c @@ -82,6 +82,7 @@ evas_render(Evas e) void (*func_rectangle_draw) (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a); void (*func_line_draw) (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a); void (*func_gradient_draw) (void *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle); + void (*func_poly_draw) (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a); if (!e) return; if ((!e->changed) || @@ -111,6 +112,7 @@ evas_render(Evas e) func_rectangle_draw = __evas_imlib_rectangle_draw; func_line_draw = __evas_imlib_line_draw; func_gradient_draw = __evas_imlib_gradient_draw; + func_poly_draw = __evas_imlib_poly_draw; break; case RENDER_METHOD_BASIC_HARDWARE: func_draw_add_rect = __evas_x11_draw_add_rect; @@ -128,6 +130,7 @@ evas_render(Evas e) func_rectangle_draw = __evas_x11_rectangle_draw; func_line_draw = __evas_x11_line_draw; func_gradient_draw = __evas_x11_gradient_draw; + func_poly_draw = __evas_x11_poly_draw; break; case RENDER_METHOD_3D_HARDWARE: func_draw_add_rect = __evas_gl_draw_add_rect; @@ -145,6 +148,7 @@ evas_render(Evas e) func_rectangle_draw = __evas_gl_rectangle_draw; func_line_draw = __evas_gl_line_draw; func_gradient_draw = __evas_gl_gradient_draw; + func_poly_draw = __evas_gl_poly_draw; break; case RENDER_METHOD_ALPHA_HARDWARE: break; @@ -164,6 +168,7 @@ evas_render(Evas e) func_rectangle_draw = __evas_image_rectangle_draw; func_line_draw = __evas_image_line_draw; func_gradient_draw = __evas_image_gradient_draw; + func_poly_draw = __evas_image_poly_draw; break; default: break; @@ -192,6 +197,7 @@ evas_render(Evas e) real_change = 0; o = ll->data; + if (o->delete_me) delete_objects = evas_list_append(delete_objects, o); if (o->changed) @@ -208,6 +214,8 @@ evas_render(Evas e) (o->current.stacking))) ) real_change = 1; + + o->current.stacking = 0; if ((!real_change) && (o->current.visible)) { @@ -301,6 +309,20 @@ evas_render(Evas e) oo->previous = oo->current; } break; + case OBJECT_POLYGON: + { + Evas_Object_Poly oo; + + oo = o; + if ((oo->previous.points != oo->current.points) || + (oo->current.r != oo->previous.r) || + (oo->current.g != oo->previous.g) || + (oo->current.b != oo->previous.b) || + (oo->current.a != oo->previous.a)) + real_change = 1; + oo->previous = oo->current; + } + break; default: break; } @@ -621,6 +643,25 @@ evas_render(Evas e) oo->current.angle); } break; + case OBJECT_POLYGON: + { + Evas_Object_Poly oo; + + oo = o; + + if (oo->current.points) + func_poly_draw(e->current.display, + e->current.image, + e->current.drawable, + e->current.drawable_width, + e->current.drawable_height, + oo->current.points, + oo->current.r, + oo->current.g, + oo->current.b, + oo->current.a); + } + break; default: break; } diff --git a/legacy/evas/src/evas_x11_routines.c b/legacy/evas/src/evas_x11_routines.c index d976fc9b7a..6d4d1cc3b5 100644 --- a/legacy/evas/src/evas_x11_routines.c +++ b/legacy/evas/src/evas_x11_routines.c @@ -807,6 +807,20 @@ __evas_x11_gradient_draw(Evas_X11_Graident *gr, Display *disp, Imlib_Image dstim +/************/ +/* polygons */ +/************/ +void +__evas_x11_poly_draw (Display *disp, Imlib_Image dstim, Window win, + int win_w, int win_h, + Evas_List points, + int r, int g, int b, int a) +{ +} + + + + diff --git a/legacy/evas/src/evas_x11_routines.h b/legacy/evas/src/evas_x11_routines.h index 372ed26546..3c14422b40 100644 --- a/legacy/evas/src/evas_x11_routines.h +++ b/legacy/evas/src/evas_x11_routines.h @@ -102,6 +102,11 @@ void __evas_x11_gradient_free(Evas_X11_Graident *gr); void __evas_x11_gradient_color_add(Evas_X11_Graident *gr, int r, int g, int b, int a, int dist); void __evas_x11_gradient_draw(Evas_X11_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle); +/************/ +/* polygons */ +/************/ +void __evas_x11_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a); + /***********/ /* drawing */ /***********/ diff --git a/legacy/evas/test/evas_test_old.c b/legacy/evas/test/evas_test_old.c index 8718a9c45f..6b95ea9213 100644 --- a/legacy/evas/test/evas_test_old.c +++ b/legacy/evas/test/evas_test_old.c @@ -76,7 +76,7 @@ main(int argc, char **argv) int win_w, win_h; int i, a, w, h, m; Evas e; - Evas_Object o[128], o_rect, o_line, o_grad, o_fps, o_text; + Evas_Object o[128], o_rect, o_line, o_grad, o_fps, o_text, o_poly; Evas_Gradient grad; int down; double t1, t2; @@ -234,6 +234,23 @@ main(int argc, char **argv) evas_callback_add(e, o_rect, CALLBACK_MOUSE_MOVE, mouse_move, NULL); evas_callback_add(e, o_rect, CALLBACK_MOUSE_IN, mouse_in, NULL); evas_callback_add(e, o_rect, CALLBACK_MOUSE_OUT, mouse_out, NULL); + + o_poly = evas_add_poly(e); + evas_show(e, o_poly); + evas_add_point(e, o_poly, 100, 100); + evas_add_point(e, o_poly, 200, 150); + evas_add_point(e, o_poly, 300, 80); + evas_add_point(e, o_poly, 500, 150); + evas_add_point(e, o_poly, 200, 120); + evas_add_point(e, o_poly, 55, 190); + evas_add_point(e, o_poly, 130, 110); + evas_set_color(e, o_poly, rand()&0xff, rand()&0xff, rand()&0xff, 180); + evas_set_layer(e, o_poly, 150); + evas_callback_add(e, o_poly, CALLBACK_MOUSE_DOWN, mouse_down, NULL); + evas_callback_add(e, o_poly, CALLBACK_MOUSE_UP, mouse_up, NULL); + evas_callback_add(e, o_poly, CALLBACK_MOUSE_MOVE, mouse_move, NULL); + evas_callback_add(e, o_poly, CALLBACK_MOUSE_IN, mouse_in, NULL); + evas_callback_add(e, o_poly, CALLBACK_MOUSE_OUT, mouse_out, NULL); o_line = evas_add_line(e); evas_show(e, o_line);