This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch edje-vector-intergration
in repository efl.
View the commit online.
commit e3741f87be8e4ff3d3d31f196b413c83cb3094d6
Author: Cedric BAIL <[email protected]>
AuthorDate: Thu Nov 26 13:14:59 2026 -0600
doc: add a tutorial for edje vector state animation
Walks through the example theme, the edc syntax for trees, inline
trees and overrides, how transitions blend, the edje_cc diagnostics
with their default level and how to change it, and the edje_edit
vector API.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
doc/Doxyfile.in | 1 +
doc/edje_vector_states.dox | 284 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 285 insertions(+)
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
index 5b0711a390..9ff7434104 100644
--- a/doc/Doxyfile.in
+++ b/doc/Doxyfile.in
@@ -608,6 +608,7 @@ INPUT = @top_srcdir@/src/lib \
@srcdir@/eldbus_examples.dox \
@srcdir@/ephysics_examples.dox \
@srcdir@/edje_examples.dox \
+ @srcdir@/edje_vector_states.dox \
@top_srcdir@/src/bin/edje/edje_cc_handlers.c \
@srcdir@/emotion_examples.dox \
@srcdir@/elementary_examples.dox
diff --git a/doc/edje_vector_states.dox b/doc/edje_vector_states.dox
new file mode 100644
index 0000000000..6880902f89
--- /dev/null
+++ b/doc/edje_vector_states.dox
@@ -0,0 +1,284 @@
+/**
+ * @page tutorial_edje_vector_states Edje Vector State Animation
+ *
+ * @section edje_vg_intro Introduction
+ *
+ * Edje vector state animation lets a theme author embed resolution-independent
+ * vector content directly in an EDC file and morph that content smoothly
+ * between the states of a VECTOR part, without swapping bitmap frames,
+ * loading external image files, or writing C code.
+ *
+ * Three capabilities combine to make this work:
+ *
+ * -# @b Named @b vector @b trees. A @c vectors {} block inside
+ * @c collections {} defines named trees of vector nodes (shapes,
+ * gradients, containers). Each tree is stored in the compiled @c .edj and
+ * can be referenced by any number of VECTOR part descriptions with
+ * @c vector.use. A description can also hold its own tree inline, in a
+ * @c vector {} block.
+ * -# @b Per-state @b overrides. A state description can select a named node
+ * of its tree with @c vector.shape {}, @c vector.container {},
+ * @c vector.gradient_linear {} or @c vector.gradient_radial {} and
+ * replace individual properties (path, fill, stroke, color, transform,
+ * visibility, gradient geometry and stops) for that state only.
+ * Unmentioned properties keep the value of the base tree.
+ * -# @b Live @b transitions. When Edje interpolates between two states it
+ * blends the two sets of node properties by node name. Paths are morphed
+ * point by point (the command sequences must match), colors are blended
+ * channel by channel, and numbers such as stroke width and gradient
+ * coordinates are interpolated as floats. Values that cannot be blended,
+ * such as the gradient spread, switch from one state to the other at the
+ * middle of the transition. A node that is hidden in only one of the two
+ * states is shown during the whole transition.
+ *
+ * @section edje_vg_why Why use it?
+ *
+ * @li @b Designer-friendly: the entire visual appearance lives in the EDC
+ * file. No C code is needed to change shapes or colors on hover, focus
+ * or press.
+ * @li @b Resolution-independent: vector content scales to any size without
+ * artefacts.
+ * @li @b Class-aware retinting: bind a fill, a stroke or a gradient stop to a
+ * @c color_class so the host application can retint the widget at runtime
+ * with @c edje_object_color_class_set(), the same mechanism used for text
+ * and image parts.
+ * @li @b Cheap at run time: each frame of a transition blends the two states
+ * once and then updates the Efl_VG tree once. The blended tree is cached
+ * per description and is rebuilt only when a color class it uses changes.
+ *
+ * @section edje_vg_edc EDC walkthrough
+ *
+ * The worked example ships at @c src/examples/edje/vector_states.edc. A
+ * part morphs from a rounded square to the Enlightenment logo, sweeps a
+ * gradient fill and widens its stroke when the mouse enters it. The
+ * discussion below follows that file section by section.
+ *
+ * @subsection edje_vg_edc_colorclasses Color classes
+ *
+ * @code
+ * color_classes {
+ * color_class { name: "logo_fill"; color: 80 140 255 255; }
+ * color_class { name: "logo_hover"; color: 255 200 80 255; }
+ * color_class { name: "logo_outline"; color: 20 20 20 255; }
+ * }
+ * @endcode
+ *
+ * Three color classes are declared. @c logo_fill and @c logo_outline are the
+ * stops of the default gradient and the stroke color; @c logo_hover replaces
+ * @c logo_fill as the first gradient stop in the hovered state. The host
+ * application can override any of them at runtime with
+ * @c edje_object_color_class_set() without touching the theme binary. A
+ * color class used by a node but not declared is reported as VEC011.
+ *
+ * @subsection edje_vg_edc_tree Named vector tree
+ *
+ * @code
+ * vectors {
+ * vector { name: "logo_glyph";
+ * viewbox: 0 0 100 100;
+ * gradient_linear { name: "body_grad";
+ * start: 50 0;
+ * end: 50 100;
+ * spread: PAD;
+ * stop { offset: 0.0; color_class: "logo_fill"; }
+ * stop { offset: 1.0; color_class: "logo_outline"; }
+ * }
+ * shape { name: "body";
+ * path: "M12,0 L50,0 C63,0 75,0 88,0 C100,0 100,0 100,12 ... Z";
+ * fill.gradient: "body_grad";
+ * stroke.color_class: "logo_outline";
+ * stroke.width: 2;
+ * }
+ * }
+ * }
+ * @endcode
+ *
+ * The @c vectors {} block defines the tree @c "logo_glyph" (the path is cut
+ * short here; the file has the full one). It holds two nodes that are
+ * siblings: a linear gradient named @c "body_grad", running from the top to
+ * the bottom of the viewbox, and a shape named @c "body". The shape is filled
+ * with the gradient by name through @c fill.gradient, and stroked with a color
+ * class. Container nodes can be nested to any depth to group nodes and share
+ * a transform. The viewbox is stretched over the part, so the tree follows
+ * the size of the part; give the part an @c aspect to keep its proportions.
+ *
+ * The path is a rounded square written with the same command sequence as the
+ * logo of the hovered state: one @c M, two @c L, thirteen @c C and a @c Z.
+ * Path morphing works point by point, so every state that overrides the path
+ * of a node must use the same command sequence as the base path. Elliptical
+ * arc commands (@c a and @c A) are not supported and are refused with VEC003.
+ *
+ * @subsection edje_vg_edc_part VECTOR part and state descriptions
+ *
+ * @code
+ * part { name: "logo"; type: VECTOR;
+ * description { state: "default" 0.0;
+ * rel1.relative: 0.0 0.0;
+ * rel2.relative: 1.0 1.0;
+ * vector.use: "logo_glyph";
+ * }
+ * description { state: "hover" 0.0;
+ * inherit: "default" 0.0;
+ * vector.shape {
+ * target: "body";
+ * path: "M30.17,42.65 L75.78,73.10 C77.67,71.14 ... Z";
+ * stroke.width: 4;
+ * }
+ * vector.gradient_linear {
+ * target: "body_grad";
+ * start: 0 50;
+ * end: 100 50;
+ * stop { offset: 0.0; color_class: "logo_hover"; }
+ * stop { offset: 1.0; color_class: "logo_outline"; }
+ * }
+ * }
+ * }
+ * @endcode
+ *
+ * The @c default description binds the part to the @c "logo_glyph" tree with
+ * @c vector.use. The @c hover description inherits it and adds two override
+ * blocks, each naming the node it changes with @c target:.
+ *
+ * -# The shape override replaces the path by the logo, with the same command
+ * sequence, and widens the stroke from 2 to 4. The fill and the stroke
+ * color keep their base values.
+ * -# The gradient override sweeps the gradient from vertical to horizontal and
+ * swaps the color class of the first stop for @c logo_hover. The number
+ * of stops is the same as in the base gradient.
+ *
+ * A @c target: that names no node, or a node of another type, is the error
+ * VEC002, as is a @c fill.gradient that names no gradient. The same node name
+ * used with two different node types in two states is reported as VEC009.
+ *
+ * A description can hold only one of @c vector.use, a @c vector {} block with
+ * nodes, or an @c image.normal: more than one is the error VEC006, and a
+ * @c vector.use of an unknown tree is the error VEC005. A small tree used
+ * by one description only is written inline, without a @c vectors {} block:
+ *
+ * @code
+ * description { state: "default" 0.0;
+ * vector {
+ * viewbox: 0 0 10 10;
+ * shape { name: "dot";
+ * path: "M0,0 L10,0 L10,10 L0,10 Z";
+ * fill.color_class: "logo_fill";
+ * }
+ * }
+ * }
+ * @endcode
+ *
+ * The @c vector { frame: N; } block form is a different feature: it selects
+ * the frame of a Lottie animation used as the source of the part.
+ *
+ * @subsection edje_vg_edc_programs Programs
+ *
+ * @code
+ * programs {
+ * program { signal: "mouse,in"; source: "logo";
+ * action: STATE_SET "hover" 0.0;
+ * target: "logo";
+ * transition: SINUSOIDAL 0.3;
+ * }
+ * program { signal: "mouse,out"; source: "logo";
+ * action: STATE_SET "default" 0.0;
+ * target: "logo";
+ * transition: SINUSOIDAL 0.3;
+ * }
+ * }
+ * @endcode
+ *
+ * Two programs connect mouse-in and mouse-out to a 300 ms sinusoidal
+ * transition. No C code is needed.
+ *
+ * @subsection edje_vg_edc_transform Transforms
+ *
+ * A node can be moved with @c transform.translate, @c transform.rotate and
+ * @c transform.scale, or with a single @c transform.matrix. Giving the
+ * matrix and any of the other three to the same node in one description is
+ * the error VEC014. Known limitation: the Evas software engine clips a
+ * transformed shape to the bounds of its untransformed path.
+ *
+ * @section edje_vg_c C harness
+ *
+ * The minimal C harness at @c src/examples/edje/edje-vector-states.c loads
+ * @c vector_states.edj, or the file given as its first argument, displays the
+ * @c "ui/logo" group in a 400x400 window, and registers signal callbacks so
+ * the terminal shows which transition is occurring. The core is:
+ *
+ * @code
+ * edje_obj = edje_object_add(evas);
+ * edje_object_file_set(edje_obj, edje_file, "ui/logo");
+ *
+ * edje_object_signal_callback_add(edje_obj, "mouse,in", "logo", _on_hover_in, NULL);
+ * edje_object_signal_callback_add(edje_obj, "mouse,out", "logo", _on_hover_out, NULL);
+ * @endcode
+ *
+ * Runtime retinting:
+ *
+ * @code
+ * edje_object_color_class_set(edje_obj, "logo_hover",
+ * 255, 80, 80, 255,
+ * 0, 0, 0, 0,
+ * 0, 0, 0, 0);
+ * @endcode
+ *
+ * To compile and run:
+ *
+ * @verbatim
+ * edje_cc src/examples/edje/vector_states.edc
+ * gcc -o edje-vector-states src/examples/edje/edje-vector-states.c \
+ * `pkg-config --cflags --libs evas ecore ecore-evas edje`
+ * ./edje-vector-states vector_states.edj
+ * @endverbatim
+ *
+ * @section edje_vg_edit Programmatic editing via Edje_Edit
+ *
+ * Visual editors can inspect and modify vector trees through the Edje_Edit
+ * API, available since EFL 1.30:
+ *
+ * - edje_edit_vector_trees_list_get() and edje_edit_vector_tree_exists()
+ * list the named trees of the file and test for one.
+ * - edje_edit_vector_tree_add() and edje_edit_vector_tree_del() create or
+ * remove a tree. A new tree is empty, apart from its root container.
+ * - edje_edit_state_vector_tree_get() and edje_edit_state_vector_tree_set()
+ * query or change the tree a part state is bound to.
+ * - edje_edit_state_vector_overrides_list_get() lists the nodes a part state
+ * overrides.
+ * - edje_edit_state_vector_override_add() and
+ * edje_edit_state_vector_override_del() add or remove the override of a
+ * node. A new override has no property set.
+ * - edje_edit_vector_tree_node_color_class_get() and
+ * edje_edit_vector_tree_node_color_class_set() read or assign the color
+ * class of a node of a tree.
+ *
+ * There is no API yet to add nodes to a tree or to set the properties of an
+ * override. All setters mark the file dirty; call edje_edit_save() to
+ * persist the changes.
+ *
+ * @section edje_vg_diagnostics Compile-time diagnostics
+ *
+ * @c edje_cc reports common authoring mistakes with a code. Each code has a
+ * default level that can be changed on the command line with
+ * @c -W @c code=level, where level is @c info, @c warn (or @c warning) or
+ * @c error (or @c err). The alias @c vector-topology stands for VEC004:
+ *
+ * @verbatim
+ * edje_cc -W VEC012=error -W vector-topology=error my_theme.edc
+ * @endverbatim
+ *
+ * The diagnostic codes are:
+ *
+ * | Code | Default | Condition |
+ * |--------|---------|------------------------------------------------------------|
+ * | VEC001 | error | Duplicate node or tree name |
+ * | VEC002 | error | Override target missing, unknown or of another node type; fill.gradient naming no gradient |
+ * | VEC003 | error | Invalid or empty path, or path with arc commands (a, A) |
+ * | VEC004 | warning | Path commands of a node differ between states (will not morph) |
+ * | VEC005 | error | vector.use names an unknown tree |
+ * | VEC006 | error | More than one of vector.use, vector {} with nodes and image.normal in one description |
+ * | VEC007 | info | Lottie source: cross-state checks are skipped (shown with -v or EINA_LOG_LEVELS=edje_cc:3) |
+ * | VEC009 | warning | Same node name with different node types across states |
+ * | VEC011 | warning | Color class used but not declared in color_classes |
+ * | VEC012 | warning | Shape without fill or gradient, or stroke width without stroke color |
+ * | VEC014 | error | transform.matrix combined with translate, rotate or scale on one node in one description |
+ */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.