efl: add Efl.Gfx.Fill and migrate Evas.Image to it.

This commit is contained in:
Cedric BAIL 2015-04-03 16:23:24 +02:00
parent a38c037953
commit 7ba7ed4a1c
10 changed files with 225 additions and 90 deletions

View File

@ -7,6 +7,7 @@ efl_eolian_files = \
lib/efl/interfaces/efl_text_properties.eo \
lib/efl/interfaces/efl_gfx_base.eo \
lib/efl/interfaces/efl_gfx_stack.eo \
lib/efl/interfaces/efl_gfx_fill.eo \
lib/efl/interfaces/efl_gfx_shape.eo \
lib/efl/interfaces/efl_gfx_gradient.eo \
lib/efl/interfaces/efl_gfx_gradient_linear.eo \

View File

@ -11,6 +11,7 @@ generated_efl_cxx_bindings = \
lib/efl/interfaces/efl_text_properties.eo.hh \
lib/efl/interfaces/efl_gfx_base.eo.hh \
lib/efl/interfaces/efl_gfx_stack.eo.hh \
lib/efl/interfaces/efl_gfx_fill.eo.hh \
lib/efl/interfaces/efl_gfx_shape.eo.hh \
lib/efl/interfaces/efl_gfx_gradient.eo.hh \
lib/efl/interfaces/efl_gfx_gradient_linear.eo.hh \

View File

@ -2686,10 +2686,10 @@ _edje_proxy_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
}
eo_do(ep->object,
evas_obj_image_fill_set(p3->type.common.fill.x,
p3->type.common.fill.y,
p3->type.common.fill.w,
p3->type.common.fill.h),
efl_gfx_fill_set(p3->type.common.fill.x,
p3->type.common.fill.y,
p3->type.common.fill.w,
p3->type.common.fill.h),
efl_image_smooth_scale_set(p3->smooth),
evas_obj_image_source_visible_set(chosen_desc->proxy.source_visible),
evas_obj_image_source_clip_set(chosen_desc->proxy.source_clip));
@ -2727,9 +2727,9 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
}
eo_do(ep->object,
evas_obj_image_fill_set(p3->type.common.fill.x, p3->type.common.fill.y,
p3->type.common.fill.w, p3->type.common.fill.h),
efl_image_smooth_scale_set(p3->smooth));
efl_gfx_fill_set(p3->type.common.fill.x, p3->type.common.fill.y,
p3->type.common.fill.w, p3->type.common.fill.h),
efl_image_smooth_scale_set(p3->smooth));
if (chosen_desc->image.border.scale)
{
if (p3->type.common.spec.image.border_scale_by > FROM_DOUBLE(0.0))

View File

@ -111,6 +111,20 @@ typedef enum _Efl_Gfx_Gradient_Spread
EFL_GFX_GRADIENT_SPREAD_LAST
} Efl_Gfx_Gradient_Spread;
/**
* Type defining how an image content get filled.
* @since 1.13
*/
typedef enum _Efl_Gfx_Fill_Spread
{
EFL_GFX_FILL_REFLECT = 0, /**< image fill tiling mode - tiling reflects */
EFL_GFX_FILL_REPEAT = 1, /**< tiling repeats */
EFL_GFX_FILL_RESTRICT = 2, /**< tiling clamps - range offset ignored */
EFL_GFX_FILL_RESTRICT_REFLECT = 3, /**< tiling clamps and any range offset reflects */
EFL_GFX_FILL_RESTRICT_REPEAT = 4, /**< tiling clamps and any range offset repeats */
EFL_GFX_FILL_PAD = 5 /**< tiling extends with end values */
} Efl_Gfx_Fill_Spread;
#ifdef EFL_BETA_API_SUPPORT
/* Interfaces */
@ -125,6 +139,7 @@ typedef enum _Efl_Gfx_Gradient_Spread
#include "interfaces/efl_gfx_base.eo.h"
#include "interfaces/efl_gfx_stack.eo.h"
#include "interfaces/efl_gfx_fill.eo.h"
#include "interfaces/efl_gfx_shape.eo.h"
#include "interfaces/efl_gfx_gradient.eo.h"
#include "interfaces/efl_gfx_gradient_linear.eo.h"

View File

@ -0,0 +1,72 @@
interface Efl.Gfx.Fill {
legacy_prefix: null;
properties {
fill_spread {
set {
/*@
Sets the tiling mode for the given evas image object's fill.
EFL_GFX_FILL_RESTRICT, or EFL_GFX_FILL_PAD. */
}
get {
/*@
Retrieves the spread (tiling mode) for the given image object's
fill.
@return The current spread mode of the image object. */
}
values {
Efl_Gfx_Fill_Spread spread; /*@ One of EVAS_TEXTURE_REFLECT, EVAS_TEXTURE_REPEAT, */
}
}
fill {
set {
/*@
Set how to fill an image object's drawing rectangle given the
(real) image bound to it.
Note that if @p w or @p h are smaller than the dimensions of
@p obj, the displayed image will be @b tiled around the object's
area. To have only one copy of the bound image drawn, @p x and @p y
must be 0 and @p w and @p h need to be the exact width and height
of the image object itself, respectively.
See the following image to better understand the effects of this
call. On this diagram, both image object and original image source
have @c a x @c a dimensions and the image itself is a circle, with
empty space around it:
@image html image-fill.png
@image rtf image-fill.png
@image latex image-fill.eps
@warning The default values for the fill parameters are @p x = 0,
@p y = 0, @p w = 0 and @p h = 0. Thus, if you're not using the
evas_object_image_filled_add() helper and want your image
displayed, you'll have to set valid values with this function on
your object.
@note evas_object_image_filled_set() is a helper function which
will @b override the values set here automatically, for you, in a
given way. */
}
get {
/*@
Retrieve how an image object is to fill its drawing rectangle,
given the (real) image bound to it.
@note Use @c NULL pointers on the fill components you're not
interested in: they'll be ignored by the function.
See @ref evas_object_image_fill_set() for more details. */
}
values {
int x; /*@ The x coordinate (from the top left corner of the bound
image) to start drawing from. */
int y; /*@ The y coordinate (from the top left corner of the bound
image) to start drawing from. */
int w; /*@ The width the bound image will be displayed at. */
int h; /*@ The height the bound image will be displayed at. */
}
}
}
}

View File

@ -13,6 +13,7 @@
#include "interfaces/efl_gfx_base.eo.c"
#include "interfaces/efl_gfx_stack.eo.c"
#include "interfaces/efl_gfx_fill.eo.c"
#include "interfaces/efl_gfx_shape.eo.c"
#include "interfaces/efl_gfx_gradient.eo.c"
#include "interfaces/efl_gfx_gradient_linear.eo.c"

View File

@ -432,15 +432,13 @@ typedef enum _Evas_Alloc_Error
EVAS_ALLOC_ERROR_RECOVERED = 2 /**< Allocation succeeded, but extra memory had to be found by freeing up speculative resources */
} Evas_Alloc_Error; /**< Possible allocation errors returned by evas_alloc_error() */
typedef enum _Evas_Fill_Spread
{
EVAS_TEXTURE_REFLECT = 0, /**< image fill tiling mode - tiling reflects */
EVAS_TEXTURE_REPEAT = 1, /**< tiling repeats */
EVAS_TEXTURE_RESTRICT = 2, /**< tiling clamps - range offset ignored */
EVAS_TEXTURE_RESTRICT_REFLECT = 3, /**< tiling clamps and any range offset reflects */
EVAS_TEXTURE_RESTRICT_REPEAT = 4, /**< tiling clamps and any range offset repeats */
EVAS_TEXTURE_PAD = 5 /**< tiling extends with end values */
} Evas_Fill_Spread; /**< Fill types used for evas_object_image_fill_spread_set() */
typedef Efl_Gfx_Fill_Spread Evas_Fill_Spread;
#define EVAS_TEXTURE_REFLECT EFL_GFX_FILL_REFLECT
#define EVAS_TEXTURE_REPEAT EFL_GFX_FILL_REPEAT
#define EVAS_TEXTURE_RESTRICT EFL_GFX_FILL_RESTRICT
#define EVAS_TEXTURE_RESTRICT_REFLECT EFL_GFX_FILL_RESTRICT_REFLECT
#define EVAS_TEXTURE_RESTRICT_REPEAT EFL_GFX_FILL_RESTRICT_REPEAT
#define EVAS_TEXTURE_PAD EFL_GFX_FILL_PAD
typedef enum _Evas_Pixel_Import_Pixel_Format
{

View File

@ -803,7 +803,6 @@ EAPI void evas_object_stack_above(Evas_Object *obj, Evas_Object *above) EINA_ARG
*/
EAPI void evas_object_lower(Evas_Object *obj);
#include "canvas/evas_common_interface.eo.legacy.h"
#include "canvas/evas_object.eo.legacy.h"
@ -1990,6 +1989,83 @@ EAPI void evas_object_image_smooth_scale_set(Eo *obj, Eina_Bool smooth_scale);
*/
EAPI Eina_Bool evas_object_image_smooth_scale_get(const Eo *obj);
/**
*
* Sets the tiling mode for the given evas image object's fill.
* EVAS_TEXTURE_RESTRICT, or EVAS_TEXTURE_PAD.
*
* @param[in] spread One of EVAS_TEXTURE_REFLECT, EVAS_TEXTURE_REPEAT,
*/
EAPI void evas_object_image_fill_spread_set(Evas_Object *obj, Evas_Fill_Spread spread);
/**
*
* Retrieves the spread (tiling mode) for the given image object's
* fill.
*
* @return The current spread mode of the image object.
*
*/
EAPI Evas_Fill_Spread evas_object_image_fill_spread_get(const Evas_Object *obj);
/**
*
* Set how to fill an image object's drawing rectangle given the
* (real) image bound to it.
*
* Note that if @p w or @p h are smaller than the dimensions of
* @p obj, the displayed image will be @b tiled around the object's
* area. To have only one copy of the bound image drawn, @p x and @p y
* must be 0 and @p w and @p h need to be the exact width and height
* of the image object itself, respectively.
*
* See the following image to better understand the effects of this
* call. On this diagram, both image object and original image source
* have @c a x @c a dimensions and the image itself is a circle, with
* empty space around it:
*
* @image html image-fill.png
* @image rtf image-fill.png
* @image latex image-fill.eps
*
* @warning The default values for the fill parameters are @p x = 0,
* @p y = 0, @p w = 0 and @p h = 0. Thus, if you're not using the
* evas_object_image_filled_add() helper and want your image
* displayed, you'll have to set valid values with this function on
* your object.
*
* @note evas_object_image_filled_set() is a helper function which
* will @b override the values set here automatically, for you, in a
* given way.
*
* @param[in] x The x coordinate (from the top left corner of the bound
image) to start drawing from.
* @param[in] y The y coordinate (from the top left corner of the bound
image) to start drawing from.
* @param[in] w The width the bound image will be displayed at.
* @param[in] h The height the bound image will be displayed at.
*/
EAPI void evas_object_image_fill_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
/**
*
* Retrieve how an image object is to fill its drawing rectangle,
* given the (real) image bound to it.
*
* @note Use @c NULL pointers on the fill components you're not
* interested in: they'll be ignored by the function.
*
* See @ref evas_object_image_fill_set() for more details.
*
* @param[out] x The x coordinate (from the top left corner of the bound
image) to start drawing from.
* @param[out] y The y coordinate (from the top left corner of the bound
image) to start drawing from.
* @param[out] w The width the bound image will be displayed at.
* @param[out] h The height the bound image will be displayed at.
*/
EAPI void evas_object_image_fill_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
#include "canvas/evas_image.eo.legacy.h"
/**

View File

@ -1,4 +1,4 @@
class Evas.Image (Evas.Object, Efl.File, Efl.Image)
class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill)
{
legacy_prefix: evas_object_image;
eo_prefix: evas_obj_image;
@ -362,23 +362,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image)
bool enable; /*@ @c EINA_TRUE means that it should honor the orientation information */
}
}
fill_spread {
set {
/*@
Sets the tiling mode for the given evas image object's fill.
EVAS_TEXTURE_RESTRICT, or EVAS_TEXTURE_PAD. */
}
get {
/*@
Retrieves the spread (tiling mode) for the given image object's
fill.
@return The current spread mode of the image object. */
}
values {
Evas_Fill_Spread spread; /*@ One of EVAS_TEXTURE_REFLECT, EVAS_TEXTURE_REPEAT, */
}
}
border_center_fill {
set {
/*@
@ -474,56 +457,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image)
otherwise. */
}
}
fill {
set {
/*@
Set how to fill an image object's drawing rectangle given the
(real) image bound to it.
Note that if @p w or @p h are smaller than the dimensions of
@p obj, the displayed image will be @b tiled around the object's
area. To have only one copy of the bound image drawn, @p x and @p y
must be 0 and @p w and @p h need to be the exact width and height
of the image object itself, respectively.
See the following image to better understand the effects of this
call. On this diagram, both image object and original image source
have @c a x @c a dimensions and the image itself is a circle, with
empty space around it:
@image html image-fill.png
@image rtf image-fill.png
@image latex image-fill.eps
@warning The default values for the fill parameters are @p x = 0,
@p y = 0, @p w = 0 and @p h = 0. Thus, if you're not using the
evas_object_image_filled_add() helper and want your image
displayed, you'll have to set valid values with this function on
your object.
@note evas_object_image_filled_set() is a helper function which
will @b override the values set here automatically, for you, in a
given way. */
}
get {
/*@
Retrieve how an image object is to fill its drawing rectangle,
given the (real) image bound to it.
@note Use @c NULL pointers on the fill components you're not
interested in: they'll be ignored by the function.
See @ref evas_object_image_fill_set() for more details. */
}
values {
Evas_Coord x; /*@ The x coordinate (from the top left corner of the bound
image) to start drawing from. */
Evas_Coord y; /*@ The y coordinate (from the top left corner of the bound
image) to start drawing from. */
Evas_Coord w; /*@ The width the bound image will be displayed at. */
Evas_Coord h; /*@ The height the bound image will be displayed at. */
}
}
native_surface {
set {
/*@
@ -1073,5 +1006,9 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image)
Efl.Image.load_size.get;
Efl.Image.smooth_scale.set;
Efl.Image.smooth_scale.get;
Efl.Gfx.Fill.fill_spread.set;
Efl.Gfx.Fill.fill_spread.get;
Efl.Gfx.Fill.fill.set;
Efl.Gfx.Fill.fill.get;
}
}

View File

@ -978,8 +978,17 @@ _evas_image_border_scale_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
return o->cur->border.scale;
}
EAPI void
evas_object_image_fill_set(Evas_Image *obj,
Evas_Coord x, Evas_Coord y,
Evas_Coord w, Evas_Coord h)
{
eo_do((Evas_Image *)obj, efl_gfx_fill_set(x, y, w, h));
}
EOLIAN static void
_evas_image_fill_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
_evas_image_efl_gfx_fill_fill_set(Eo *eo_obj, Evas_Image_Data *o,
int x, int y, int w, int h)
{
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
@ -1008,8 +1017,17 @@ _evas_image_fill_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Coord x, Evas_Coord y,
evas_object_change(eo_obj, obj);
}
EAPI void
evas_object_image_fill_get(const Evas_Image *obj,
Evas_Coord *x, Evas_Coord *y,
Evas_Coord *w, Evas_Coord *h)
{
eo_do((Evas_Image *)obj, efl_gfx_fill_get(x, y, w, h));
}
EOLIAN static void
_evas_image_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
_evas_image_efl_gfx_fill_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o,
int *x, int *y, int *w, int *h)
{
if (x) *x = o->cur->fill.x;
if (y) *y = o->cur->fill.y;
@ -1017,8 +1035,15 @@ _evas_image_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Evas_Coord *x,
if (h) *h = o->cur->fill.h;
}
EAPI void
evas_object_image_fill_spread_set(Evas_Image *obj, Evas_Fill_Spread spread)
{
eo_do((Evas_Image *)obj, efl_gfx_fill_spread_set(spread));
}
EOLIAN static void
_evas_image_fill_spread_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Fill_Spread spread)
_evas_image_efl_gfx_fill_fill_spread_set(Eo *eo_obj, Evas_Image_Data *o,
Efl_Gfx_Fill_Spread spread)
{
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
@ -1033,8 +1058,17 @@ _evas_image_fill_spread_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Fill_Spread spr
evas_object_change(eo_obj, obj);
}
EOLIAN static Evas_Fill_Spread
_evas_image_fill_spread_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
EAPI Evas_Fill_Spread
evas_object_image_fill_spread_get(const Evas_Image *obj)
{
Evas_Fill_Spread ret;
return eo_do_ret((Evas_Image *)obj, ret, efl_gfx_fill_spread_get());
}
EOLIAN static Efl_Gfx_Fill_Spread
_evas_image_efl_gfx_fill_fill_spread_get(Eo *eo_obj EINA_UNUSED,
Evas_Image_Data *o)
{
return (Evas_Fill_Spread)o->cur->spread;;
}