Mercurial > MadButterfly
changeset 6:772511b8b9be
Cairo specify RGB values in range 0.0 ~ 1.0.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sat, 26 Jul 2008 02:41:00 +0800 |
parents | 9c331ec9e210 |
children | 569f3168ba53 |
files | src/X_main.c src/shape_path.c |
diffstat | 2 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/X_main.c Sat Jul 26 01:37:35 2008 +0800 +++ b/src/X_main.c Sat Jul 26 02:41:00 2008 +0800 @@ -1,6 +1,7 @@ #include <stdio.h> #include <unistd.h> #include <X11/Xlib.h> +#include <X11/Xutil.h> #include <cairo.h> #include <string.h> @@ -15,7 +16,7 @@ coord.aggr_matrix[0] = 1; coord.aggr_matrix[1] = 0.5; coord.aggr_matrix[4] = 1; - coord.aggr_matrix[5] = 0.5; + coord.aggr_matrix[5] = 0; sh_path_transform(path, &coord); sh_path_draw(path, cr); } @@ -24,12 +25,13 @@ cairo_t *cr; cr = cairo_create(surface); - cairo_set_source_rgb(cr, 0xff, 0xff, 0x80); + cairo_set_source_rgb(cr, 0.9, 0.1, 0.1); draw_path(cr, w, h); + cairo_set_source_rgb(cr, 0.5, 0.9, 0.8); 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"); - cairo_set_line_width(cr, 1); + cairo_set_line_width(cr, 2); cairo_stroke(cr); }
--- a/src/shape_path.c Sat Jul 26 01:37:35 2008 +0800 +++ b/src/shape_path.c Sat Jul 26 02:41:00 2008 +0800 @@ -186,6 +186,7 @@ while(*p) { SKIP_SPACE(p); + /* TODO: transform all relative to absolute, */ *cmds++ = *p; switch(*p++) { case 'c': @@ -486,6 +487,8 @@ break; } } + + cairo_fill(cr); } #ifdef UNITTEST