]> O.S.I.I.S - jp/vkvg.git/commitdiff
svg #subid rendering test
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 12 Jan 2022 21:20:09 +0000 (22:20 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 12 Jan 2022 21:20:09 +0000 (22:20 +0100)
tests/data/checkbox.svg [new file with mode: 0644]
tests/svg.c

diff --git a/tests/data/checkbox.svg b/tests/data/checkbox.svg
new file mode 100644 (file)
index 0000000..6b6914a
--- /dev/null
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   version="1.1"
+   id="svg2"
+   viewBox="0 0 64 64"
+   height="64"
+   width="64">
+  <defs
+     id="defs4" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="False">
+    <rect
+       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3.38882232;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="background-0"
+       width="50.832325"
+       height="50.832325"
+       x="7.1542463"
+       y="10.990663" />
+  </g>
+  <g
+     id="True">
+    <rect
+       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3.38882232;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="background"
+       width="50.832333"
+       height="50.832333"
+       x="7.1542463"
+       y="10.990663" />
+    <path
+       style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.99999988;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+       d="m 31.716712,35.071243 c 0,0 -6.596639,-15.24725 -21.446849,-19.472822 C 28.252789,42.42005 32.673128,59.741754 32.673128,59.741754 42.630927,26.54013 47.25986,13.972168 62.050847,1.147331 42.892384,10.522281 37.883684,17.76245 31.716712,35.071243 Z"
+       id="checkmark" />
+  </g>
+</svg>
index 82adf4f2774f1cbffddc8e98d15509032ad8c162..6522e6aae9e1f65b37a6eadc876fd53050ce8adc 100644 (file)
@@ -4,6 +4,8 @@
 
 static float rotation = 0.f;
 static const char* path = "data/tiger.svg";
+static const char* svgSubPath = "data/checkbox.svg";
+
 
 void svg_surface() {
        VkvgSurface svgSurf = vkvg_surface_create_from_svg (device, test_width, test_height, path);
@@ -31,11 +33,26 @@ void vkvg_svg () {
        vkvg_destroy(ctx);
        vkvg_svg_destroy (svg);
 }
+void vkvg_svg_sub () {
+       VkvgSvg svg = vkvg_svg_load (svgSubPath);
+       uint32_t w, h;
+       vkvg_svg_get_dimensions(svg, &w, &h);
+       VkvgContext ctx = _initCtx(surf);
+       vkvg_clear(ctx);
+
+       vkvg_svg_render (svg, ctx, "True");
+       vkvg_translate(ctx, 200, 0);
+       vkvg_svg_render (svg, ctx, "False");
+
+       vkvg_destroy(ctx);
+       vkvg_svg_destroy (svg);
+}
 
 int main(int argc, char *argv[]) {
        no_test_size = true;
 
        PERFORM_TEST (svg_surface, argc, argv);
        PERFORM_TEST (vkvg_svg, argc, argv);
+       PERFORM_TEST (vkvg_svg_sub, argc, argv);
        return 0;
 }