This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository expedite.

View the commit online.

commit ff3db5341a872ec1ac938482c25ece9bd04d1e54
Author: [email protected] <[email protected]>
AuthorDate: Sun Apr 5 22:10:17 2026 -0600

    test: add VG composite inverse benchmark
    
    Add expedite test "VG Composite Inverse" that exercises the
    various composite method. A alpha gradient-filled rectangle
    in a source container is masked by the Batman path in a target
    container using inverse alpha matting.
    
    Correct rendering shows rainbow gradient visible OUTSIDE the batman
    silhouette (complement of the MATTE_ALPHA test). Inside the batman
    shape is transparent, showing the background.
    
    Complements the existing "VG Basic Composite" test (MATTE_ALPHA)
    which shows gradient visible INSIDE the batman shape.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
 src/bin/meson.build              |   1 +
 src/bin/tests.h                  |   1 +
 src/bin/vg_basic_composite_inv.c | 171 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 173 insertions(+)

diff --git a/src/bin/meson.build b/src/bin/meson.build
index 68f687a..3bc3736 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -126,6 +126,7 @@ expedite_sources = [ 'main.c',
 	'vg_basic_batman.c',
 	'vg_basic_network.c',
 	'vg_basic_composite.c',
+	'vg_basic_composite_inv.c',
 	'vg_scaled.c',
 	'vg_gradient_multi_shape_transform.c',
 	'snapshot_widgets_file_icons.c' ]
diff --git a/src/bin/tests.h b/src/bin/tests.h
index 972eafe..6e9d6c1 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -119,6 +119,7 @@
 #include "vg_basic_batman.c"
 #include "vg_basic_network.c"
 #include "vg_basic_composite.c"
+#include "vg_basic_composite_inv.c"
 #include "vg_scaled.c"
 #include "vg_gradient_multi_shape_transform.c"
 #include "snapshot_widgets_file_icons.c"
diff --git a/src/bin/vg_basic_composite_inv.c b/src/bin/vg_basic_composite_inv.c
new file mode 100644
index 0000000..322d6ab
--- /dev/null
+++ b/src/bin/vg_basic_composite_inv.c
@@ -0,0 +1,171 @@
+#undef FNAME
+#undef NAME
+#undef ICON
+
+/* metadata */
+#define FNAME vg_basic_composite_inv_start
+#define NAME "VG Composite All Modes"
+#define ICON "vector.png"
+
+#ifndef PROTO
+# ifndef UI
+#  include "main.h"
+
+/* standard var */
+static int done = 0;
+
+/* private data */
+static Eo *o_shapes[OBNUM];
+
+/* Batman SVG path, pre-scaled to fit in ~80x70.
+ * Each VG object cycles through one of the 6 composite methods,
+ * producing visually distinct masking effects:
+ *   MATTE_ALPHA         — rainbow inside batman
+ *   MATTE_ALPHA_INVERSE — rainbow outside batman (batman-shaped hole)
+ *   MASK_ADD            — additive alpha blend with batman mask
+ *   MASK_SUBSTRACT      — subtractive (same visual as inverse)
+ *   MASK_INTERSECT      — intersect (same visual as matte)
+ *   MASK_DIFFERENCE     — difference blend */
+static const char *batman_path =
+   "M 28.5,51.3 C 25.6,42.9 15.4,44.5 22.7,64.2"
+   " 0.0,42.9 5.8,14.0 22.5,0.0"
+   " 19.1,10.0 23.0,16.6 35.6,18.4"
+   " 36.1,16.0 36.3,13.5 36.9,11.1"
+   " 37.1,11.4 37.4,11.8 37.6,12.1"
+   " 37.6,12.1 39.2,11.8 40.0,11.8"
+   " 40.8,11.8 42.4,12.1 42.4,12.1"
+   " 42.6,11.8 42.9,11.4 43.1,11.1"
+   " 43.7,13.5 43.9,16.0 44.4,18.4"
+   " 57.0,16.8 60.9,10.0 57.5,0.0"
+   " 74.2,13.9 80.0,42.9 57.3,64.2"
+   " 64.6,44.5 54.6,42.9 51.5,51.3"
+   " 47.3,43.9 42.4,43.7 40.0,70.0"
+   " 37.6,43.7 32.7,43.9 28.5,51.3 Z";
+
+/* Semi-transparent gradient stops so that all 6 composite methods
+ * produce visually distinct results.  With fully opaque sources,
+ * MASK_ADD is a no-op and MASK_DIFFERENCE collapses to INVERSE.
+ * Varying alpha (128 at edges, 255 at center) makes the differences
+ * visible: ADD brightens, DIFFERENCE shows edges, etc. */
+static const Efl_Gfx_Gradient_Stop rainbow_stops[5] = {
+   { 0.00, 128,   0,   0, 128 },
+   { 0.25, 255, 255,   0, 255 },
+   { 0.50,   0, 255,   0, 255 },
+   { 0.75, 255, 255,   0, 255 },
+   { 1.00,   0,   0, 128, 128 },
+};
+
+#define VG_W 84
+#define VG_H 74
+#define STROKE_M 2
+
+/* The 6 composite methods, cycled per object. */
+static const Efl_Gfx_Vg_Composite_Method comp_methods[6] = {
+   EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA,
+   EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA_INVERSE,
+   EFL_GFX_VG_COMPOSITE_METHOD_MASK_ADD,
+   EFL_GFX_VG_COMPOSITE_METHOD_MASK_SUBSTRACT,
+   EFL_GFX_VG_COMPOSITE_METHOD_MASK_INTERSECT,
+   EFL_GFX_VG_COMPOSITE_METHOD_MASK_DIFFERENCE,
+};
+
+/* setup */
+static void _setup(void)
+{
+   unsigned int i;
+
+   for (i = 0; i < OBNUM; i++)
+     {
+        Eo *vector;
+        Efl_VG *root, *source_container, *mask_container;
+        Efl_VG *grad, *rect_shape, *batman_shape;
+
+        vector = efl_add(EFL_CANVAS_VG_OBJECT_CLASS, evas);
+        o_shapes[i] = vector;
+        efl_gfx_entity_size_set(vector, EINA_SIZE2D(VG_W, VG_H));
+        efl_gfx_entity_position_set(vector, EINA_POSITION2D(0, 0));
+        efl_gfx_entity_visible_set(vector, EINA_TRUE);
+
+        root = efl_add(EFL_CANVAS_VG_CONTAINER_CLASS, vector);
+
+        source_container = efl_add(EFL_CANVAS_VG_CONTAINER_CLASS, root);
+
+        grad = efl_add(EFL_CANVAS_VG_GRADIENT_LINEAR_CLASS, source_container);
+        efl_gfx_gradient_linear_start_set(grad, 0, 0);
+        efl_gfx_gradient_linear_end_set(grad, VG_W, VG_H);
+        efl_gfx_gradient_stop_set(grad, rainbow_stops, 5);
+
+        rect_shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, source_container);
+        efl_gfx_path_append_rect(rect_shape, 0, 0, VG_W, VG_H, 0, 0);
+        efl_canvas_vg_shape_fill_set(rect_shape, grad);
+
+        mask_container = efl_add(EFL_CANVAS_VG_CONTAINER_CLASS, root);
+
+        batman_shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, mask_container);
+        efl_canvas_vg_node_origin_set(batman_shape, STROKE_M, STROKE_M);
+        efl_gfx_path_append_svg_path(batman_shape, batman_path);
+        efl_gfx_color_set(batman_shape, 255, 255, 255, 255);
+
+        /* Cycle through all 6 composite methods across the objects. */
+        efl_canvas_vg_node_comp_method_set(source_container, mask_container,
+                                            comp_methods[i % 6]);
+
+        efl_canvas_vg_object_root_node_set(vector, root);
+     }
+   done = 0;
+}
+
+/* cleanup */
+static void _cleanup(void)
+{
+   unsigned int i;
+
+   for (i = 0; i < OBNUM; i++) efl_del(o_shapes[i]);
+}
+
+/* loop - do things */
+static void _loop(double t, int f)
+{
+   int i;
+   Evas_Coord x, y, w = 200, h = 200;
+
+   for (i = 0; i < OBNUM; i++)
+     {
+        x = (win_w / 2) - (w / 2);
+        x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
+        y = (win_h / 2) - (h / 2);
+        y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (w / 2);
+        efl_gfx_entity_position_set(o_shapes[i], EINA_POSITION2D(x, y));
+     }
+   FPS_STD(NAME);
+}
+
+/* prepend special key handlers if interactive (before STD) */
+static void _key(const char *key)
+{
+   KEY_STD;
+}
+
+/* template stuff - ignore */
+# endif
+#endif
+
+#ifdef UI
+_ui_menu_item_add(ICON, NAME, FNAME);
+#endif
+
+#ifdef PROTO
+void FNAME(void);
+#endif
+
+#ifndef PROTO
+# ifndef UI
+void FNAME(void)
+{
+   ui_func_set(_key, _loop, _setup);
+}
+# endif
+#endif
+#undef FNAME
+#undef NAME
+#undef ICON

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to