From 2ebf315591e0554c308d762a5b7c1823649deb1d Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Tue, 14 Apr 2015 15:21:52 +0200 Subject: [PATCH] evas: add a snapshot bool to Evas_Object_Image. Snapshot object are rendering the content of the canvas below them into them. They can then be used for filter, map or proxy. Have fun ! --- src/lib/evas/canvas/evas_image.eo | 22 ++++++++++++++++++++++ src/lib/evas/canvas/evas_object_image.c | 22 +++++++++++++++++++++- src/lib/evas/include/evas_private.h | 2 ++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo index 53c9076bcf..58a7baf524 100644 --- a/src/lib/evas/canvas/evas_image.eo +++ b/src/lib/evas/canvas/evas_image.eo @@ -784,6 +784,28 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill, Efl.Gfx.View, Default is #EVAS_IMAGE_ORIENT_NONE. */ } } + @property snapshot { + set { + /*@ + The content below the Evas_Object_Image will be rendered inside it and + you can reuse it as a source for any kind of effect. + + @since 1.15 + */ + } + get { + /*@ + Determine wether the Evas_Object_Image replicate the content of the + canvas below. + + @return @c EINA_TRUE if it does, @c EINA_FALSE if it doesn't. + @since 1.15 + */ + } + values { + s: bool; /*@ Wether to put the content of the canvas below inside the Evas_Object_Image. */ + } + } preload_begin { /*@ Begin preloading an image object's image data in the background */ legacy: null; diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 8956f815bf..32191fdabf 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -4738,7 +4738,25 @@ _evas_object_image_video_overlay_do(Evas_Object *eo_obj) o->delayed.video_hide = EINA_FALSE; } -/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ +static void +_evas_image_snapshot_set(Eo *eo, Evas_Image_Data *pd EINA_UNUSED, Eina_Bool s) +{ + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS); + + if (obj->cur->snapshot == s) return ; + + EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur) + state_write->snapshot = !!s; + EINA_COW_STATE_WRITE_END(obj, state_write, cur); +} + +static Eina_Bool +_evas_image_snapshot_get(Eo *eo, Evas_Image_Data *pd EINA_UNUSED) +{ + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS); + + return obj->cur->snapshot; +} EAPI void evas_object_image_file_set(Eo *obj, const char *file, const char *key) @@ -4811,3 +4829,5 @@ _evas_image_efl_gfx_filter_program_set(Eo *obj, Evas_Image_Data *pd EINA_UNUSED, } #include "canvas/evas_image.eo.c" + +/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 01b43401a5..fe838d0f14 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -808,6 +808,7 @@ struct _Evas_Public_Data Eina_Array pending_objects; Eina_Array obscuring_objects; Eina_Array temporary_objects; + Eina_Array snapshot_objects; Eina_Array clip_changes; Eina_Array scie_unref_queue; Eina_Array image_unref_queue; @@ -1004,6 +1005,7 @@ struct _Evas_Object_Protected_State Eina_Bool cached_surface : 1; Eina_Bool parent_cached_surface : 1; + Eina_Bool snapshot : 1; }; struct _Evas_Object_Protected_Data