]> O.S.I.I.S - jp/vkvg.git/commitdiff
debug curve test
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 22 Nov 2019 04:18:05 +0000 (05:18 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 22 Nov 2019 04:18:05 +0000 (05:18 +0100)
README.md
tests/curve.c
tests/curved_rect.c [new file with mode: 0644]
tests/fillnstroke.c [new file with mode: 0644]

index 2144d2c6bd7e49806a31ba238dc294f3a92d53c3..88e8980bd3877997eb864b5190af4cf716c9c572 100644 (file)
--- a/README.md
+++ b/README.md
@@ -48,10 +48,9 @@ For API documentation and usage, please refer to the [Cairo](https://www.cairogr
 
 ### Performances:
 
-Resolution  = 512 x 512
-Tiling = Optimal
+Resolution  = 512 x 512
+Tiling = Optimal
 
---------------------------------------------------------------------------------------------
 | Test Name       |    Library      |   Min    |   Max    |  Average |  Median  | Std Deriv|
 |-----------------|-----------------|----------|----------|----------|----------|----------|
 | lines stroke    | vkvg            | 0.000585 | 0.007052 | 0.001050 | 0.000711 | 0.000924 |
@@ -70,7 +69,6 @@ Tiling = Optimal
 |                 | cairo xcb       | 0.011476 | 0.019959 | 0.015441 | 0.015245 | 0.001388 |
 |                 | cairo es3       | 0.009518 | 0.026849 | 0.010171 | 0.009951 | 0.001730 |
 |                 | skia            | 0.020135 | 0.046562 | 0.023530 | 0.023253 | 0.002584 |
---------------------------------------------------------------------------------------------
 
 ### Requirements:
 
index 38c4620639ef23cd3e4f0f5454113d61f4395915..dd3d4b5207ab1bb901e89694b2559b4da36352aa 100644 (file)
@@ -38,8 +38,7 @@ void test(){
     //vkvg_stroke(ctx);
 
     vkvg_set_source_rgba   (ctx, 0.5,0.0,1.0,0.5);
-    vkvg_move_to(ctx,100,100);
-    vkvg_line_to(ctx,200,100);
+    vkvg_move_to(ctx,200,100);
     vkvg_curve_to(ctx,250,100,300,150,300,200);
     vkvg_line_to(ctx,300,300);
     vkvg_curve_to(ctx,300,350,250,400,200,400);
diff --git a/tests/curved_rect.c b/tests/curved_rect.c
new file mode 100644 (file)
index 0000000..e7363d5
--- /dev/null
@@ -0,0 +1,39 @@
+#include "test.h"
+
+void test(){
+    VkvgContext ctx = vkvg_create(surf);
+
+    float x = 50, y = 50, width = 150, height = 140, radius = 30;
+
+    vkvg_scale(ctx,2,2);
+
+    vkvg_set_line_width(ctx,15);
+    vkvg_set_source_rgba(ctx, 0, 0.5f, 0.4f, 1);
+
+
+    if ((radius > height / 2) || (radius > width / 2))
+        radius = MIN(height / 2, width / 2);
+
+    vkvg_move_to(ctx, x, y + radius);
+    //vkvg_arc(ctx, x + radius, y + radius, radius, M_PIF, (float)-M_PI_2);
+    vkvg_line_to(ctx, x + width - radius, y);
+    //vkvg_arc(ctx, x + width - radius, y + radius, radius, (float)-M_PI_2, 0);
+    /*vkvg_line_to(ctx, x + width, y + height - radius);
+    vkvg_arc(ctx, x + width - radius, y + height - radius, radius, 0, (float)M_PI_2);
+    vkvg_line_to(ctx, x + radius, y + height);
+    vkvg_arc(ctx, x + radius, y + height - radius, radius, (float)M_PI_2, M_PIF);
+    vkvg_line_to(ctx, x, y + radius);
+    vkvg_close_path(ctx);
+    vkvg_fill_preserve(ctx);*/
+    vkvg_set_source_rgba(ctx,0.5,0,0,0.5);
+    vkvg_stroke(ctx);
+
+    vkvg_destroy(ctx);
+}
+
+int main(int argc, char *argv[]) {
+
+    perform_test (test, 1024, 768);
+
+    return 0;
+}
diff --git a/tests/fillnstroke.c b/tests/fillnstroke.c
new file mode 100644 (file)
index 0000000..7d35b29
--- /dev/null
@@ -0,0 +1,40 @@
+#include "test.h"
+
+void test(){
+    VkvgContext ctx = vkvg_create(surf);
+
+    float x = 50, y = 150, dx = 150, dy = 140;
+
+    vkvg_scale(ctx,2,2);
+
+    vkvg_set_line_width(ctx,40);
+    vkvg_set_source_rgba(ctx,0,1,0,1);
+
+
+    vkvg_set_line_join(ctx,VKVG_LINE_JOIN_ROUND);
+    //vkvg_rectangle(ctx,x,y,dx,dy);
+
+
+    vkvg_move_to(ctx,x,y);
+    vkvg_rel_line_to(ctx,50,-30);
+    vkvg_rel_line_to(ctx,50,0);
+    vkvg_rel_line_to(ctx,50,30);
+    vkvg_rel_line_to(ctx,0,60);
+    vkvg_rel_line_to(ctx,-50,70);
+    vkvg_rel_line_to(ctx,-50,0);
+    vkvg_rel_line_to(ctx,-50,-70);
+    vkvg_line_to(ctx,x,y);
+    //vkvg_close_path(ctx);
+    vkvg_fill_preserve(ctx);
+    vkvg_set_source_rgba(ctx,0.5,0,0,0.5);
+    vkvg_stroke(ctx);
+
+    vkvg_destroy(ctx);
+}
+
+int main(int argc, char *argv[]) {
+
+    perform_test (test, 1024, 768);
+
+    return 0;
+}