summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-07-30 10:05:27 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-07-30 10:05:27 +0000
commitacc37b92271dc410777d4dea4ceaefa27fdf3816 (patch)
treea505e05e5c7a17324927fc32a8be0d88375bd39b
parentff5151f5437904dde1947b08f4197f1700c324ec (diff)
eskiss: proper use of ecore_evas_buffer.
SVN revision: 74568
-rw-r--r--src/bin/draw_object.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/src/bin/draw_object.c b/src/bin/draw_object.c
index 6e167bb..5908ad2 100644
--- a/src/bin/draw_object.c
+++ b/src/bin/draw_object.c
@@ -44,7 +44,6 @@ static Evas *evas = NULL;
44 44
45//Buffer evas for new object creation 45//Buffer evas for new object creation
46static Ecore_Evas *ee_buffer = NULL; 46static Ecore_Evas *ee_buffer = NULL;
47static Evas_Object *image_buffer = NULL;
48 47
49//private functions 48//private functions
50static void _add_point(int x, int y); 49static void _add_point(int x, int y);
@@ -238,16 +237,15 @@ Evas_Object *draw_object_create(Evas *e, Eina_List *point_list, BrushColor color
238 _find_bouding_box(point_list, iw / 2, &bx, &by, &bw, &bh); 237 _find_bouding_box(point_list, iw / 2, &bx, &by, &bw, &bh);
239 238
240 ee_buffer = ecore_evas_buffer_new(bw, bh); 239 ee_buffer = ecore_evas_buffer_new(bw, bh);
241 image_buffer = ecore_evas_object_image_new(ee_buffer); 240 ecore_evas_alpha_set(ee_buffer, 1);
242 241
243 evas_object_move(image_buffer, 0, 0); 242 Evas *evas_im = ecore_evas_get(ee_buffer);
244 evas_object_resize(image_buffer, bw, bh);
245 evas_object_image_fill_set(image_buffer, 0, 0, bw, bh);
246 evas_object_image_size_set(image_buffer, bw, bh);
247 evas_object_show(image_buffer);
248 243
249 Ecore_Evas *ee_im = (Ecore_Evas *)evas_object_data_get(image_buffer, "Ecore_Evas"); 244 Evas_Object *background = evas_object_rectangle_add(evas_im);;
250 Evas *evas_im = ecore_evas_get(ee_im); 245 evas_object_move(background, 0, 0);
246 evas_object_resize(background, bw, bh);
247 evas_object_color_set(background, 0, 0, 0, 0);
248 evas_object_show(background);
251 249
252 //create clipper 250 //create clipper
253 Evas_Object *color_clip = evas_object_rectangle_add(evas_im); 251 Evas_Object *color_clip = evas_object_rectangle_add(evas_im);
@@ -278,9 +276,6 @@ Evas_Object *draw_object_create(Evas *e, Eina_List *point_list, BrushColor color
278 evas_object_show(image); 276 evas_object_show(image);
279 } 277 }
280 278
281 //ecore_evas_buffer_pixels_get(ee_buffer);
282 //evas_object_image_save(image_buffer, "tmp.png", NULL, NULL);
283
284 //it's time to save our buffer image to a new one on the current Evas surface 279 //it's time to save our buffer image to a new one on the current Evas surface
285 Evas_Object *image = evas_object_image_add(e); 280 Evas_Object *image = evas_object_image_add(e);
286 281
@@ -292,7 +287,6 @@ Evas_Object *draw_object_create(Evas *e, Eina_List *point_list, BrushColor color
292 evas_object_image_data_copy_set(image, (void *)ecore_evas_buffer_pixels_get(ee_buffer)); 287 evas_object_image_data_copy_set(image, (void *)ecore_evas_buffer_pixels_get(ee_buffer));
293 evas_object_show(image); 288 evas_object_show(image);
294 289
295 evas_object_del(image_buffer);
296 ecore_evas_free(ee_buffer); 290 ecore_evas_free(ee_buffer);
297 291
298 INF("New object added to Evas"); 292 INF("New object added to Evas");
@@ -514,16 +508,9 @@ static void _mouse_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_i
514 oy = bg_height - oy; 508 oy = bg_height - oy;
515 509
516 ee_buffer = ecore_evas_buffer_new(bbox_w, bbox_h); 510 ee_buffer = ecore_evas_buffer_new(bbox_w, bbox_h);
517 image_buffer = ecore_evas_object_image_new(ee_buffer); 511 ecore_evas_alpha_set(ee_buffer, 1);
518
519 evas_object_move(image_buffer, 0, 0);
520 evas_object_resize(image_buffer, bbox_w, bbox_h);
521 evas_object_image_fill_set(image_buffer, 0, 0, bbox_w, bbox_h);
522 evas_object_image_size_set(image_buffer, bbox_w, bbox_h);
523 evas_object_show(image_buffer);
524 512
525 Ecore_Evas *ee_im = (Ecore_Evas *)evas_object_data_get(image_buffer, "Ecore_Evas"); 513 Evas *evas_im = ecore_evas_get(ee_buffer);
526 Evas *evas_im = ecore_evas_get(ee_im);
527 514
528 //create clipper 515 //create clipper
529 Evas_Object *color_clip = evas_object_rectangle_add(evas_im); 516 Evas_Object *color_clip = evas_object_rectangle_add(evas_im);
@@ -566,9 +553,6 @@ static void _mouse_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_i
566 path_list = eina_list_append(path_list, p); 553 path_list = eina_list_append(path_list, p);
567 } 554 }
568 555
569 //ecore_evas_buffer_pixels_get(ee_buffer);
570 //evas_object_image_save(image_buffer, "tmp.png", NULL, NULL);
571
572 //it's time to save our buffer image to a new one on the current Evas surface 556 //it's time to save our buffer image to a new one on the current Evas surface
573 Evas_Object *image = evas_object_image_add(evas); 557 Evas_Object *image = evas_object_image_add(evas);
574 558
@@ -580,7 +564,6 @@ static void _mouse_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_i
580 evas_object_image_data_copy_set(image, (void *)ecore_evas_buffer_pixels_get(ee_buffer)); 564 evas_object_image_data_copy_set(image, (void *)ecore_evas_buffer_pixels_get(ee_buffer));
581 evas_object_show(image); 565 evas_object_show(image);
582 566
583 evas_object_del(image_buffer);
584 ecore_evas_free(ee_buffer); 567 ecore_evas_free(ee_buffer);
585 568
586 //hide clipper 569 //hide clipper