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 !
This commit is contained in:
Cedric BAIL 2015-04-14 15:21:52 +02:00
parent 0d44b94248
commit 2ebf315591
3 changed files with 45 additions and 1 deletions

View File

@ -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;

View File

@ -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 :*/

View File

@ -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