forked from enlightenment/efl
efl: use Efl_Geometry_Shape.
This commit is contained in:
parent
14dcad09c0
commit
411bb5b64e
|
@ -845,42 +845,11 @@ typedef enum _Evas_3D_Material_Attrib
|
|||
|
||||
#include "canvas/evas_3d_object.eo.h"
|
||||
|
||||
/**
|
||||
* Path command enum.
|
||||
*
|
||||
* @since 1.14
|
||||
* @ingroup Evas_VG_Shape
|
||||
*/
|
||||
typedef enum _Evas_VG_Path_Command
|
||||
{
|
||||
EVAS_VG_PATH_COMMAND_TYPE_END = 0, /**< End of the stream of command */
|
||||
EVAS_VG_PATH_COMMAND_TYPE_MOVE_TO, /**< A move command type */
|
||||
EVAS_VG_PATH_COMMAND_TYPE_LINE_TO, /**< A line command type */
|
||||
EVAS_VG_PATH_COMMAND_TYPE_QUADRATIC_TO, /**< A quadratic command type */
|
||||
EVAS_VG_PATH_COMMAND_TYPE_SQUADRATIC_TO, /**< A smooth quadratic command type */
|
||||
EVAS_VG_PATH_COMMAND_TYPE_CUBIC_TO, /**< A cubic command type */
|
||||
EVAS_VG_PATH_COMMAND_TYPE_SCUBIC_TO, /**< A smooth cubic command type */
|
||||
EVAS_VG_PATH_COMMAND_TYPE_ARC_TO, /**< An arc command type */
|
||||
EVAS_VG_PATH_COMMAND_TYPE_CLOSE, /**< A close command type */
|
||||
EVAS_VG_PATH_COMMAND_TYPE_LAST, /**< Not a valid command, but last one according to this version header */
|
||||
} Evas_VG_Path_Command;
|
||||
|
||||
/**
|
||||
* Type of abstract VG node
|
||||
*/
|
||||
typedef Eo Evas_VG_Node;
|
||||
|
||||
|
||||
/**
|
||||
* Type describing dash
|
||||
*/
|
||||
typedef struct _Evas_VG_Dash Evas_VG_Dash;
|
||||
struct _Evas_VG_Dash
|
||||
{
|
||||
double length;
|
||||
double gap;
|
||||
};
|
||||
|
||||
typedef struct _Evas_VG_Gradient_Stop Evas_VG_Gradient_Stop;
|
||||
struct _Evas_VG_Gradient_Stop
|
||||
{
|
||||
|
@ -891,22 +860,6 @@ struct _Evas_VG_Gradient_Stop
|
|||
int a;
|
||||
};
|
||||
|
||||
typedef enum _Evas_VG_Cap
|
||||
{
|
||||
EVAS_VG_CAP_BUTT,
|
||||
EVAS_VG_CAP_ROUND,
|
||||
EVAS_VG_CAP_SQUARE,
|
||||
EVAS_VG_CAP_LAST
|
||||
} Evas_VG_Cap;
|
||||
|
||||
typedef enum _Evas_VG_Join
|
||||
{
|
||||
EVAS_VG_JOIN_MITER,
|
||||
EVAS_VG_JOIN_ROUND,
|
||||
EVAS_VG_JOIN_BEVEL,
|
||||
EVAS_VG_JOIN_LAST
|
||||
} Evas_VG_Join;
|
||||
|
||||
typedef enum _Evas_VG_Gradient_Spread
|
||||
{
|
||||
EVAS_VG_GRADIENT_SPREAD_PAD,
|
||||
|
|
|
@ -327,4 +327,9 @@ _evas_vg_efl_file_file_get(Eo *obj, Evas_VG_Data *pd,
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
_evas_vg_size_get(Eo *obj, Evas_VG_Data *pd, unsigned int *w, unsigned int *h)
|
||||
{
|
||||
}
|
||||
|
||||
#include "evas_vg.eo.c"
|
||||
|
|
|
@ -264,4 +264,12 @@ _evas_vg_node_lower(Eo *obj, Evas_VG_Node_Data *pd EINA_UNUSED)
|
|||
eo_error_set(obj);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
_evas_vg_node_original_bound_get(Eo *obj,
|
||||
Evas_VG_Node_Data *pd,
|
||||
Eina_Rectangle *r)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
#include "evas_vg_node.eo.c"
|
||||
|
|
|
@ -22,7 +22,7 @@ struct _Evas_VG_Container_Data
|
|||
};
|
||||
|
||||
Eina_Bool
|
||||
evas_vg_path_dup(Evas_VG_Path_Command **out_cmd, double **out_pts,
|
||||
const Evas_VG_Path_Command *in_cmd, const double *in_pts);
|
||||
efl_geometry_path_dup(Efl_Geometry_Path_Command **out_cmd, double **out_pts,
|
||||
const Efl_Geometry_Path_Command *in_cmd, const double *in_pts);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
typedef struct _Evas_VG_Shape_Data Evas_VG_Shape_Data;
|
||||
struct _Evas_VG_Shape_Data
|
||||
{
|
||||
Evas_VG_Path_Command *op;
|
||||
Efl_Geometry_Path_Command *op;
|
||||
double *points;
|
||||
|
||||
Evas_VG_Node *fill;
|
||||
|
||||
struct {
|
||||
Evas_VG_Dash *dash;
|
||||
Efl_Geometry_Dash *dash;
|
||||
Evas_VG_Node *fill;
|
||||
Evas_VG_Node *marker;
|
||||
|
||||
|
@ -26,8 +26,8 @@ struct _Evas_VG_Shape_Data
|
|||
|
||||
unsigned int dash_count;
|
||||
|
||||
Evas_VG_Cap cap;
|
||||
Evas_VG_Join join;
|
||||
Efl_Geometry_Cap cap;
|
||||
Efl_Geometry_Join join;
|
||||
} stroke;
|
||||
|
||||
unsigned int op_count;
|
||||
|
@ -35,15 +35,17 @@ struct _Evas_VG_Shape_Data
|
|||
};
|
||||
|
||||
Eina_Bool
|
||||
_evas_vg_shape_path_set(Eo *obj EINA_UNUSED, Evas_VG_Shape_Data *pd,
|
||||
const Evas_VG_Path_Command *op, const double *points)
|
||||
_evas_vg_shape_efl_geometry_shape_path_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
const Efl_Geometry_Path_Command *op,
|
||||
const double *points)
|
||||
{
|
||||
free(pd->points);
|
||||
pd->points = NULL;
|
||||
free(pd->op);
|
||||
pd->op = NULL;
|
||||
|
||||
return evas_vg_path_dup(&pd->op, &pd->points, op, points);
|
||||
return efl_geometry_path_dup(&pd->op, &pd->points, op, points);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
|
@ -57,8 +59,8 @@ void
|
|||
_evas_vg_shape_eo_base_constructor(Eo *obj, Evas_VG_Shape_Data *pd EINA_UNUSED)
|
||||
{
|
||||
eo_do_super(obj, MY_CLASS, eo_constructor());
|
||||
pd->stroke.cap = EVAS_VG_CAP_BUTT;
|
||||
pd->stroke.join = EVAS_VG_JOIN_MITER;
|
||||
pd->stroke.cap = EFL_GEOMETRY_CAP_BUTT;
|
||||
pd->stroke.join = EFL_GEOMETRY_JOIN_MITER;
|
||||
pd->stroke.scale = 1;
|
||||
pd->stroke.a = 1;
|
||||
pd->stroke.centered = 0.5;
|
||||
|
@ -88,23 +90,24 @@ _evas_vg_shape_fill_get(Eo *obj EINA_UNUSED, Evas_VG_Shape_Data *pd)
|
|||
}
|
||||
|
||||
void
|
||||
_evas_vg_shape_stroke_scale_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
double s)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_scale_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
double s)
|
||||
{
|
||||
pd->stroke.scale = s;
|
||||
}
|
||||
|
||||
double
|
||||
_evas_vg_shape_stroke_scale_get(Eo *obj EINA_UNUSED, Evas_VG_Shape_Data *pd)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_scale_get(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd)
|
||||
{
|
||||
return pd->stroke.scale;
|
||||
}
|
||||
|
||||
void
|
||||
_evas_vg_shape_stroke_color_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
int r, int g, int b, int a)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_color_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
int r, int g, int b, int a)
|
||||
{
|
||||
pd->stroke.r = r;
|
||||
pd->stroke.g = g;
|
||||
|
@ -113,9 +116,9 @@ _evas_vg_shape_stroke_color_set(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
void
|
||||
_evas_vg_shape_stroke_color_get(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
int *r, int *g, int *b, int *a)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_color_get(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
int *r, int *g, int *b, int *a)
|
||||
{
|
||||
if (r) *r = pd->stroke.r;
|
||||
if (g) *g = pd->stroke.g;
|
||||
|
@ -142,53 +145,57 @@ _evas_vg_shape_stroke_fill_get(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
void
|
||||
_evas_vg_shape_stroke_width_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
double w)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_width_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
double w)
|
||||
{
|
||||
pd->stroke.width = w;
|
||||
}
|
||||
|
||||
double
|
||||
_evas_vg_shape_stroke_width_get(Eo *obj EINA_UNUSED, Evas_VG_Shape_Data *pd)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_width_get(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd)
|
||||
{
|
||||
return pd->stroke.width;
|
||||
}
|
||||
|
||||
void
|
||||
_evas_vg_shape_stroke_location_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
double centered)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_location_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
double centered)
|
||||
{
|
||||
pd->stroke.centered = centered;
|
||||
}
|
||||
|
||||
double
|
||||
_evas_vg_shape_stroke_location_get(Eo *obj EINA_UNUSED, Evas_VG_Shape_Data *pd)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_location_get(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd)
|
||||
{
|
||||
return pd->stroke.centered;
|
||||
}
|
||||
|
||||
void
|
||||
_evas_vg_shape_stroke_dash_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
const Evas_VG_Dash *dash, unsigned int length)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_dash_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
const Efl_Geometry_Dash *dash,
|
||||
unsigned int length)
|
||||
{
|
||||
free(pd->stroke.dash);
|
||||
pd->stroke.dash = NULL;
|
||||
pd->stroke.dash_count = 0;
|
||||
|
||||
pd->stroke.dash = malloc(sizeof (Evas_VG_Dash) * length);
|
||||
pd->stroke.dash = malloc(sizeof (Efl_Geometry_Dash) * length);
|
||||
if (!pd->stroke.dash) return ;
|
||||
|
||||
memcpy(pd->stroke.dash, dash, sizeof (Evas_VG_Dash) * length);
|
||||
memcpy(pd->stroke.dash, dash, sizeof (Efl_Geometry_Dash) * length);
|
||||
pd->stroke.dash_count = length;
|
||||
}
|
||||
|
||||
void
|
||||
_evas_vg_shape_stroke_dash_get(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
const Evas_VG_Dash **dash, unsigned int *length)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_dash_get(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
const Efl_Geometry_Dash **dash,
|
||||
unsigned int *length)
|
||||
{
|
||||
if (dash) *dash = pd->stroke.dash;
|
||||
if (length) *length = pd->stroke.dash_count;
|
||||
|
@ -213,30 +220,31 @@ _evas_vg_shape_stroke_marker_get(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
void
|
||||
_evas_vg_shape_stroke_cap_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
Evas_VG_Cap c)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_cap_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
Efl_Geometry_Cap c)
|
||||
{
|
||||
pd->stroke.cap = c;
|
||||
}
|
||||
|
||||
Evas_VG_Cap
|
||||
_evas_vg_shape_stroke_cap_get(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd)
|
||||
Efl_Geometry_Cap
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_cap_get(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd)
|
||||
{
|
||||
return pd->stroke.cap;
|
||||
}
|
||||
|
||||
void
|
||||
_evas_vg_shape_stroke_join_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
Evas_VG_Join j)
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_join_set(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd,
|
||||
Efl_Geometry_Join j)
|
||||
{
|
||||
pd->stroke.join = j;
|
||||
}
|
||||
|
||||
Evas_VG_Join
|
||||
_evas_vg_shape_stroke_join_get(Eo *obj EINA_UNUSED, Evas_VG_Shape_Data *pd)
|
||||
Efl_Geometry_Join
|
||||
_evas_vg_shape_efl_geometry_shape_stroke_join_get(Eo *obj EINA_UNUSED,
|
||||
Evas_VG_Shape_Data *pd)
|
||||
{
|
||||
return pd->stroke.join;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Evas.VG_Shape (Evas.VG_Node)
|
||||
class Evas.VG_Shape (Evas.VG_Node, Efl.Geometry.Shape)
|
||||
{
|
||||
eo_prefix: evas_vg_shape;
|
||||
legacy_prefix: null;
|
||||
|
@ -12,27 +12,6 @@ class Evas.VG_Shape (Evas.VG_Node)
|
|||
Evas_VG_Node *f;
|
||||
}
|
||||
}
|
||||
stroke_scale {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
double s;
|
||||
}
|
||||
}
|
||||
stroke_color {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
int a;
|
||||
}
|
||||
}
|
||||
stroke_fill {
|
||||
set {
|
||||
}
|
||||
|
@ -42,72 +21,25 @@ class Evas.VG_Shape (Evas.VG_Node)
|
|||
Evas_VG_Node *f;
|
||||
}
|
||||
}
|
||||
stroke_width {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
double w;
|
||||
}
|
||||
}
|
||||
stroke_location {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
double centered;
|
||||
}
|
||||
}
|
||||
stroke_dash {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
const(Evas_VG_Dash) *dash;
|
||||
uint length;
|
||||
}
|
||||
}
|
||||
stroke_marker {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
Evas_VG_Shape *m;
|
||||
}
|
||||
}
|
||||
stroke_cap {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
Evas_VG_Cap c;
|
||||
}
|
||||
}
|
||||
stroke_join {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
Evas_VG_Join j;
|
||||
}
|
||||
}
|
||||
}
|
||||
methods {
|
||||
path_set {
|
||||
return: bool;
|
||||
params {
|
||||
@in const(Evas_VG_Path_Command) *op;
|
||||
@in const(double) *points;
|
||||
Evas_VG_Node *m;
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Geometry.Shape.stroke_scale;
|
||||
Efl.Geometry.Shape.stroke_color;
|
||||
Efl.Geometry.Shape.stroke_width;
|
||||
Efl.Geometry.Shape.stroke_location;
|
||||
Efl.Geometry.Shape.stroke_dash;
|
||||
Efl.Geometry.Shape.stroke_cap;
|
||||
Efl.Geometry.Shape.stroke_join;
|
||||
Efl.Geometry.Shape.path_set;
|
||||
Eo.Base.constructor;
|
||||
Eo.Base.destructor;
|
||||
}
|
||||
|
|
|
@ -4,33 +4,33 @@
|
|||
#include "evas_vg_private.h"
|
||||
|
||||
static unsigned int
|
||||
evas_vg_path_command_length(Evas_VG_Path_Command command)
|
||||
efl_geometry_path_command_length(Efl_Geometry_Path_Command command)
|
||||
{
|
||||
switch (command)
|
||||
{
|
||||
case EVAS_VG_PATH_COMMAND_TYPE_END: return 0;
|
||||
case EVAS_VG_PATH_COMMAND_TYPE_MOVE_TO: return 2;
|
||||
case EVAS_VG_PATH_COMMAND_TYPE_LINE_TO: return 2;
|
||||
case EVAS_VG_PATH_COMMAND_TYPE_QUADRATIC_TO: return 4;
|
||||
case EVAS_VG_PATH_COMMAND_TYPE_SQUADRATIC_TO: return 2;
|
||||
case EVAS_VG_PATH_COMMAND_TYPE_CUBIC_TO: return 6;
|
||||
case EVAS_VG_PATH_COMMAND_TYPE_SCUBIC_TO: return 4;
|
||||
case EVAS_VG_PATH_COMMAND_TYPE_ARC_TO: return 5;
|
||||
case EVAS_VG_PATH_COMMAND_TYPE_CLOSE: return 0;
|
||||
case EVAS_VG_PATH_COMMAND_TYPE_LAST: return 0;
|
||||
case EFL_GEOMETRY_PATH_COMMAND_TYPE_END: return 0;
|
||||
case EFL_GEOMETRY_PATH_COMMAND_TYPE_MOVE_TO: return 2;
|
||||
case EFL_GEOMETRY_PATH_COMMAND_TYPE_LINE_TO: return 2;
|
||||
case EFL_GEOMETRY_PATH_COMMAND_TYPE_QUADRATIC_TO: return 4;
|
||||
case EFL_GEOMETRY_PATH_COMMAND_TYPE_SQUADRATIC_TO: return 2;
|
||||
case EFL_GEOMETRY_PATH_COMMAND_TYPE_CUBIC_TO: return 6;
|
||||
case EFL_GEOMETRY_PATH_COMMAND_TYPE_SCUBIC_TO: return 4;
|
||||
case EFL_GEOMETRY_PATH_COMMAND_TYPE_ARC_TO: return 5;
|
||||
case EFL_GEOMETRY_PATH_COMMAND_TYPE_CLOSE: return 0;
|
||||
case EFL_GEOMETRY_PATH_COMMAND_TYPE_LAST: return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
_evas_vg_path_length(const Evas_VG_Path_Command *commands,
|
||||
_efl_geometry_path_length(const Efl_Geometry_Path_Command *commands,
|
||||
unsigned int *cmd_length,
|
||||
unsigned int *pts_length)
|
||||
{
|
||||
if (commands)
|
||||
while (commands[*cmd_length] != EVAS_VG_PATH_COMMAND_TYPE_END)
|
||||
while (commands[*cmd_length] != EFL_GEOMETRY_PATH_COMMAND_TYPE_END)
|
||||
{
|
||||
*pts_length += evas_vg_path_command_length(commands[*cmd_length]);
|
||||
*pts_length += efl_geometry_path_command_length(commands[*cmd_length]);
|
||||
(*cmd_length)++;
|
||||
}
|
||||
|
||||
|
@ -39,49 +39,49 @@ _evas_vg_path_length(const Evas_VG_Path_Command *commands,
|
|||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
evas_vg_path_grow(Evas_VG_Path_Command command,
|
||||
Evas_VG_Path_Command **commands, double **points,
|
||||
efl_geometry_path_grow(Efl_Geometry_Path_Command command,
|
||||
Efl_Geometry_Path_Command **commands, double **points,
|
||||
double **offset_point)
|
||||
{
|
||||
Evas_VG_Path_Command *cmd_tmp;
|
||||
Efl_Geometry_Path_Command *cmd_tmp;
|
||||
double *pts_tmp;
|
||||
unsigned int cmd_length = 0, pts_length = 0;
|
||||
|
||||
_evas_vg_path_length(*commands, &cmd_length, &pts_length);
|
||||
_efl_geometry_path_length(*commands, &cmd_length, &pts_length);
|
||||
|
||||
if (evas_vg_path_command_length(command))
|
||||
if (efl_geometry_path_command_length(command))
|
||||
{
|
||||
pts_length += evas_vg_path_command_length(command);
|
||||
pts_length += efl_geometry_path_command_length(command);
|
||||
pts_tmp = realloc(*points, pts_length * sizeof (double));
|
||||
if (!pts_tmp) return EINA_FALSE;
|
||||
|
||||
*points = pts_tmp;
|
||||
*offset_point = *points + pts_length - evas_vg_path_command_length(command);
|
||||
*offset_point = *points + pts_length - efl_geometry_path_command_length(command);
|
||||
}
|
||||
|
||||
cmd_tmp = realloc(*commands,
|
||||
(cmd_length + 1) * sizeof (Evas_VG_Path_Command));
|
||||
(cmd_length + 1) * sizeof (Efl_Geometry_Path_Command));
|
||||
if (!cmd_tmp) return EINA_FALSE;
|
||||
*commands = cmd_tmp;
|
||||
|
||||
// Append the command
|
||||
cmd_tmp[cmd_length - 1] = command;
|
||||
// NULL terminate the stream
|
||||
cmd_tmp[cmd_length] = EVAS_VG_PATH_COMMAND_TYPE_END;
|
||||
cmd_tmp[cmd_length] = EFL_GEOMETRY_PATH_COMMAND_TYPE_END;
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
evas_vg_path_dup(Evas_VG_Path_Command **out_cmd, double **out_pts,
|
||||
const Evas_VG_Path_Command *in_cmd, const double *in_pts)
|
||||
efl_geometry_path_dup(Efl_Geometry_Path_Command **out_cmd, double **out_pts,
|
||||
const Efl_Geometry_Path_Command *in_cmd, const double *in_pts)
|
||||
{
|
||||
unsigned int cmd_length = 0, pts_length = 0;
|
||||
|
||||
_evas_vg_path_length(in_cmd, &cmd_length, &pts_length);
|
||||
_efl_geometry_path_length(in_cmd, &cmd_length, &pts_length);
|
||||
|
||||
*out_pts = malloc(pts_length * sizeof (double));
|
||||
*out_cmd = malloc(cmd_length * sizeof (Evas_VG_Path_Command));
|
||||
*out_cmd = malloc(cmd_length * sizeof (Efl_Geometry_Path_Command));
|
||||
if (!(*out_pts) || !(*out_cmd))
|
||||
{
|
||||
free(*out_pts);
|
||||
|
@ -90,17 +90,17 @@ evas_vg_path_dup(Evas_VG_Path_Command **out_cmd, double **out_pts,
|
|||
}
|
||||
|
||||
memcpy(*out_pts, in_pts, pts_length * sizeof (double));
|
||||
memcpy(*out_cmd, in_cmd, cmd_length * sizeof (Evas_VG_Path_Command));
|
||||
memcpy(*out_cmd, in_cmd, cmd_length * sizeof (Efl_Geometry_Path_Command));
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
evas_vg_path_append_move_to(Evas_VG_Path_Command **commands, double **points,
|
||||
efl_geometry_path_append_move_to(Efl_Geometry_Path_Command **commands, double **points,
|
||||
double x, double y)
|
||||
{
|
||||
double *offset_point;
|
||||
|
||||
if (!evas_vg_path_grow(EVAS_VG_PATH_COMMAND_TYPE_MOVE_TO,
|
||||
if (!efl_geometry_path_grow(EFL_GEOMETRY_PATH_COMMAND_TYPE_MOVE_TO,
|
||||
commands, points, &offset_point))
|
||||
return ;
|
||||
|
||||
|
@ -109,12 +109,12 @@ evas_vg_path_append_move_to(Evas_VG_Path_Command **commands, double **points,
|
|||
}
|
||||
|
||||
void
|
||||
evas_vg_path_append_line_to(Evas_VG_Path_Command **commands, double **points,
|
||||
efl_geometry_path_append_line_to(Efl_Geometry_Path_Command **commands, double **points,
|
||||
double x, double y)
|
||||
{
|
||||
double *offset_point;
|
||||
|
||||
if (!evas_vg_path_grow(EVAS_VG_PATH_COMMAND_TYPE_LINE_TO,
|
||||
if (!efl_geometry_path_grow(EFL_GEOMETRY_PATH_COMMAND_TYPE_LINE_TO,
|
||||
commands, points, &offset_point))
|
||||
return ;
|
||||
|
||||
|
@ -123,12 +123,12 @@ evas_vg_path_append_line_to(Evas_VG_Path_Command **commands, double **points,
|
|||
}
|
||||
|
||||
void
|
||||
evas_vg_path_append_quadratic_to(Evas_VG_Path_Command **commands, double **points,
|
||||
efl_geometry_path_append_quadratic_to(Efl_Geometry_Path_Command **commands, double **points,
|
||||
double x, double y, double ctrl_x, double ctrl_y)
|
||||
{
|
||||
double *offset_point;
|
||||
|
||||
if (!evas_vg_path_grow(EVAS_VG_PATH_COMMAND_TYPE_QUADRATIC_TO,
|
||||
if (!efl_geometry_path_grow(EFL_GEOMETRY_PATH_COMMAND_TYPE_QUADRATIC_TO,
|
||||
commands, points, &offset_point))
|
||||
return ;
|
||||
|
||||
|
@ -139,12 +139,12 @@ evas_vg_path_append_quadratic_to(Evas_VG_Path_Command **commands, double **point
|
|||
}
|
||||
|
||||
void
|
||||
evas_vg_path_append_squadratic_to(Evas_VG_Path_Command **commands, double **points,
|
||||
efl_geometry_path_append_squadratic_to(Efl_Geometry_Path_Command **commands, double **points,
|
||||
double x, double y)
|
||||
{
|
||||
double *offset_point;
|
||||
|
||||
if (!evas_vg_path_grow(EVAS_VG_PATH_COMMAND_TYPE_SQUADRATIC_TO,
|
||||
if (!efl_geometry_path_grow(EFL_GEOMETRY_PATH_COMMAND_TYPE_SQUADRATIC_TO,
|
||||
commands, points, &offset_point))
|
||||
return ;
|
||||
|
||||
|
@ -153,14 +153,14 @@ evas_vg_path_append_squadratic_to(Evas_VG_Path_Command **commands, double **poin
|
|||
}
|
||||
|
||||
void
|
||||
evas_vg_path_append_cubic_to(Evas_VG_Path_Command **commands, double **points,
|
||||
efl_geometry_path_append_cubic_to(Efl_Geometry_Path_Command **commands, double **points,
|
||||
double x, double y,
|
||||
double ctrl_x0, double ctrl_y0,
|
||||
double ctrl_x1, double ctrl_y1)
|
||||
{
|
||||
double *offset_point;
|
||||
|
||||
if (!evas_vg_path_grow(EVAS_VG_PATH_COMMAND_TYPE_CUBIC_TO,
|
||||
if (!efl_geometry_path_grow(EFL_GEOMETRY_PATH_COMMAND_TYPE_CUBIC_TO,
|
||||
commands, points, &offset_point))
|
||||
return ;
|
||||
|
||||
|
@ -173,13 +173,13 @@ evas_vg_path_append_cubic_to(Evas_VG_Path_Command **commands, double **points,
|
|||
}
|
||||
|
||||
void
|
||||
evas_vg_path_append_scubic_to(Evas_VG_Path_Command **commands, double **points,
|
||||
efl_geometry_path_append_scubic_to(Efl_Geometry_Path_Command **commands, double **points,
|
||||
double x, double y,
|
||||
double ctrl_x, double ctrl_y)
|
||||
{
|
||||
double *offset_point;
|
||||
|
||||
if (!evas_vg_path_grow(EVAS_VG_PATH_COMMAND_TYPE_SCUBIC_TO,
|
||||
if (!efl_geometry_path_grow(EFL_GEOMETRY_PATH_COMMAND_TYPE_SCUBIC_TO,
|
||||
commands, points, &offset_point))
|
||||
return ;
|
||||
|
||||
|
@ -190,14 +190,14 @@ evas_vg_path_append_scubic_to(Evas_VG_Path_Command **commands, double **points,
|
|||
}
|
||||
|
||||
void
|
||||
evas_vg_path_append_arc_to(Evas_VG_Path_Command **commands, double **points,
|
||||
efl_geometry_path_append_arc_to(Efl_Geometry_Path_Command **commands, double **points,
|
||||
double x, double y,
|
||||
double rx, double ry,
|
||||
double angle)
|
||||
{
|
||||
double *offset_point;
|
||||
|
||||
if (!evas_vg_path_grow(EVAS_VG_PATH_COMMAND_TYPE_ARC_TO,
|
||||
if (!efl_geometry_path_grow(EFL_GEOMETRY_PATH_COMMAND_TYPE_ARC_TO,
|
||||
commands, points, &offset_point))
|
||||
return ;
|
||||
|
||||
|
@ -209,21 +209,21 @@ evas_vg_path_append_arc_to(Evas_VG_Path_Command **commands, double **points,
|
|||
}
|
||||
|
||||
void
|
||||
evas_vg_path_append_close(Evas_VG_Path_Command **commands, double **points)
|
||||
efl_geometry_path_append_close(Efl_Geometry_Path_Command **commands, double **points)
|
||||
{
|
||||
double *offset_point;
|
||||
|
||||
evas_vg_path_grow(EVAS_VG_PATH_COMMAND_TYPE_ARC_TO,
|
||||
efl_geometry_path_grow(EFL_GEOMETRY_PATH_COMMAND_TYPE_ARC_TO,
|
||||
commands, points, &offset_point);
|
||||
}
|
||||
|
||||
void
|
||||
evas_vg_path_append_circle(Evas_VG_Path_Command **commands, double **points,
|
||||
efl_geometry_path_append_circle(Efl_Geometry_Path_Command **commands, double **points,
|
||||
double x, double y, double radius)
|
||||
{
|
||||
evas_vg_path_append_move_to(commands, points, x, y - radius);
|
||||
evas_vg_path_append_arc_to(commands, points, x + radius, y, radius, radius, 0);
|
||||
evas_vg_path_append_arc_to(commands, points, x, y + radius, radius, radius, 0);
|
||||
evas_vg_path_append_arc_to(commands, points, x - radius, y, radius, radius, 0);
|
||||
evas_vg_path_append_arc_to(commands, points, x, y - radius, radius, radius, 0);
|
||||
efl_geometry_path_append_move_to(commands, points, x, y - radius);
|
||||
efl_geometry_path_append_arc_to(commands, points, x + radius, y, radius, radius, 0);
|
||||
efl_geometry_path_append_arc_to(commands, points, x, y + radius, radius, radius, 0);
|
||||
efl_geometry_path_append_arc_to(commands, points, x - radius, y, radius, radius, 0);
|
||||
efl_geometry_path_append_arc_to(commands, points, x, y - radius, radius, radius, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue