diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 83baae2f0b..c1495551b7 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -1403,6 +1403,65 @@ EAPI void evas_object_static_clip_set(Evas_Object *obj, Eina_Bool is_static_clip */ EAPI const Eina_List *evas_object_clipees_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT; +/** How the object should be rendered to output. + * + * @ingroup Evas + */ +typedef enum +{ + EVAS_RENDER_BLEND = 0, /** Default render operation: d = d*(1-sa) + s. The + * object will be merged onto the bottom objects using + * simple alpha compositing (a over b). */ + EVAS_RENDER_BLEND_REL = 1, /** DEPRECATED. d = d*(1 - sa) + s*da */ + EVAS_RENDER_COPY = 2, /** Copy mode, d = s. The object's pixels will replace + * everything that was below, effectively hiding them. + */ + EVAS_RENDER_COPY_REL = 3, /** DEPRECATED. d = s*da */ + EVAS_RENDER_ADD = 4, /** DEPRECATED. d = d + s */ + EVAS_RENDER_ADD_REL = 5, /** DEPRECATED. d = d + s*da */ + EVAS_RENDER_SUB = 6, /** DEPRECATED. d = d - s */ + EVAS_RENDER_SUB_REL = 7, /** DEPRECATED. d = d - s*da */ + EVAS_RENDER_TINT = 8, /** DEPRECATED. d = d*s + d*(1 - sa) + s*(1 - da) */ + EVAS_RENDER_TINT_REL = 9, /** DEPRECATED. d = d*(1 - sa + s) */ + EVAS_RENDER_MASK = 10, /** DEPRECATED. d = d*sa. For masking support, please + * use Evas.Object.clip_set or EDC "clip_to" instead. + */ + EVAS_RENDER_MUL = 11 /** DEPRECATED. d = d*s */ +} Evas_Render_Op; + +/** + * @brief Sets the render mode to be used for compositing the Evas object. + * + * Note that only copy and blend modes are actually supported: - + * @ref Evas_Render_Op.EVAS_RENDER_BLEND means the object will be merged on top + * of objects below it using simple alpha compositing. - + * @ref Evas_Render_Op.EVAS_RENDER_COPY means this object's pixels will replace + * everything that is below, making this object opaque. + * + * Please do not assume that @ref Evas_Render_Op.EVAS_RENDER_COPY mode can be + * used to "poke" holes in a window (to see through it), as only the compositor + * can ensure that. Copy mode should only be used with otherwise opaque + * widgets, or inside non-window surfaces (eg. a transparent background inside + * an Ecore.Evas.Buffer). + * + * @param[in] render_op One of the Evas_Render_Op values. Only blend (default) + * and copy modes are supported. + * + * @ingroup Evas_Object + */ +EAPI void evas_object_render_op_set(Evas_Object *obj, Evas_Render_Op render_op); + +/** + * @brief Retrieves the current value of the operation used for rendering the + * Evas object. + * + * @return One of the Evas_Render_Op values. Only blend (default) and copy + * modes are supported. + * + * @ingroup Evas_Object + */ +EAPI Evas_Render_Op evas_object_render_op_get(const Evas_Object *obj); + /** * @brief Get the "static clipper" hint flag for a given Evas object. * diff --git a/src/lib/evas/canvas/evas_object.eo b/src/lib/evas/canvas/evas_object.eo index 49b23cb0ce..88a2ef22f3 100644 --- a/src/lib/evas/canvas/evas_object.eo +++ b/src/lib/evas/canvas/evas_object.eo @@ -46,31 +46,28 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack, } } @property render_op { + [[Render mode to be used for compositing the Evas object. + + Only two modes are supported: + - @Efl.Gfx.Render_Op.blend means the object will be merged on + top of objects below it using simple alpha compositing. + - @Efl.Gfx.Render_Op.copy means this object's pixels will replace + everything that is below, making this object opaque. + + Please do not assume that @Efl.Gfx.Render_Op.copy mode can be + used to "poke" holes in a window (to see through it), as only the + compositor can ensure that. Copy mode should only be used with + otherwise opaque widgets, or inside non-window surfaces (eg. a + transparent background inside a buffer canvas). + ]] set { - [[Sets the render mode to be used for compositing the Evas object. - - Note that only copy and blend modes are actually supported: - - @Evas.Render_Op.blend means the object will be merged on top of - objects below it using simple alpha compositing. - - @Evas.Render_Op.copy means this object's pixels will replace - everything that is below, making this object opaque. - - Please do not assume that @Evas.Render_Op.copy mode can be used - to "poke" holes in a window (to see through it), as only the - compositor can ensure that. Copy mode should only be used with - otherwise opaque widgets, or inside non-window surfaces (eg. a - transparent background inside an Ecore.Evas.Buffer). - ]] + legacy: null; } get { - [[Retrieves the current value of the operation used for - rendering the Evas object. - ]] + legacy: null; } values { - render_op: Evas.Render_Op; [[One of the Evas_Render_Op values. - Only blend (default) and copy modes - are supported.]] + render_op: Efl.Gfx.Render_Op; [[Blend or copy.]] } } @property freeze_events { diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 2106a33733..6398ce8984 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -1728,10 +1728,10 @@ _evas_object_scale_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) return obj->cur->scale; } -EOLIAN static void -_evas_object_render_op_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Render_Op render_op) +static void +_render_op_set(Evas_Object_Protected_Data *obj, Evas_Render_Op render_op) { - if (obj->delete_me) return; + if (!obj || obj->delete_me) return; if (obj->cur->render_op == render_op) return; evas_object_async_block(obj); @@ -1741,14 +1741,32 @@ _evas_object_render_op_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Ren } EINA_COW_STATE_WRITE_END(obj, state_write, cur); - evas_object_change(eo_obj, obj); + evas_object_change(obj->object, obj); } -EOLIAN static Evas_Render_Op +EOLIAN static void +_evas_object_render_op_set(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Efl_Gfx_Render_Op rop) +{ + _render_op_set(obj, _gfx_to_evas_render_op(rop)); +} + +EAPI void +evas_object_render_op_set(Evas_Object *eo_obj, Evas_Render_Op render_op) +{ + Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj); + _render_op_set(obj, render_op); +} + +EOLIAN static Efl_Gfx_Render_Op _evas_object_render_op_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) { - if (obj->delete_me) return EVAS_RENDER_BLEND; - return obj->cur->render_op; + return _evas_to_gfx_render_op(obj->cur->render_op); +} + +EAPI Evas_Render_Op +evas_object_render_op_get(const Evas_Object *eo_obj) +{ + return _gfx_to_evas_render_op(evas_obj_render_op_get(eo_obj)); } EOLIAN static void diff --git a/src/lib/evas/canvas/evas_types.eot b/src/lib/evas/canvas/evas_types.eot index 109de28fb4..908724fe06 100644 --- a/src/lib/evas/canvas/evas_types.eot +++ b/src/lib/evas/canvas/evas_types.eot @@ -4,24 +4,6 @@ struct @extern Evas.Video_Surface; /* FIXME: The structure is full of the unsupp type Evas.Modifier_Mask: ullong; [[An Evas modifier mask type]] type Evas.Coord: int; [[A type for coordinates]] -enum Evas.Render_Op { - [[How the object should be rendered to output.]] - legacy: Evas_Render; - - blend = 0, [[Default render operation: d = d*(1-sa) + s. The object will be merged onto the bottom objects using simple alpha compositing (a over b).]] - blend_rel = 1, [[DEPRECATED. d = d*(1 - sa) + s*da]] - copy = 2, [[Copy mode, d = s. The object's pixels will replace everything that was below, effectively hiding them.]] - copy_rel = 3, [[DEPRECATED. d = s*da]] - add = 4, [[DEPRECATED. d = d + s]] - add_rel = 5, [[DEPRECATED. d = d + s*da]] - sub = 6, [[DEPRECATED. d = d - s]] - sub_rel = 7, [[DEPRECATED. d = d - s*da]] - tint = 8, [[DEPRECATED. d = d*s + d*(1 - sa) + s*(1 - da)]] - tint_rel = 9, [[DEPRECATED. d = d*(1 - sa + s)]] - mask = 10, [[DEPRECATED. d = d*sa. For masking support, please use Evas.Object.clip_set or EDC "clip_to" instead.]] - mul = 11 [[DEPRECATED. d = d*s]] -} - enum Evas.Object_Pointer_Mode { [[How the mouse pointer should be handled by Evas.