Mercurial > MadButterfly
changeset 7:569f3168ba53
Clear background & tranform relative pos into absolute ones
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sat, 26 Jul 2008 02:53:08 +0800 |
parents | 772511b8b9be |
children | 94b4b5bd8810 |
files | src/X_main.c src/shape_path.c |
diffstat | 2 files changed, 20 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/X_main.c Sat Jul 26 02:41:00 2008 +0800 +++ b/src/X_main.c Sat Jul 26 02:53:08 2008 +0800 @@ -15,8 +15,9 @@ memset(coord.aggr_matrix, 0, sizeof(co_aix) * 6); coord.aggr_matrix[0] = 1; coord.aggr_matrix[1] = 0.5; + coord.aggr_matrix[2] = -30; coord.aggr_matrix[4] = 1; - coord.aggr_matrix[5] = 0; + coord.aggr_matrix[5] = -20; sh_path_transform(path, &coord); sh_path_draw(path, cr); } @@ -25,6 +26,8 @@ cairo_t *cr; cr = cairo_create(surface); + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_paint(cr); 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);
--- a/src/shape_path.c Sat Jul 26 02:41:00 2008 +0800 +++ b/src/shape_path.c Sat Jul 26 02:53:08 2008 +0800 @@ -178,6 +178,7 @@ static int sh_path_cmd_arg_fill(char *data, sh_path_t *path) { char *p, *old; char *cmds; + char cmd; co_aix *args; cmds = path->user_data; @@ -186,9 +187,9 @@ while(*p) { SKIP_SPACE(p); - /* TODO: transform all relative to absolute, */ - *cmds++ = *p; - switch(*p++) { + /* Transform all relative to absolute, */ + *cmds++ = toupper(*p); + switch((cmd = *p++)) { case 'c': case 'C': while(*p) { @@ -198,41 +199,41 @@ SKIP_NUM(p); if(p == old) break; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); } break; case 's': @@ -246,28 +247,28 @@ SKIP_NUM(p); if(p == old) break; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); } break; case 'm': @@ -283,14 +284,14 @@ SKIP_NUM(p); if(p == old) break; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); } break; case 'h':