--- /dev/null
+#include "test.h"
+
+void test(){
+ vkvg_surface_clear(surf);
+ struct timeval currentTime;
+ gettimeofday(¤tTime, NULL);
+
+ srand((unsigned) currentTime.tv_usec);
+ const float w = 1024.f;
+ const float h = 800.f;
+
+ VkvgContext ctx = vkvg_create(surf);
+ //vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD);
+ vkvg_set_line_width(ctx,20);
+ //vkvg_set_line_join(ctx,VKVG_LINE_JOIN_BEVEL);
+
+ for (int i=0; i<250; i++) {
+ randomize_color(ctx);
+ float x1 = trunc( ((float)w*rand())/RAND_MAX );
+ float y1 = trunc( ((float)h*rand())/RAND_MAX );
+ float v = trunc( ((float)500*rand())/RAND_MAX );
+
+ vkvg_move_to (ctx, x1, y1);
+ vkvg_line_to (ctx, x1 + v, y1);
+ vkvg_stroke (ctx);
+ }
+ vkvg_destroy(ctx);
+}
+
+int main(int argc, char *argv[]) {
+
+ perform_test (test, 1024, 768);
+
+ return 0;
+}
--- /dev/null
+#include "test.h"
+
+void test(){
+ vkvg_surface_clear(surf);
+ struct timeval currentTime;
+ gettimeofday(¤tTime, NULL);
+
+ srand((unsigned) currentTime.tv_usec);
+ const float w = 1024.f;
+ const float h = 800.f;
+
+ VkvgContext ctx = vkvg_create(surf);
+ //vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD);
+ vkvg_set_line_width(ctx,2);
+ //vkvg_set_line_join(ctx,VKVG_LINE_JOIN_BEVEL);
+ vkvg_set_source_rgba(ctx,1.0,0.0,0.0,0.1);
+
+ for (int i=0; i<250; i++) {
+ randomize_color(ctx);
+ float x1 = trunc( ((float)w*rand())/RAND_MAX );
+ float y1 = trunc( ((float)h*rand())/RAND_MAX );
+ float x2 = trunc( ((float)w*rand())/RAND_MAX ) + 1;
+ float y2 = trunc( ((float)h*rand())/RAND_MAX ) + 1;
+
+ vkvg_move_to (ctx, x1, y1);
+ vkvg_line_to (ctx, x2, y2);
+ vkvg_stroke (ctx);
+ }
+ vkvg_destroy(ctx);
+}
+
+int main(int argc, char *argv[]) {
+
+ perform_test (test, 1024, 768);
+
+ return 0;
+}
--- /dev/null
+#include "test.h"
+
+void test(){
+ vkvg_surface_clear(surf);
+ struct timeval currentTime;
+ gettimeofday(¤tTime, NULL);
+
+ srand((unsigned) currentTime.tv_usec);
+ const float w = 1024.f;
+ const float h = 800.f;
+
+ VkvgContext ctx = vkvg_create(surf);
+ //vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD);
+ vkvg_set_line_width(ctx,2);
+ //vkvg_set_line_join(ctx,VKVG_LINE_JOIN_BEVEL);
+ vkvg_set_source_rgba(ctx,1.0,0.0,0.0,0.1);
+
+ for (int i=0; i<250; i++) {
+ randomize_color(ctx);
+ float x1 = trunc( ((float)w*rand())/RAND_MAX );
+ float y1 = trunc( ((float)h*rand())/RAND_MAX );
+ float x2 = trunc( ((float)w*rand())/RAND_MAX ) + 1;
+ float y2 = trunc( ((float)h*rand())/RAND_MAX ) + 1;
+
+ vkvg_move_to (ctx, x1, y1);
+ vkvg_line_to (ctx, x2, y2);
+ vkvg_stroke (ctx);
+ }
+ vkvg_destroy(ctx);
+}
+
+int main(int argc, char *argv[]) {
+
+ perform_test (test, 1024, 768);
+
+ return 0;
+}
#include "test.h"
void test(){
- //vkvg_surface_clear(surf);
+ vkvg_surface_clear(surf);
struct timeval currentTime;
gettimeofday(¤tTime, NULL);
const float w = 1024.f;
VkvgContext ctx = vkvg_create(surf);
- vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_NON_ZERO);
+ vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD);
vkvg_set_line_width(ctx,2);
+ //vkvg_set_line_join(ctx,VKVG_LINE_JOIN_BEVEL);
vkvg_set_source_rgba(ctx,1.0,0.0,0.0,0.1);
- for (int i=0; i<500; i++) {
+ for (int i=0; i<250; i++) {
randomize_color(ctx);
float x = trunc( (0.5*(float)w*rand())/RAND_MAX );
float y = trunc( (0.5*(float)w*rand())/RAND_MAX );
float v = trunc( (0.5*(float)w*rand())/RAND_MAX ) + 1;
vkvg_rectangle(ctx, x+1, y+1, z, v);
- vkvg_fill_preserve(ctx);
- randomize_color(ctx);
+ /*vkvg_fill_preserve(ctx);
+ randomize_color(ctx);*/
+ vkvg_fill(ctx);
vkvg_stroke(ctx);
}
vkvg_destroy(ctx);
#include "test.h"
void test(){
+ vkvg_matrix_t mat;
+ vkvg_matrix_init_identity(&mat);
+ vkvg_matrix_scale(&mat,zoom,zoom);
+ vkvg_matrix_translate(&mat, panX, panY);
+
vkvg_surface_clear(surf);
+
VkvgContext ctx = vkvg_create(surf);
+ vkvg_set_source_rgba(ctx,1.0f,1.0f,1.0f,1);
+ vkvg_paint(ctx);
+
+ vkvg_set_matrix(ctx,&mat);
+
vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD);
vkvg_set_line_width(ctx,10);
- vkvg_set_source_rgba(ctx,0,0,1,0.5);
+ vkvg_set_source_rgba(ctx,0,0,1,1);
vkvg_rectangle(ctx,100,100,200,200);
- vkvg_fill(ctx);
+ /*vkvg_fill(ctx);
vkvg_rectangle(ctx,200,200,200,200);
- vkvg_set_source_rgba(ctx,1,0,0,0.5);
+ vkvg_set_source_rgba(ctx,1,0,0,0.5);*/
vkvg_fill(ctx);
vkvg_destroy(ctx);
}*/
static float rotation = 0.f;
-static const char* path = "data/tiger.svg";
+//static const char* path = "data/tiger.svg";
//static const char* path = "data/vkvg.svg";
-//static const char* path = "data/testPiece.svg";
+static const char* path = "data/testPiece.svg";
void test_svg_surface() {
VkvgSurface svgSurf = vkvg_surface_create_from_svg(device, path);
vkvg_paint(ctx);
vkvg_scale(ctx,1.0f,1.0f);
- //vkvg_render_svg(ctx, svg, "br0");
+ //vkvg_render_svg(ctx, svg, "wq");
vkvg_render_svg(ctx, svg, NULL);
vkvg_destroy(ctx);
--- /dev/null
+#include "test.h"
+
+void test(){
+ vkvg_surface_clear(surf);
+ struct timeval currentTime;
+ gettimeofday(¤tTime, NULL);
+
+ srand((unsigned) currentTime.tv_usec);
+ const float w = 1024.f;
+ const float h = 800.f;
+
+ VkvgContext ctx = vkvg_create(surf);
+ //vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD);
+ vkvg_set_line_width(ctx,1);
+ //vkvg_set_line_join(ctx,VKVG_LINE_JOIN_BEVEL);
+ //vkvg_set_source_rgba(ctx,1.0,0.0,0.0,0.1);
+
+ for (int i=0; i<250; i++) {
+ randomize_color(ctx);
+ float x1 = trunc( ((float)w*rand())/RAND_MAX );
+ float y1 = trunc( ((float)h*rand())/RAND_MAX );
+ float v = trunc( ((float)500*rand())/RAND_MAX ) + 1;
+
+ vkvg_move_to (ctx, x1, y1);
+ vkvg_line_to (ctx, x1, y1 + v);
+ vkvg_stroke (ctx);
+ }
+ vkvg_destroy(ctx);
+}
+
+int main(int argc, char *argv[]) {
+
+ perform_test (test, 1024, 768);
+
+ return 0;
+}