diff src/X_main.c @ 5:9c331ec9e210

SVG path is partially supported
author Thinker K.F. Li <thinker@branda.to>
date Sat, 26 Jul 2008 01:37:35 +0800
parents 164162781a7a
children 772511b8b9be
line wrap: on
line diff
--- a/src/X_main.c	Fri Jul 25 11:42:37 2008 +0800
+++ b/src/X_main.c	Sat Jul 26 01:37:35 2008 +0800
@@ -3,11 +3,29 @@
 #include <X11/Xlib.h>
 #include <cairo.h>
 
+#include <string.h>
+#include "shapes.h"
+
+void draw_path(cairo_t *cr, int w, int h) {
+    shape_t *path;
+    coord_t coord;
+
+    path = sh_path_new("M80 80 c 20 5 -30 20 10 30 l -30 0 z");
+    memset(coord.aggr_matrix, 0, sizeof(co_aix) * 6);
+    coord.aggr_matrix[0] = 1;
+    coord.aggr_matrix[1] = 0.5;
+    coord.aggr_matrix[4] = 1;
+    coord.aggr_matrix[5] = 0.5;
+    sh_path_transform(path, &coord);
+    sh_path_draw(path, cr);
+}
+
 void drawing(cairo_surface_t *surface, int w, int h) {
     cairo_t *cr;
 
     cr = cairo_create(surface);
     cairo_set_source_rgb(cr, 0xff, 0xff, 0x80);
+    draw_path(cr, w, h);
     cairo_move_to(cr, 10, h / 2);
     cairo_set_font_size(cr, 48.0);
     cairo_text_path(cr, "hello \xe4\xb8\xad\xe6\x96\x87");