forked from enlightenment/efl
efl: add path operation to Efl.Gfx.Shape.
This commit is contained in:
parent
1fb52dbe71
commit
ac8d923090
|
@ -28,7 +28,6 @@ CLEANFILES += \
|
|||
EXTRA_DIST += \
|
||||
lib/efl/Efl_Config.h \
|
||||
lib/efl/Efl.h \
|
||||
lib/efl/interfaces/efl_gfx_utils.h \
|
||||
$(efl_eolian_files)
|
||||
|
||||
efleolianfilesdir = $(datadir)/eolian/include/efl-@VMAJ@
|
||||
|
@ -38,7 +37,7 @@ lib_LTLIBRARIES += lib/efl/libefl.la
|
|||
|
||||
lib_efl_libefl_la_SOURCES = \
|
||||
lib/efl/interfaces/efl_interfaces_main.c \
|
||||
lib/efl/interfaces/efl_gfx_utils.c
|
||||
lib/efl/interfaces/efl_gfx_shape.c
|
||||
|
||||
lib_efl_libefl_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl -I$(top_srcdir)/src/lib/efl @EFL_CFLAGS@
|
||||
lib_efl_libefl_la_LIBADD = @EFL_LIBS@
|
||||
|
@ -52,8 +51,7 @@ dist_installed_eflheaders_DATA = \
|
|||
|
||||
installed_eflinterfacesdir = $(includedir)/efl-@VMAJ@/interfaces
|
||||
nodist_installed_eflinterfaces_DATA = \
|
||||
$(efl_eolian_files_h) \
|
||||
lib/efl/interfaces/efl_gfx_utils.h
|
||||
$(efl_eolian_files_h)
|
||||
|
||||
if HAVE_ELUA
|
||||
|
||||
|
|
|
@ -48,6 +48,9 @@ struct _Ector_Renderer_Cairo_Shape_Data
|
|||
static Eina_Bool
|
||||
_ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd)
|
||||
{
|
||||
const Efl_Gfx_Path_Command *cmds = NULL;
|
||||
const double *pts = NULL;
|
||||
|
||||
// FIXME: shouldn't that be part of the shape generic implementation ?
|
||||
if (pd->shape->fill)
|
||||
eo_do(pd->shape->fill, ector_renderer_prepare());
|
||||
|
@ -68,19 +71,16 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R
|
|||
if (!pd->parent) return EINA_FALSE;
|
||||
}
|
||||
|
||||
if (!pd->path && pd->shape->path.cmd)
|
||||
eo_do(obj, efl_gfx_shape_path_get(&cmds, &pts));
|
||||
if (!pd->path && cmds)
|
||||
{
|
||||
double *pts;
|
||||
unsigned int i;
|
||||
|
||||
USE(obj, cairo_new_path, EINA_FALSE);
|
||||
|
||||
cairo_new_path(pd->parent->cairo);
|
||||
|
||||
pts = pd->shape->path.pts;
|
||||
for (i = 0; pd->shape->path.cmd[i] != EFL_GFX_PATH_COMMAND_TYPE_END; i++)
|
||||
for (; *cmds != EFL_GFX_PATH_COMMAND_TYPE_END; cmds++)
|
||||
{
|
||||
switch (pd->shape->path.cmd[i])
|
||||
switch (*cmds)
|
||||
{
|
||||
case EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO:
|
||||
USE(obj, cairo_move_to, EINA_FALSE);
|
||||
|
|
|
@ -95,11 +95,6 @@ struct _Ector_Renderer_Generic_Gradient_Radial_Data
|
|||
|
||||
struct _Ector_Renderer_Generic_Shape_Data
|
||||
{
|
||||
struct {
|
||||
Efl_Gfx_Path_Command *cmd;
|
||||
double *pts;
|
||||
} path;
|
||||
|
||||
Ector_Renderer *fill;
|
||||
struct {
|
||||
Ector_Renderer *fill;
|
||||
|
|
|
@ -39,7 +39,6 @@ class Ector.Renderer.Generic.Shape (Ector.Renderer.Generic.Base, Efl.Gfx.Shape)
|
|||
Efl.Gfx.Shape.stroke_dash;
|
||||
Efl.Gfx.Shape.stroke_cap;
|
||||
Efl.Gfx.Shape.stroke_join;
|
||||
Efl.Gfx.Shape.path;
|
||||
Eo.Base.constructor;
|
||||
Eo.Base.destructor;
|
||||
}
|
||||
|
|
|
@ -183,29 +183,6 @@ _ector_renderer_generic_shape_efl_gfx_shape_stroke_join_get(Eo *obj EINA_UNUSED,
|
|||
return pd->stroke.join;
|
||||
}
|
||||
|
||||
static void
|
||||
_ector_renderer_generic_shape_efl_gfx_shape_path_set(Eo *obj EINA_UNUSED,
|
||||
Ector_Renderer_Generic_Shape_Data *pd,
|
||||
const Efl_Gfx_Path_Command *cmd,
|
||||
const double *points)
|
||||
{
|
||||
free(pd->path.cmd);
|
||||
pd->path.cmd = NULL;
|
||||
free(pd->path.pts);
|
||||
pd->path.pts = NULL;
|
||||
|
||||
efl_gfx_path_dup(&pd->path.cmd, &pd->path.pts, cmd, points);
|
||||
}
|
||||
|
||||
void
|
||||
_ector_renderer_generic_shape_efl_gfx_shape_path_get(Eo *obj EINA_UNUSED,
|
||||
Ector_Renderer_Generic_Shape_Data *pd,
|
||||
const Efl_Gfx_Path_Command **op,
|
||||
const double **points)
|
||||
{
|
||||
if (op) *op = pd->path.cmd;
|
||||
if (points) *points = pd->path.pts;
|
||||
}
|
||||
|
||||
static void
|
||||
_ector_renderer_generic_shape_eo_base_constructor(Eo *obj,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
interface Efl.Gfx.Shape
|
||||
class Efl.Gfx.Shape
|
||||
{
|
||||
legacy_prefix: null;
|
||||
properties {
|
||||
|
@ -75,9 +75,141 @@ interface Efl.Gfx.Shape
|
|||
get {
|
||||
}
|
||||
values {
|
||||
const(Efl_Gfx_Path_Command) *op;
|
||||
const(Efl_Gfx_Path_Command) *commands;
|
||||
const(double) *points;
|
||||
}
|
||||
}
|
||||
path_length {
|
||||
get {
|
||||
}
|
||||
values {
|
||||
uint commands;
|
||||
uint points;
|
||||
}
|
||||
}
|
||||
current {
|
||||
get {
|
||||
}
|
||||
values {
|
||||
double x;
|
||||
double y;
|
||||
}
|
||||
}
|
||||
current_ctrl {
|
||||
get {
|
||||
}
|
||||
values {
|
||||
double x;
|
||||
double y;
|
||||
}
|
||||
}
|
||||
}
|
||||
methods {
|
||||
dup {
|
||||
params {
|
||||
@in Eo *dup_from;
|
||||
}
|
||||
}
|
||||
reset {
|
||||
}
|
||||
append_move_to {
|
||||
params {
|
||||
@in double x;
|
||||
@in double y;
|
||||
}
|
||||
}
|
||||
append_line_to {
|
||||
params {
|
||||
@in double x;
|
||||
@in double y;
|
||||
}
|
||||
}
|
||||
append_quadratic_to {
|
||||
params {
|
||||
@in double x;
|
||||
@in double y;
|
||||
@in double ctrl_x;
|
||||
@in double ctrl_y;
|
||||
}
|
||||
}
|
||||
append_squadratic_to {
|
||||
params {
|
||||
@in double x;
|
||||
@in double y;
|
||||
}
|
||||
}
|
||||
append_cubic_to {
|
||||
params {
|
||||
@in double x;
|
||||
@in double y;
|
||||
@in double ctrl_x0;
|
||||
@in double ctrl_y0;
|
||||
@in double ctrl_x1;
|
||||
@in double ctrl_y1;
|
||||
}
|
||||
}
|
||||
append_scubic_to {
|
||||
params {
|
||||
@in double x;
|
||||
@in double y;
|
||||
@in double ctrl_x;
|
||||
@in double ctrl_y;
|
||||
}
|
||||
}
|
||||
append_arc_to {
|
||||
params {
|
||||
@in double x;
|
||||
@in double y;
|
||||
@in double rx;
|
||||
@in double ry;
|
||||
@in double angle;
|
||||
@in bool large_arc;
|
||||
@in bool sweep;
|
||||
}
|
||||
}
|
||||
append_close {
|
||||
}
|
||||
append_circle {
|
||||
params {
|
||||
@in double x;
|
||||
@in double y;
|
||||
@in double radius;
|
||||
}
|
||||
}
|
||||
append_svg_path {
|
||||
params {
|
||||
@in const(char)* svg_path_data;
|
||||
}
|
||||
}
|
||||
interpolate {
|
||||
return: bool;
|
||||
params {
|
||||
@in const(Eo)* from;
|
||||
@in const(Eo)* to;
|
||||
@in double pos_map;
|
||||
}
|
||||
}
|
||||
equal_commands {
|
||||
return: bool;
|
||||
params {
|
||||
@in const(Eo)* with;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
#ifndef EFL_GRAPHICS_UTILS_H_
|
||||
# define EFL_GRAPHICS_UTILS_H_
|
||||
|
||||
EAPI Eina_Bool
|
||||
efl_gfx_path_dup(Efl_Gfx_Path_Command **out_cmd, double **out_pts,
|
||||
const Efl_Gfx_Path_Command *in_cmd, const double *in_pts);
|
||||
|
||||
EAPI void
|
||||
efl_gfx_path_append_move_to(Efl_Gfx_Path_Command **commands, double **points,
|
||||
double x, double y);
|
||||
|
||||
EAPI void
|
||||
efl_gfx_path_append_line_to(Efl_Gfx_Path_Command **commands, double **points,
|
||||
double x, double y);
|
||||
|
||||
EAPI void
|
||||
efl_gfx_path_append_quadratic_to(Efl_Gfx_Path_Command **commands, double **points,
|
||||
double x, double y, double ctrl_x, double ctrl_y);
|
||||
|
||||
EAPI void
|
||||
efl_gfx_path_append_squadratic_to(Efl_Gfx_Path_Command **commands, double **points,
|
||||
double x, double y);
|
||||
|
||||
EAPI void
|
||||
efl_gfx_path_append_cubic_to(Efl_Gfx_Path_Command **commands, double **points,
|
||||
double x, double y,
|
||||
double ctrl_x0, double ctrl_y0,
|
||||
double ctrl_x1, double ctrl_y1);
|
||||
|
||||
EAPI void
|
||||
efl_gfx_path_append_scubic_to(Efl_Gfx_Path_Command **commands, double **points,
|
||||
double x, double y,
|
||||
double ctrl_x, double ctrl_y);
|
||||
|
||||
EAPI void
|
||||
efl_gfx_path_append_arc_to(Efl_Gfx_Path_Command **commands, double **points,
|
||||
double x, double y,
|
||||
double rx, double ry,
|
||||
double angle,
|
||||
Eina_Bool large_arc, Eina_Bool sweep);
|
||||
|
||||
EAPI void
|
||||
efl_gfx_path_append_close(Efl_Gfx_Path_Command **commands, double **points);
|
||||
|
||||
EAPI void
|
||||
efl_gfx_path_append_circle(Efl_Gfx_Path_Command **commands, double **points,
|
||||
double x, double y, double radius);
|
||||
|
||||
EAPI Eina_Bool
|
||||
efl_gfx_path_append_svg_path(Efl_Gfx_Path_Command **commands, double **points, const char *svg_path_data);
|
||||
|
||||
EAPI void
|
||||
efl_gfx_path_interpolate(const Efl_Gfx_Path_Command *cmd,
|
||||
double pos_map,
|
||||
const double *from, const double *to, double *r);
|
||||
|
||||
EAPI Eina_Bool
|
||||
efl_gfx_path_equal_commands(const Efl_Gfx_Path_Command *a,
|
||||
const Efl_Gfx_Path_Command *b);
|
||||
|
||||
EAPI Eina_Bool
|
||||
efl_gfx_path_current_get(const Efl_Gfx_Path_Command *cmd,
|
||||
const double *points,
|
||||
double *current_x, double *current_y,
|
||||
double *current_ctrl_x, double *current_ctrl_y);
|
||||
|
||||
#endif
|
|
@ -16,7 +16,6 @@
|
|||
#include "interfaces/efl_gfx_fill.eo.c"
|
||||
#include "interfaces/efl_gfx_view.eo.c"
|
||||
|
||||
#include "interfaces/efl_gfx_shape.eo.c"
|
||||
#include "interfaces/efl_gfx_gradient.eo.c"
|
||||
#include "interfaces/efl_gfx_gradient_linear.eo.c"
|
||||
#include "interfaces/efl_gfx_gradient_radial.eo.c"
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
typedef struct _Evas_VG_Shape_Data Evas_VG_Shape_Data;
|
||||
struct _Evas_VG_Shape_Data
|
||||
{
|
||||
Efl_Gfx_Path_Command *ops;
|
||||
double *points;
|
||||
|
||||
Evas_VG_Node *fill;
|
||||
|
||||
struct {
|
||||
|
@ -31,30 +28,6 @@ struct _Evas_VG_Shape_Data
|
|||
} stroke;
|
||||
};
|
||||
|
||||
static void
|
||||
_evas_vg_shape_efl_gfx_shape_path_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
const Efl_Gfx_Path_Command *ops,
|
||||
const double *points)
|
||||
{
|
||||
free(pd->points);
|
||||
pd->points = NULL;
|
||||
free(pd->ops);
|
||||
pd->ops = NULL;
|
||||
|
||||
efl_gfx_path_dup(&pd->ops, &pd->points, ops, points);
|
||||
}
|
||||
|
||||
static void
|
||||
_evas_vg_shape_efl_gfx_shape_path_get(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
const Efl_Gfx_Path_Command **op,
|
||||
const double **points)
|
||||
{
|
||||
if (op) *op = pd->ops;
|
||||
if (points) *points = pd->points;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_evas_vg_shape_evas_vg_node_bound_get(Eo *obj,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
|
@ -270,17 +243,7 @@ _evas_vg_shape_render_pre(Eo *obj EINA_UNUSED,
|
|||
ector_renderer_shape_fill_set(fill ? fill->renderer : NULL),
|
||||
ector_renderer_shape_stroke_fill_set(stroke_fill ? stroke_fill->renderer : NULL),
|
||||
ector_renderer_shape_stroke_marker_set(stroke_marker ? stroke_marker->renderer : NULL),
|
||||
efl_gfx_shape_stroke_scale_set(pd->stroke.scale),
|
||||
efl_gfx_shape_stroke_color_set(pd->stroke.r,
|
||||
pd->stroke.g,
|
||||
pd->stroke.b,
|
||||
pd->stroke.a),
|
||||
efl_gfx_shape_stroke_width_set(pd->stroke.width),
|
||||
efl_gfx_shape_stroke_location_set(pd->stroke.centered),
|
||||
efl_gfx_shape_stroke_dash_set(pd->stroke.dash, pd->stroke.dash_count),
|
||||
efl_gfx_shape_stroke_cap_set(pd->stroke.cap),
|
||||
efl_gfx_shape_stroke_join_set(pd->stroke.join),
|
||||
efl_gfx_shape_path_set(pd->ops, pd->points),
|
||||
efl_gfx_shape_dup(obj),
|
||||
ector_renderer_prepare());
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ class Evas.VG_Shape (Evas.VG_Node, Efl.Gfx.Shape)
|
|||
Efl.Gfx.Shape.stroke_dash;
|
||||
Efl.Gfx.Shape.stroke_cap;
|
||||
Efl.Gfx.Shape.stroke_join;
|
||||
Efl.Gfx.Shape.path;
|
||||
Evas.VG_Node.bound_get;
|
||||
Eo.Base.constructor;
|
||||
Eo.Base.destructor;
|
||||
|
|
Loading…
Reference in New Issue