From 341363997ad59cf1d6c77635a88705bcf660f158 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Mon, 16 Jun 2003 15:49:12 +0000 Subject: Added a syntax describing the center and angle for conical gradients. --- generic/Color.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'generic') diff --git a/generic/Color.c b/generic/Color.c index ed2d17f..4863b52 100644 --- a/generic/Color.c +++ b/generic/Color.c @@ -889,15 +889,8 @@ ZnGetGradient(Tcl_Interp *interp, next_ptr = strchr(scan_ptr, '|'); if (*scan_ptr == '=') { scan_ptr++; - if (((*scan_ptr == 'a') && (strncmp(scan_ptr, "axial", 5) == 0)) || - ((*scan_ptr == 'c') && (strncmp(scan_ptr, "conical", 7) == 0))) { - if (*scan_ptr == 'a') { - scan_ptr += 5; - } - else { - scan_ptr += 7; - type = ZN_CONICAL_GRADIENT; - } + if ((*scan_ptr == 'a') && (strncmp(scan_ptr, "axial", 5) == 0)) { + scan_ptr += 5; num_coords = ParseRealList(scan_ptr, next_ptr, coords, 4); if ((num_coords != 1) && (num_coords != 4)) { grad_err3: @@ -905,7 +898,16 @@ ZnGetGradient(Tcl_Interp *interp, desc, "\",", NULL); goto grad_err1; } - angle = (init) coords[0]; + angle = (int) coords[0]; + } + else if ((*scan_ptr == 'c') && (strncmp(scan_ptr, "conical", 7) == 0)) { + scan_ptr += 7; + type = ZN_CONICAL_GRADIENT; + num_coords = ParseRealList(scan_ptr, next_ptr, coords, 4); + if ((num_coords != 1) && (num_coords != 3) && (num_coords != 4)) { + goto grad_err3; + } + angle = (int) coords[0]; } else if (((*scan_ptr == 'r') && (strncmp(scan_ptr, "radial", 6) == 0)) || ((*scan_ptr == 'p') && (strncmp(scan_ptr, "path", 4) == 0))) { @@ -950,6 +952,11 @@ ZnGetGradient(Tcl_Interp *interp, grad->e.x = coords[2]; grad->e.y = coords[3]; } + else if ((type == ZN_CONICAL_GRADIENT) && (num_coords == 3)) { + grad->p.x = coords[0]; + grad->p.y = coords[1]; + grad->angle = (int) coords[2]; + } else { grad->angle = (int) angle; } -- cgit v1.1