Tizen Native API
5.5
|
Vector Graphics Object is the scene graph for managing vector graphics objects. User can create shape objects as well as fill objects and give them to the Evas_Object_Vg for drawing on the screen as well as managing the lifecycle of the objects, enabling reuse of shape objects.
Since Evas_Object_Vg is an Evas_Object all operations applicable to an Evas_Object can be performed on it (clipping, mapping, etc).
To create complex vector graphics you can create a hierarchy of shape and fill objects and give the hierarchy to Evas_Object which will be responsible for drawing and showing on the screen.
As the shape object and fill object (linear and radial gradients) have retain mode API, you only have to create it once and set the properties and give it to Evas_Object_Vg.
Any change in the properties of a shape or fill object are automatically notified to Evas_Object_Vg triggering a redraw to reflect the changes.
To create a vector path, you can give a list of path commands to the shape object using efl_gfx_shape_path_set() API.
Below are the list of features currently supported by Vector object.
- Drawing SVG Path. You can construct a path by using api in efl_gfx_utils.h
- Gradient filling and stroking. You can fill or stroke the path using linear or radial gradient.
- See also:
- Evas_Vg_Gradient_Linear and Evas_Vg_Gradient_Radial
- Transformation support for path and gradient fill. You can apply affine transforms to path objects.
- See also:
- Eina_Matrix.
- Note:
- Below are the list of interfaces and classes that can be used to draw vector graphics using vector objects.
- Efl.Gfx.Shape
- Evas.VG_Shape
- Evas.VG_Node
- Efl.Gfx.Gradient
- Efl.Gfx.Gradient_Radial
- Efl.Gfx.Gradient_Linear
Example:
vector = evas_object_vg_add(canvas); root = evas_obj_vg_root_node_get(vector); shape = efl_add(EVAS_VG_SHAPE_CLASS, root); Efl_Gfx_Path_Command *path_cmd = NULL; double *points = NULL; efl_gfx_path_append_circle(&path_cmd, &points); * evas_vg_node_origin_set(shape, 10, 10); * efl_gfx_shape_stroke_width_set(shape, 1.0); * evas_vg_node_color_set(shape, 128, 128, 128, 80); * efl_gfx_shape_path_set(shape, path_cmd, points);
- Since (EFL) :
- 1.14
Functions | |
Efl_Canvas_Vg_Node * | evas_object_vg_root_node_get (const Efl_VG *obj) |
Get the root node of the evas_object_vg. | |
Evas_Object * | evas_object_vg_add (Evas *e) |
Creates a new vector object on the given Evas e canvas. | |
Efl_VG * | evas_vg_shape_add (Efl_VG *parent) |
Efl_VG * | evas_vg_container_add (Efl_VG *parent) |
Eina_Bool | evas_vg_node_visible_get (Eo *obj) |
void | evas_vg_node_visible_set (Eo *obj, Eina_Bool v) |
void | evas_vg_node_color_get (Eo *obj, int *r, int *g, int *b, int *a) |
void | evas_vg_node_color_set (Eo *obj, int r, int g, int b, int a) |
void | evas_vg_shape_stroke_color_get (Eo *obj, int *r, int *g, int *b, int *a) |
void | evas_vg_shape_stroke_color_set (Eo *obj, int r, int g, int b, int a) |
double | evas_vg_shape_stroke_width_get (Eo *obj) |
void | evas_vg_shape_stroke_width_set (Eo *obj, double w) |
Efl_Gfx_Cap | evas_vg_shape_stroke_cap_get (Eo *obj) |
void | evas_vg_shape_stroke_cap_set (Eo *obj, Efl_Gfx_Cap c) |
Efl_Gfx_Join | evas_vg_shape_stroke_join_get (Eo *obj) |
void | evas_vg_shape_stroke_join_set (Eo *obj, Efl_Gfx_Join j) |
void | evas_vg_shape_fill_set (Eo *obj, Efl_VG *f) |
Efl_VG * | evas_vg_shape_fill_get (const Eo *obj) |
void | evas_vg_shape_stroke_fill_set (Eo *obj, Efl_VG *f) |
Efl_VG * | evas_vg_shape_stroke_fill_get (const Eo *obj) |
void | evas_vg_gradient_stop_set (Eo *obj, const Efl_Gfx_Gradient_Stop *colors, unsigned int length) |
void | evas_vg_gradient_stop_get (Eo *obj, const Efl_Gfx_Gradient_Stop **colors, unsigned int *length) |
void | evas_vg_gradient_spread_set (Eo *obj, Efl_Gfx_Gradient_Spread s) |
Efl_Gfx_Gradient_Spread | evas_vg_gradient_spread_get (Eo *obj) |
void | evas_vg_gradient_linear_start_set (Eo *obj, double x, double y) |
void | evas_vg_gradient_linear_start_get (Eo *obj, double *x, double *y) |
void | evas_vg_gradient_linear_end_set (Eo *obj, double x, double y) |
void | evas_vg_gradient_linear_end_get (Eo *obj, double *x, double *y) |
void | evas_vg_gradient_radial_center_set (Eo *obj, double x, double y) |
void | evas_vg_gradient_radial_center_get (Eo *obj, double *x, double *y) |
void | evas_vg_gradient_radial_radius_set (Eo *obj, double r) |
double | evas_vg_gradient_radial_radius_get (Eo *obj) |
void | evas_vg_gradient_radial_focal_set (Eo *obj, double x, double y) |
void | evas_vg_gradient_radial_focal_get (Eo *obj, double *x, double *y) |
Enumeration Type Documentation
Enumeration that defines how viewbox will be filled int the vg canvs's viewport. default Fill_Mode is none
- Enumerator:
Function Documentation
Evas_Object* evas_object_vg_add | ( | Evas * | e | ) |
Creates a new vector object on the given Evas e
canvas.
The shape object hierarchy can be added to the evas_object_vg by accessing the root node of the vg canvas and adding the hierarchy as child to the root node.
- Parameters:
-
[in] e The given canvas.
- Returns:
- The created vector object handle.
- See also:
- evas_obj_vg_root_node_get()
- Since (EFL) :
- 1.14
- Since :
- 3.0
Efl_Canvas_Vg_Node* evas_object_vg_root_node_get | ( | const Efl_VG * | obj | ) |
Get the root node of the evas_object_vg.
- Parameters:
-
[in] obj The object.
- Returns:
- Root node of the VG canvas.
- Since (EFL) :
- 1.14
- Since :
- 3.0
Efl_VG* evas_vg_container_add | ( | Efl_VG * | parent | ) |
Creates a new vector container object.
- Parameters:
-
parent The given vector container object.
- Returns:
- The created vector container object handle.
- Since (EFL) :
- 1.14
- Since :
- 3.0
void evas_vg_gradient_linear_end_get | ( | Eo * | obj, |
double * | x, | ||
double * | y | ||
) |
Gets the end point of this linear gradient.
- Parameters:
-
[out] x x co-ordinate of end point [out] y y co-ordinate of end point
- Since :
- 3.0
void evas_vg_gradient_linear_end_set | ( | Eo * | obj, |
double | x, | ||
double | y | ||
) |
Sets the end point of this linear gradient.
- Parameters:
-
[in] x x co-ordinate of end point [in] y y co-ordinate of end point
- Since :
- 3.0
void evas_vg_gradient_linear_start_get | ( | Eo * | obj, |
double * | x, | ||
double * | y | ||
) |
Gets the start point of this linear gradient.
- Parameters:
-
[out] x x co-ordinate of start point [out] y y co-ordinate of start point
- Since :
- 3.0
void evas_vg_gradient_linear_start_set | ( | Eo * | obj, |
double | x, | ||
double | y | ||
) |
Sets the start point of this linear gradient.
- Parameters:
-
[in] x x co-ordinate of start point [in] y y co-ordinate of start point
- Since :
- 3.0
void evas_vg_gradient_radial_center_get | ( | Eo * | obj, |
double * | x, | ||
double * | y | ||
) |
Gets the center of this radial gradient.
- Parameters:
-
[out] x x co-ordinate of center point [out] y y co-ordinate of center point
- Since :
- 3.0
void evas_vg_gradient_radial_center_set | ( | Eo * | obj, |
double | x, | ||
double | y | ||
) |
Sets the center of this radial gradient.
- Parameters:
-
[in] x x co-ordinate of center point [in] y y co-ordinate of center point
- Since :
- 3.0
void evas_vg_gradient_radial_focal_get | ( | Eo * | obj, |
double * | x, | ||
double * | y | ||
) |
Gets the focal point of this radial gradient.
- Parameters:
-
[out] x x co-ordinate of focal point [out] y y co-ordinate of focal point
- Since :
- 3.0
void evas_vg_gradient_radial_focal_set | ( | Eo * | obj, |
double | x, | ||
double | y | ||
) |
Sets the focal point of this radial gradient.
- Parameters:
-
[in] x x co-ordinate of focal point [in] y y co-ordinate of focal point
- Since :
- 3.0
double evas_vg_gradient_radial_radius_get | ( | Eo * | obj | ) |
Gets the center radius of this radial gradient.
- Since :
- 3.0
void evas_vg_gradient_radial_radius_set | ( | Eo * | obj, |
double | r | ||
) |
Sets the center radius of this radial gradient.
- Parameters:
-
[in] r center radius
- Since :
- 3.0
Efl_Gfx_Gradient_Spread evas_vg_gradient_spread_get | ( | Eo * | obj | ) |
Returns the spread method use by this gradient. The default is EFL_GFX_GRADIENT_SPREAD_PAD.
- Since (EFL) :
- 1.14
- Since :
- 3.0
void evas_vg_gradient_spread_set | ( | Eo * | obj, |
Efl_Gfx_Gradient_Spread | s | ||
) |
Specifies the spread method that should be used for this gradient.
- Since (EFL) :
- 1.14
- Parameters:
-
[in] s spread type to be used
- Since :
- 3.0
void evas_vg_gradient_stop_get | ( | Eo * | obj, |
const Efl_Gfx_Gradient_Stop ** | colors, | ||
unsigned int * | length | ||
) |
get the list of color stops.
- Since (EFL) :
- 1.14
- Parameters:
-
[out] colors color stops list [out] length length of the list
- Since :
- 3.0
void evas_vg_gradient_stop_set | ( | Eo * | obj, |
const Efl_Gfx_Gradient_Stop * | colors, | ||
unsigned int | length | ||
) |
Set the list of color stops for the gradient
- Since (EFL) :
- 1.14
- Parameters:
-
[in] colors color stops list [in] length length of the list
- Since :
- 3.0
void evas_vg_node_color_get | ( | Eo * | obj, |
int * | r, | ||
int * | g, | ||
int * | b, | ||
int * | a | ||
) |
Retrieves the general/main color of the given Efl_Vg object.
Retrieves the “main” color's RGB component (and alpha channel) values, which range from 0 to 255. For the alpha channel, which defines the object's transparency level, 0 means totally transparent, while 255 means opaque. These color values are premultiplied by the alpha value.
- Note:
- Use
NULL
pointers on the components you're not interested in: they'll be ignored by the function.
- Parameters:
-
[out] r The red component of the given color. [out] g The green component of the given color. [out] b The blue component of the given color. [out] a The alpha component of the given color.
- Since :
- 3.0
void evas_vg_node_color_set | ( | Eo * | obj, |
int | r, | ||
int | g, | ||
int | b, | ||
int | a | ||
) |
Sets the general/main color of the given Efl_Vg object to the given one.
- See also:
- evas_vg_node_color_get() (for an example)
- Note:
- These color values are expected to be premultiplied by
a
.
- Parameters:
-
[in] obj The object. [in] r The red component of the given color. [in] g The green component of the given color. [in] b The blue component of the given color. [in] a The alpha component of the given color.
- Since :
- 3.0
Eina_Bool evas_vg_node_visible_get | ( | Eo * | obj | ) |
Retrieves whether or not the given Efl_Vg object is visible.
- Since :
- 3.0
void evas_vg_node_visible_set | ( | Eo * | obj, |
Eina_Bool | v | ||
) |
Makes the given Efl_Vg object visible or invisible.
- Parameters:
-
[in] v EINA_TRUE
if to make the object visible,EINA_FALSE
otherwise
- Since :
- 3.0
Efl_VG* evas_vg_shape_add | ( | Efl_VG * | parent | ) |
Creates a new vector shape object.
- Parameters:
-
parent The given vector container object.
- Returns:
- The created vector shape object handle.
- Since (EFL) :
- 1.14
- Since :
- 3.0
Efl_VG* evas_vg_shape_fill_get | ( | const Eo * | obj | ) |
returns the object that is set for the fill property
- Parameters:
-
obj The object whose fill property is inspected.
- Returns:
- The object that is set as fill property.
- Since :
- 3.0
void evas_vg_shape_fill_set | ( | Eo * | obj, |
Efl_VG * | f | ||
) |
set a vg object as the fill property
- Parameters:
-
obj The object whose fill property gets modified. f The object content will be used for filling.
- Since :
- 3.0
Efl_Gfx_Cap evas_vg_shape_stroke_cap_get | ( | Eo * | obj | ) |
Gets the cap style used for stroking path.
- Since (EFL) :
- 1.14
- Since :
- 3.0
void evas_vg_shape_stroke_cap_set | ( | Eo * | obj, |
Efl_Gfx_Cap | c | ||
) |
Sets the cap style to be used for stroking the path. The cap will be used for capping the end point of a open subpath.
- See also:
- Efl_Gfx_Cap
- Since (EFL) :
- 1.14
- Parameters:
-
[in] c cap style to use , default is EFL_GFX_CAP_BUTT
- Since :
- 3.0
void evas_vg_shape_stroke_color_get | ( | Eo * | obj, |
int * | r, | ||
int * | g, | ||
int * | b, | ||
int * | a | ||
) |
Gets the color used for stroking the path.
- Since (EFL) :
- 1.14
- Parameters:
-
[out] r The red component of the given color. [out] g The green component of the given color. [out] b The blue component of the given color. [out] a The alpha component of the given color.
- Since :
- 3.0
void evas_vg_shape_stroke_color_set | ( | Eo * | obj, |
int | r, | ||
int | g, | ||
int | b, | ||
int | a | ||
) |
Sets the color to be used for stroking the path.
- Since (EFL) :
- 1.14
- Parameters:
-
[in] r The red component of the given color. [in] g The green component of the given color. [in] b The blue component of the given color. [in] a The alpha component of the given color.
- Since :
- 3.0
Efl_VG* evas_vg_shape_stroke_fill_get | ( | const Eo * | obj | ) |
returns the object that is set for the stroke fill property
- Parameters:
-
obj The object whose stroke fill property is inspected.
- Returns:
- The object that is set as stroke fill property.
- Since :
- 3.0
void evas_vg_shape_stroke_fill_set | ( | Eo * | obj, |
Efl_VG * | f | ||
) |
set a vg object as the stroke fill property
- Parameters:
-
obj The object whose stroke fill property gets modified. f The object content will be used for stroke filling.
- Since :
- 3.0
Efl_Gfx_Join evas_vg_shape_stroke_join_get | ( | Eo * | obj | ) |
Gets the join style used for stroking path.
- Since (EFL) :
- 1.14
- Since :
- 3.0
void evas_vg_shape_stroke_join_set | ( | Eo * | obj, |
Efl_Gfx_Join | j | ||
) |
Sets the join style to be used for stroking the path. The join style will be used for joining the two line segment while stroking the path.
- See also:
- Efl_Gfx_Join
- Since (EFL) :
- 1.14
- Parameters:
-
[in] j join style to use , default is EFL_GFX_JOIN_MITER
- Since :
- 3.0
double evas_vg_shape_stroke_width_get | ( | Eo * | obj | ) |
Gets the stroke width to be used for stroking the path.
- Since (EFL) :
- 1.14
- Since :
- 3.0
void evas_vg_shape_stroke_width_set | ( | Eo * | obj, |
double | w | ||
) |
Sets the stroke width to be used for stroking the path.
- Since (EFL) :
- 1.14
- Parameters:
-
[in] w stroke width to be used
- Since :
- 3.0