diff options
author | Cedric BAIL <cedric@osg.samsung.com> | 2015-04-14 15:21:52 +0200 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2015-07-01 20:57:57 +0900 |
commit | d283027c77c0fcf69590b9c9c73cdada515088b2 (patch) | |
tree | ffc2b5ec26466407a481646c7584c9f9d213c879 | |
parent | f4f808f25dd66b4a1e4ad40580d6c4cd47972699 (diff) | |
download | efl-d283027c77c0fcf69590b9c9c73cdada515088b2.tar.gz |
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 !
-rw-r--r-- | src/lib/evas/canvas/evas_image.eo | 22 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_image.c | 22 | ||||
-rw-r--r-- | src/lib/evas/include/evas_private.h | 2 |
3 files changed, 45 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo index cec824ab24..8e0ac82d81 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 7134783111..30797e8d0c 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -4705,7 +4705,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) @@ -4778,3 +4796,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 24f70cd9cc..18380363dd 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 |