efl: make path stroke related api as non virtual.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Subhransu Mohanty 2015-11-18 11:13:00 +09:00 committed by Cedric BAIL
parent abe2110152
commit 609f74994b
10 changed files with 238 additions and 385 deletions

View File

@ -60,9 +60,12 @@ static void (*cairo_set_dash) (cairo_t *cr, const double *dashes, int num_dashes
typedef struct _Ector_Renderer_Cairo_Shape_Data Ector_Renderer_Cairo_Shape_Data;
struct _Ector_Renderer_Cairo_Shape_Data
{
Efl_Gfx_Shape_Public *public_shape;
Ector_Cairo_Surface_Data *parent;
Ector_Renderer_Generic_Shape_Data *shape;
Ector_Renderer_Generic_Base_Data *base;
cairo_path_t *path;
};
@ -163,7 +166,7 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend
if (pd->shape->fill)
eo_do(pd->shape->fill, ector_renderer_cairo_base_fill(mul_col));
if (pd->shape->stroke.fill || pd->shape->stroke.color.a > 0)
if (pd->shape->stroke.fill || pd->public_shape->stroke.color.a > 0)
{
cairo_fill_preserve(pd->parent->cairo);
@ -171,31 +174,31 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend
eo_do(pd->shape->stroke.fill, ector_renderer_cairo_base_fill(mul_col));
else
{
r = (((pd->shape->stroke.color.r * R_VAL(&mul_col)) + 0xff) >> 8);
g = (((pd->shape->stroke.color.g * G_VAL(&mul_col)) + 0xff) >> 8);
b = (((pd->shape->stroke.color.b * B_VAL(&mul_col)) + 0xff) >> 8);
a = (((pd->shape->stroke.color.a * A_VAL(&mul_col)) + 0xff) >> 8);
r = (((pd->public_shape->stroke.color.r * R_VAL(&mul_col)) + 0xff) >> 8);
g = (((pd->public_shape->stroke.color.g * G_VAL(&mul_col)) + 0xff) >> 8);
b = (((pd->public_shape->stroke.color.b * B_VAL(&mul_col)) + 0xff) >> 8);
a = (((pd->public_shape->stroke.color.a * A_VAL(&mul_col)) + 0xff) >> 8);
ector_color_argb_unpremul(a, &r, &g, &b);
cairo_set_source_rgba(pd->parent->cairo, r/255.0, g/255.0, b/255.0, a/255.0);
if (pd->shape->stroke.dash)
if (pd->public_shape->stroke.dash)
{
double *dashinfo;
dashinfo = (double *) malloc(2 * pd->shape->stroke.dash_length * sizeof(double));
for (i = 0; i < pd->shape->stroke.dash_length; i++)
dashinfo = (double *) malloc(2 * pd->public_shape->stroke.dash_length * sizeof(double));
for (i = 0; i < pd->public_shape->stroke.dash_length; i++)
{
dashinfo[i*2] = pd->shape->stroke.dash[i].length;
dashinfo[i*2 + 1] = pd->shape->stroke.dash[i].gap;
dashinfo[i*2] = pd->public_shape->stroke.dash[i].length;
dashinfo[i*2 + 1] = pd->public_shape->stroke.dash[i].gap;
}
cairo_set_dash(pd->parent->cairo, dashinfo, pd->shape->stroke.dash_length * 2, 0);
cairo_set_dash(pd->parent->cairo, dashinfo, pd->public_shape->stroke.dash_length * 2, 0);
free(dashinfo);
}
}
// Set dash, cap and join
cairo_set_line_width(pd->parent->cairo, (pd->shape->stroke.width * pd->shape->stroke.scale * 2));
cairo_set_line_cap(pd->parent->cairo, (cairo_line_cap_t) pd->shape->stroke.cap);
cairo_set_line_join(pd->parent->cairo, (cairo_line_join_t) pd->shape->stroke.join);
cairo_set_line_width(pd->parent->cairo, (pd->public_shape->stroke.width * pd->public_shape->stroke.scale * 2));
cairo_set_line_cap(pd->parent->cairo, (cairo_line_cap_t) pd->public_shape->stroke.cap);
cairo_set_line_join(pd->parent->cairo, (cairo_line_join_t) pd->public_shape->stroke.join);
cairo_stroke(pd->parent->cairo);
}
else
@ -239,6 +242,7 @@ _ector_renderer_cairo_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Sh
eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, obj = eo_constructor());
if (!obj) return NULL;
pd->public_shape = eo_data_xref(obj, EFL_GFX_SHAPE_MIXIN, obj);
pd->shape = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_SHAPE_MIXIN, obj);
pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
@ -306,17 +310,17 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_crc_get(Eo *obj,
crc = ector_renderer_crc_get());
crc = eina_crc((void*) &pd->shape->stroke.marker, sizeof (pd->shape->stroke.marker), crc, EINA_FALSE);
crc = eina_crc((void*) &pd->shape->stroke.scale, sizeof (pd->shape->stroke.scale) * 3, crc, EINA_FALSE); // scale, width, centered
crc = eina_crc((void*) &pd->shape->stroke.color, sizeof (pd->shape->stroke.color), crc, EINA_FALSE);
crc = eina_crc((void*) &pd->shape->stroke.cap, sizeof (pd->shape->stroke.cap), crc, EINA_FALSE);
crc = eina_crc((void*) &pd->shape->stroke.join, sizeof (pd->shape->stroke.join), crc, EINA_FALSE);
crc = eina_crc((void*) &pd->public_shape->stroke.scale, sizeof (pd->public_shape->stroke.scale) * 3, crc, EINA_FALSE); // scale, width, centered
crc = eina_crc((void*) &pd->public_shape->stroke.color, sizeof (pd->public_shape->stroke.color), crc, EINA_FALSE);
crc = eina_crc((void*) &pd->public_shape->stroke.cap, sizeof (pd->public_shape->stroke.cap), crc, EINA_FALSE);
crc = eina_crc((void*) &pd->public_shape->stroke.join, sizeof (pd->public_shape->stroke.join), crc, EINA_FALSE);
if (pd->shape->fill) crc = _renderer_crc_get(pd->shape->fill, crc);
if (pd->shape->stroke.fill) crc = _renderer_crc_get(pd->shape->stroke.fill, crc);
if (pd->shape->stroke.marker) crc = _renderer_crc_get(pd->shape->stroke.marker, crc);
if (pd->shape->stroke.dash_length)
if (pd->public_shape->stroke.dash_length)
{
crc = eina_crc((void*) pd->shape->stroke.dash, sizeof (Efl_Gfx_Dash) * pd->shape->stroke.dash_length, crc, EINA_FALSE);
crc = eina_crc((void*) pd->public_shape->stroke.dash, sizeof (Efl_Gfx_Dash) * pd->public_shape->stroke.dash_length, crc, EINA_FALSE);
}
return crc;

View File

@ -129,20 +129,6 @@ struct _Ector_Renderer_Generic_Shape_Data
struct {
Ector_Renderer *fill;
Ector_Renderer *marker;
double scale;
double width;
double centered;
struct {
int r, g, b, a;
} color;
Efl_Gfx_Dash *dash;
unsigned int dash_length;
Efl_Gfx_Cap cap;
Efl_Gfx_Join join;
} stroke;
};

View File

@ -31,13 +31,4 @@ mixin Ector.Renderer.Generic.Shape (Efl.Gfx.Shape)
}
}
}
implements {
Efl.Gfx.Shape.stroke_scale;
Efl.Gfx.Shape.stroke_color;
Efl.Gfx.Shape.stroke_width;
Efl.Gfx.Shape.stroke_location;
Efl.Gfx.Shape.stroke_dash;
Efl.Gfx.Shape.stroke_cap;
Efl.Gfx.Shape.stroke_join;
}
}

View File

@ -52,135 +52,4 @@ _ector_renderer_generic_shape_stroke_marker_get(Eo *obj EINA_UNUSED,
return pd->stroke.marker;
}
static void
_ector_renderer_generic_shape_efl_gfx_shape_stroke_scale_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd,
double s)
{
pd->stroke.scale = s;
}
static double
_ector_renderer_generic_shape_efl_gfx_shape_stroke_scale_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd)
{
return pd->stroke.scale;
}
static void
_ector_renderer_generic_shape_efl_gfx_shape_stroke_color_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd,
int r, int g, int b, int a)
{
pd->stroke.color.r = r;
pd->stroke.color.g = g;
pd->stroke.color.b = b;
pd->stroke.color.a = a;
}
static void
_ector_renderer_generic_shape_efl_gfx_shape_stroke_color_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd,
int *r, int *g, int *b, int *a)
{
if (r) *r = pd->stroke.color.r;
if (g) *g = pd->stroke.color.g;
if (b) *b = pd->stroke.color.b;
if (a) *a = pd->stroke.color.a;
}
static void
_ector_renderer_generic_shape_efl_gfx_shape_stroke_width_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd,
double w)
{
pd->stroke.width = w;
}
static double
_ector_renderer_generic_shape_efl_gfx_shape_stroke_width_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd)
{
return pd->stroke.width;
}
static void
_ector_renderer_generic_shape_efl_gfx_shape_stroke_location_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd,
double centered)
{
pd->stroke.centered = centered;
}
static double
_ector_renderer_generic_shape_efl_gfx_shape_stroke_location_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd)
{
return pd->stroke.centered;
}
static void
_ector_renderer_generic_shape_efl_gfx_shape_stroke_dash_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd,
const Efl_Gfx_Dash *dash,
unsigned int length)
{
Efl_Gfx_Dash *tmp;
if (!dash)
{
free(pd->stroke.dash);
pd->stroke.dash = NULL;
pd->stroke.dash_length = 0;
return ;
}
tmp = realloc(pd->stroke.dash, length * sizeof (Efl_Gfx_Dash));
if (!tmp && length) return ;
memcpy(tmp, dash, length * sizeof (Efl_Gfx_Dash));
pd->stroke.dash = tmp;
pd->stroke.dash_length = length;
}
static void
_ector_renderer_generic_shape_efl_gfx_shape_stroke_dash_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd,
const Efl_Gfx_Dash **dash,
unsigned int *length)
{
if (dash) *dash = pd->stroke.dash;
if (length) *length = pd->stroke.dash_length;
}
static void
_ector_renderer_generic_shape_efl_gfx_shape_stroke_cap_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd,
Efl_Gfx_Cap c)
{
pd->stroke.cap = c;
}
static Efl_Gfx_Cap
_ector_renderer_generic_shape_efl_gfx_shape_stroke_cap_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd)
{
return pd->stroke.cap;
}
static void
_ector_renderer_generic_shape_efl_gfx_shape_stroke_join_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd,
Efl_Gfx_Join j)
{
pd->stroke.join = j;
}
static Efl_Gfx_Join
_ector_renderer_generic_shape_efl_gfx_shape_stroke_join_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Generic_Shape_Data *pd)
{
return pd->stroke.join;
}
#include "ector_renderer_generic_shape.eo.c"

View File

@ -12,13 +12,15 @@
#include "ector_private.h"
#include "ector_software_private.h"
typedef struct _Ector_Renderer_Software_Shape_Data Ector_Renderer_Software_Shape_Data;
struct _Ector_Renderer_Software_Shape_Data
{
Efl_Gfx_Shape_Public *public_shape;
Ector_Software_Surface_Data *surface;
Ector_Renderer_Generic_Shape_Data *shape;
Ector_Renderer_Generic_Base_Data *base;
Shape_Rle_Data *shape_data;
Shape_Rle_Data *outline_data;
};
@ -28,7 +30,7 @@ typedef struct _Outline
SW_FT_Outline ft_outline;
int points_alloc;
int contours_alloc;
}Outline;
} Outline;
#define TO_FT_COORD(x) ((x) * 64) // to freetype 26.6 coordinate.
@ -495,8 +497,8 @@ _generate_stroke_data(Ector_Renderer_Software_Shape_Data *pd)
if (pd->outline_data) return EINA_FALSE;
if (!pd->shape->stroke.fill &&
((pd->shape->stroke.color.a == 0) ||
(pd->shape->stroke.width < 0.01)))
((pd->public_shape->stroke.color.a == 0) ||
(pd->public_shape->stroke.width < 0.01)))
return EINA_FALSE;
return EINA_TRUE;
@ -536,17 +538,17 @@ _update_rle(Eo *obj, Ector_Renderer_Software_Shape_Data *pd)
if ( _generate_stroke_data(pd))
{
ector_software_rasterizer_stroke_set(pd->surface->software,
(pd->shape->stroke.width *
pd->shape->stroke.scale),
pd->shape->stroke.cap,
pd->shape->stroke.join);
(pd->public_shape->stroke.width *
pd->public_shape->stroke.scale),
pd->public_shape->stroke.cap,
pd->public_shape->stroke.join);
if (pd->shape->stroke.dash)
if (pd->public_shape->stroke.dash)
{
dash_outline = _outline_create();
close_path = _generate_dashed_outline(cmds, pts, dash_outline,
pd->shape->stroke.dash,
pd->shape->stroke.dash_length);
pd->public_shape->stroke.dash,
pd->public_shape->stroke.dash_length);
_outline_transform(dash_outline, pd->base->m);
pd->outline_data = ector_software_rasterizer_generate_stroke_rle_data(pd->surface->software,
&dash_outline->ft_outline,
@ -633,13 +635,13 @@ _ector_renderer_software_shape_ector_renderer_generic_base_draw(Eo *obj,
}
else
{
if (pd->shape->stroke.color.a > 0)
if (pd->public_shape->stroke.color.a > 0)
{
ector_software_rasterizer_color_set(pd->surface->software,
pd->shape->stroke.color.r,
pd->shape->stroke.color.g,
pd->shape->stroke.color.b,
pd->shape->stroke.color.a);
pd->public_shape->stroke.color.r,
pd->public_shape->stroke.color.g,
pd->public_shape->stroke.color.b,
pd->public_shape->stroke.color.a);
ector_software_rasterizer_draw_rle_data(pd->surface->software,
x, y, mul_col, op,
pd->outline_data);
@ -695,6 +697,7 @@ _ector_renderer_software_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Softw
eo_do_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS, obj = eo_constructor());
if (!obj) return NULL;
pd->public_shape = eo_data_xref(obj, EFL_GFX_SHAPE_MIXIN, obj);
pd->shape = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_SHAPE_MIXIN, obj);
pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
eo_do(obj,
@ -728,18 +731,33 @@ _ector_renderer_software_shape_ector_renderer_generic_base_crc_get(Eo *obj,
eo_do_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS, crc = ector_renderer_crc_get());
crc = eina_crc((void*) &pd->shape->stroke.marker, sizeof (pd->shape->stroke.marker), crc, EINA_FALSE);
crc = eina_crc((void*) &pd->shape->stroke.scale, sizeof (pd->shape->stroke.scale) * 3, crc, EINA_FALSE); // scale, width, centered
crc = eina_crc((void*) &pd->shape->stroke.color, sizeof (pd->shape->stroke.color), crc, EINA_FALSE);
crc = eina_crc((void*) &pd->shape->stroke.cap, sizeof (pd->shape->stroke.cap), crc, EINA_FALSE);
crc = eina_crc((void*) &pd->shape->stroke.join, sizeof (pd->shape->stroke.join), crc, EINA_FALSE);
crc = eina_crc((void*) &pd->shape->stroke.marker,
sizeof (pd->shape->stroke.marker),
crc, EINA_FALSE);
crc = eina_crc((void*) &pd->public_shape->stroke.scale,
sizeof (pd->public_shape->stroke.scale) * 3,
crc, EINA_FALSE); // scale, width, centered
crc = eina_crc((void*) &pd->public_shape->stroke.color,
sizeof (pd->public_shape->stroke.color),
crc, EINA_FALSE);
crc = eina_crc((void*) &pd->public_shape->stroke.cap,
sizeof (pd->public_shape->stroke.cap),
crc, EINA_FALSE);
crc = eina_crc((void*) &pd->public_shape->stroke.join,
sizeof (pd->public_shape->stroke.join),
crc, EINA_FALSE);
if (pd->shape->fill) crc = _renderer_crc_get(pd->shape->fill, crc);
if (pd->shape->stroke.fill) crc = _renderer_crc_get(pd->shape->stroke.fill, crc);
if (pd->shape->stroke.marker) crc = _renderer_crc_get(pd->shape->stroke.marker, crc);
if (pd->shape->stroke.dash_length)
if (pd->shape->fill)
crc = _renderer_crc_get(pd->shape->fill, crc);
if (pd->shape->stroke.fill)
crc = _renderer_crc_get(pd->shape->stroke.fill, crc);
if (pd->shape->stroke.marker)
crc = _renderer_crc_get(pd->shape->stroke.marker, crc);
if (pd->public_shape->stroke.dash_length)
{
crc = eina_crc((void*) pd->shape->stroke.dash, sizeof (Efl_Gfx_Dash) * pd->shape->stroke.dash_length, crc, EINA_FALSE);
crc = eina_crc((void*) pd->public_shape->stroke.dash,
sizeof (Efl_Gfx_Dash) * pd->public_shape->stroke.dash_length,
crc, EINA_FALSE);
}
return crc;

View File

@ -124,10 +124,39 @@ typedef enum _Efl_Gfx_Gradient_Spread
} Efl_Gfx_Gradient_Spread;
/**
* Type defining stroke information.
* @note Describe the properties to define the path stroke.
* @since 1.14
*/
typedef struct _Efl_Gfx_Stroke Efl_Gfx_Stroke;
struct _Efl_Gfx_Stroke
{
double scale;
double width;
double centered;
struct {
int r, g, b, a;
} color;
Efl_Gfx_Dash *dash;
unsigned int dash_length;
Efl_Gfx_Cap cap;
Efl_Gfx_Join join;
};
typedef struct _Efl_Gfx_Shape_Public Efl_Gfx_Shape_Public;
struct _Efl_Gfx_Shape_Public
{
Efl_Gfx_Stroke stroke;
};
#ifdef EFL_BETA_API_SUPPORT
#include <Efl_Model_Common.h>
/* Interfaces */
#include "interfaces/efl_control.eo.h"
#include "interfaces/efl_file.eo.h"

View File

@ -11,6 +11,8 @@
typedef struct _Efl_Gfx_Shape_Data Efl_Gfx_Shape_Data;
struct _Efl_Gfx_Shape_Data
{
Efl_Gfx_Shape_Public public;
struct {
double x;
double y;
@ -1366,4 +1368,133 @@ _efl_gfx_shape_append_svg_path(Eo *obj, Efl_Gfx_Shape_Data *pd,
}
}
static void
_efl_gfx_shape_stroke_scale_set(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd,
double s)
{
pd->public.stroke.scale = s;
}
static double
_efl_gfx_shape_stroke_scale_get(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd)
{
return pd->public.stroke.scale;
}
static void
_efl_gfx_shape_stroke_color_set(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd,
int r, int g, int b, int a)
{
pd->public.stroke.color.r = r;
pd->public.stroke.color.g = g;
pd->public.stroke.color.b = b;
pd->public.stroke.color.a = a;
}
static void
_efl_gfx_shape_stroke_color_get(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd,
int *r, int *g, int *b, int *a)
{
if (r) *r = pd->public.stroke.color.r;
if (g) *g = pd->public.stroke.color.g;
if (b) *b = pd->public.stroke.color.b;
if (a) *a = pd->public.stroke.color.a;
}
static void
_efl_gfx_shape_stroke_width_set(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd,
double w)
{
pd->public.stroke.width = w;
}
static double
_efl_gfx_shape_stroke_width_get(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd)
{
return pd->public.stroke.width;
}
static void
_efl_gfx_shape_stroke_location_set(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd,
double centered)
{
pd->public.stroke.centered = centered;
}
static double
_efl_gfx_shape_stroke_location_get(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd)
{
return pd->public.stroke.centered;
}
static void
_efl_gfx_shape_stroke_dash_set(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd,
const Efl_Gfx_Dash *dash, unsigned int length)
{
Efl_Gfx_Dash *tmp;
if (!dash)
{
free(pd->public.stroke.dash);
pd->public.stroke.dash = NULL;
pd->public.stroke.dash_length = 0;
return ;
}
tmp = realloc(pd->public.stroke.dash, length * sizeof (Efl_Gfx_Dash));
if (!tmp && length) return ;
memcpy(tmp, dash, length * sizeof (Efl_Gfx_Dash));
pd->public.stroke.dash = tmp;
pd->public.stroke.dash_length = length;
}
static void
_efl_gfx_shape_stroke_dash_get(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd,
const Efl_Gfx_Dash **dash, unsigned int *length)
{
if (dash) *dash = pd->public.stroke.dash;
if (length) *length = pd->public.stroke.dash_length;
}
static void
_efl_gfx_shape_stroke_cap_set(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd,
Efl_Gfx_Cap c)
{
pd->public.stroke.cap = c;
}
static Efl_Gfx_Cap
_efl_gfx_shape_stroke_cap_get(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd)
{
return pd->public.stroke.cap;
}
static void
_efl_gfx_shape_stroke_join_set(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd,
Efl_Gfx_Join j)
{
pd->public.stroke.join = j;
}
static Efl_Gfx_Join
_efl_gfx_shape_stroke_join_get(Eo *obj EINA_UNUSED,
Efl_Gfx_Shape_Data *pd)
{
return pd->public.stroke.join;
}
#include "interfaces/efl_gfx_shape.eo.c"

View File

@ -375,20 +375,4 @@ mixin Efl.Gfx.Shape
}
}
}
implements {
@virtual .stroke_scale.get;
@virtual .stroke_scale.set;
@virtual .stroke_color.get;
@virtual .stroke_color.set;
@virtual .stroke_width.get;
@virtual .stroke_width.set;
@virtual .stroke_location.get;
@virtual .stroke_location.set;
@virtual .stroke_dash.get;
@virtual .stroke_dash.set;
@virtual .stroke_cap.get;
@virtual .stroke_cap.set;
@virtual .stroke_join.get;
@virtual .stroke_join.set;
}
}

View File

@ -31,13 +31,6 @@ class Efl.VG.Shape (Efl.VG.Base, Efl.Gfx.Shape)
}
}
implements {
Efl.Gfx.Shape.stroke_scale;
Efl.Gfx.Shape.stroke_color;
Efl.Gfx.Shape.stroke_width;
Efl.Gfx.Shape.stroke_location;
Efl.Gfx.Shape.stroke_dash;
Efl.Gfx.Shape.stroke_cap;
Efl.Gfx.Shape.stroke_join;
Efl.Gfx.Base.color_part.set;
Efl.Gfx.Base.color_part.get;
Efl.VG.Base.bounds_get;

View File

@ -11,20 +11,8 @@ struct _Efl_VG_Shape_Data
Efl_VG *fill;
struct {
Efl_Gfx_Dash *dash;
Efl_VG *fill;
Efl_VG *marker;
double scale;
double width;
double centered; // from 0 to 1
int r, g, b, a;
unsigned int dash_count;
Efl_Gfx_Cap cap;
Efl_Gfx_Join join;
} stroke;
};
@ -56,38 +44,8 @@ _efl_vg_shape_fill_get(Eo *obj EINA_UNUSED, Efl_VG_Shape_Data *pd)
return pd->fill;
}
static void
_efl_vg_shape_efl_gfx_shape_stroke_scale_set(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd,
double s)
{
pd->stroke.scale = s;
_efl_vg_base_changed(obj);
}
static double
_efl_vg_shape_efl_gfx_shape_stroke_scale_get(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd)
{
return pd->stroke.scale;
}
static void
_efl_vg_shape_efl_gfx_shape_stroke_color_set(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd,
int r, int g, int b, int a)
{
pd->stroke.r = r;
pd->stroke.g = g;
pd->stroke.b = b;
pd->stroke.a = a;
_efl_vg_base_changed(obj);
}
static Eina_Bool
_efl_vg_shape_efl_gfx_base_color_part_set(Eo *obj, Efl_VG_Shape_Data *pd,
_efl_vg_shape_efl_gfx_base_color_part_set(Eo *obj, Efl_VG_Shape_Data *pd EINA_UNUSED,
const char * part,
int r, int g, int b, int a)
{
@ -95,7 +53,7 @@ _efl_vg_shape_efl_gfx_base_color_part_set(Eo *obj, Efl_VG_Shape_Data *pd,
if (part && !strcmp(part, "stroke"))
{
_efl_vg_shape_efl_gfx_shape_stroke_color_set(obj, pd, r, g, b, a);
eo_do(obj, efl_gfx_shape_stroke_color_set(r, g, b, a));
return EINA_TRUE;
}
@ -105,19 +63,8 @@ _efl_vg_shape_efl_gfx_base_color_part_set(Eo *obj, Efl_VG_Shape_Data *pd,
return ret;
}
static void
_efl_vg_shape_efl_gfx_shape_stroke_color_get(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd,
int *r, int *g, int *b, int *a)
{
if (r) *r = pd->stroke.r;
if (g) *g = pd->stroke.g;
if (b) *b = pd->stroke.b;
if (a) *a = pd->stroke.a;
}
static Eina_Bool
_efl_vg_shape_efl_gfx_base_color_part_get(Eo *obj, Efl_VG_Shape_Data *pd,
_efl_vg_shape_efl_gfx_base_color_part_get(Eo *obj, Efl_VG_Shape_Data *pd EINA_UNUSED,
const char * part,
int *r, int *g, int *b, int *a)
{
@ -125,7 +72,7 @@ _efl_vg_shape_efl_gfx_base_color_part_get(Eo *obj, Efl_VG_Shape_Data *pd,
if (part && !strcmp(part, "stroke"))
{
_efl_vg_shape_efl_gfx_shape_stroke_color_get(obj, pd, r, g, b, a);
eo_do(obj, efl_gfx_shape_stroke_color_get(r, g, b, a));
return EINA_TRUE;
}
@ -155,72 +102,6 @@ _efl_vg_shape_stroke_fill_get(Eo *obj EINA_UNUSED,
return pd->stroke.fill;
}
static void
_efl_vg_shape_efl_gfx_shape_stroke_width_set(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd,
double w)
{
pd->stroke.width = w;
_efl_vg_base_changed(obj);
}
static double
_efl_vg_shape_efl_gfx_shape_stroke_width_get(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd)
{
return pd->stroke.width;
}
static void
_efl_vg_shape_efl_gfx_shape_stroke_location_set(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd,
double centered)
{
pd->stroke.centered = centered;
_efl_vg_base_changed(obj);
}
static double
_efl_vg_shape_efl_gfx_shape_stroke_location_get(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd)
{
return pd->stroke.centered;
}
static void
_efl_vg_shape_efl_gfx_shape_stroke_dash_set(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd,
const Efl_Gfx_Dash *dash,
unsigned int length)
{
free(pd->stroke.dash);
pd->stroke.dash = NULL;
pd->stroke.dash_count = 0;
// check for null or empty dash
if (!dash || !length) return;
pd->stroke.dash = malloc(sizeof (Efl_Gfx_Dash) * length);
if (!pd->stroke.dash) return ;
memcpy(pd->stroke.dash, dash, sizeof (Efl_Gfx_Dash) * length);
pd->stroke.dash_count = length;
_efl_vg_base_changed(obj);
}
static void
_efl_vg_shape_efl_gfx_shape_stroke_dash_get(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd,
const Efl_Gfx_Dash **dash,
unsigned int *length)
{
if (dash) *dash = pd->stroke.dash;
if (length) *length = pd->stroke.dash_count;
}
static void
_efl_vg_shape_stroke_marker_set(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd,
@ -241,40 +122,6 @@ _efl_vg_shape_stroke_marker_get(Eo *obj EINA_UNUSED,
return pd->stroke.marker;
}
static void
_efl_vg_shape_efl_gfx_shape_stroke_cap_set(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd,
Efl_Gfx_Cap c)
{
pd->stroke.cap = c;
_efl_vg_base_changed(obj);
}
static Efl_Gfx_Cap
_efl_vg_shape_efl_gfx_shape_stroke_cap_get(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd)
{
return pd->stroke.cap;
}
static void
_efl_vg_shape_efl_gfx_shape_stroke_join_set(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd,
Efl_Gfx_Join j)
{
pd->stroke.join = j;
_efl_vg_base_changed(obj);
}
static Efl_Gfx_Join
_efl_vg_shape_efl_gfx_shape_stroke_join_get(Eo *obj EINA_UNUSED,
Efl_VG_Shape_Data *pd)
{
return pd->stroke.join;
}
static void
_efl_vg_shape_render_pre(Eo *obj EINA_UNUSED,
Eina_Matrix3 *parent,
@ -323,10 +170,11 @@ _efl_vg_shape_eo_base_constructor(Eo *obj, Efl_VG_Shape_Data *pd)
obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
pd->stroke.cap = EFL_GFX_CAP_BUTT;
pd->stroke.join = EFL_GFX_JOIN_MITER;
pd->stroke.scale = 1;
pd->stroke.centered = 0.5;
eo_do(obj,
efl_gfx_shape_stroke_scale_set(1),
efl_gfx_shape_stroke_location_set(0.5),
efl_gfx_shape_stroke_cap_set(EFL_GFX_CAP_BUTT),
efl_gfx_shape_stroke_join_set(EFL_GFX_JOIN_MITER));
nd = eo_data_scope_get(obj, EFL_VG_BASE_CLASS);
nd->render_pre = _efl_vg_shape_render_pre;