efl: added fill_rule property in efl_gfx_shape class

Open question, should fill rule be part of the public data ? Let's
say no for now.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Subhransu Mohanty 2015-11-18 14:25:09 +09:00 committed by Cedric BAIL
parent 609f74994b
commit b1b0679daa
3 changed files with 51 additions and 2 deletions

View File

@ -124,6 +124,16 @@ typedef enum _Efl_Gfx_Gradient_Spread
} Efl_Gfx_Gradient_Spread;
/**
* Type defining how an image content get filled.
* @since 1.14
*/
typedef enum _Efl_Gfx_Fill_Rule
{
EFL_GFX_FILL_RULE_WINDING = 0, /**< Draw a horizontal line from the point to a location outside the shape. Determine whether the direction of the line at each intersection point is up or down. The winding number is determined by summing the direction of each intersection. If the number is non zero, the point is inside the shape. This mode is the default */
EFL_GFX_FILL_RULE_ODD_EVEN = 1, /**< Draw a horizontal line from the point to a location outside the shape, and count the number of intersections. If the number of intersections is an odd number, the point is inside the shape. */
} Efl_Gfx_Fill_Rule;
/**
* Type defining stroke information.
* @note Describe the properties to define the path stroke.

View File

@ -13,6 +13,8 @@ struct _Efl_Gfx_Shape_Data
{
Efl_Gfx_Shape_Public public;
Efl_Gfx_Fill_Rule fill_rule;
struct {
double x;
double y;
@ -435,6 +437,7 @@ _efl_gfx_shape_dup(Eo *obj, Efl_Gfx_Shape_Data *pd, const Eo *dup_from)
{
const Efl_Gfx_Dash *dash = NULL;
Efl_Gfx_Shape_Data *from;
Efl_Gfx_Fill_Rule fill_rule;
unsigned int dash_length = 0;
Efl_Gfx_Cap cap;
Efl_Gfx_Join j;
@ -453,7 +456,8 @@ _efl_gfx_shape_dup(Eo *obj, Efl_Gfx_Shape_Data *pd, const Eo *dup_from)
location = efl_gfx_shape_stroke_location_get(),
efl_gfx_shape_stroke_dash_get(&dash, &dash_length),
cap = efl_gfx_shape_stroke_cap_get(),
j = efl_gfx_shape_stroke_join_get());
j = efl_gfx_shape_stroke_join_get(),
fill_rule = efl_gfx_shape_fill_rule_get());
eo_do(obj,
efl_gfx_shape_stroke_scale_set(scale),
efl_gfx_shape_stroke_color_set(sr, sg, sb, sa),
@ -461,7 +465,8 @@ _efl_gfx_shape_dup(Eo *obj, Efl_Gfx_Shape_Data *pd, const Eo *dup_from)
efl_gfx_shape_stroke_location_set(location),
efl_gfx_shape_stroke_dash_set(dash, dash_length),
efl_gfx_shape_stroke_cap_set(cap),
efl_gfx_shape_stroke_join_set(j));
efl_gfx_shape_stroke_join_set(j),
efl_gfx_shape_fill_rule_set(fill_rule));
_efl_gfx_shape_path_set(obj, pd, from->commands, from->points);
@ -1497,4 +1502,19 @@ _efl_gfx_shape_stroke_join_get(Eo *obj EINA_UNUSED,
return pd->public.stroke.join;
}
static void
_efl_gfx_shape_fill_rule_set(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd,
Efl_Gfx_Fill_Rule fill_rule)
{
pd->fill_rule = fill_rule;
}
static Efl_Gfx_Fill_Rule
_efl_gfx_shape_fill_rule_get(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd)
{
return pd->fill_rule;
}
#include "interfaces/efl_gfx_shape.eo.c"

View File

@ -125,6 +125,25 @@ mixin Efl.Gfx.Shape
j: Efl_Gfx_Join; [[join style to use, default is EFL_GFX_JOIN_MITER]]
}
}
@property fill_rule {
set {
[[Sets the fill rule of the given shape object.
$EFL_GFX_FILL_RULE_WINDING, or $EFL_GFX_FILL_RULE_ODD_EVEN.
@since 1.14
]]
}
get {
[[Retrieves the fill rule for the given shape object.
@since 1.14
]]
}
values {
fill_rule: Efl_Gfx_Fill_Rule; [[The current fill rule of the shape object.
One of $EFL_GFX_FILL_RULE_WINDING, $EFL_GFX_FILL_RULE_ODD_EVEN]]
}
}
@property path {
set {
[[Set the list of commands and points to be used to create the