aboutsummaryrefslogtreecommitdiff
path: root/generic/Color.c
diff options
context:
space:
mode:
authorlecoanet2003-06-16 15:49:12 +0000
committerlecoanet2003-06-16 15:49:12 +0000
commit341363997ad59cf1d6c77635a88705bcf660f158 (patch)
tree35b3e8a83651a1f3e8157480ec49520e633e97c7 /generic/Color.c
parent0f1ada579542a19b65c64ad6b34e20c685c6560d (diff)
downloadtkzinc-341363997ad59cf1d6c77635a88705bcf660f158.zip
tkzinc-341363997ad59cf1d6c77635a88705bcf660f158.tar.gz
tkzinc-341363997ad59cf1d6c77635a88705bcf660f158.tar.bz2
tkzinc-341363997ad59cf1d6c77635a88705bcf660f158.tar.xz
Added a syntax describing the center and angle for conical
gradients.
Diffstat (limited to 'generic/Color.c')
-rw-r--r--generic/Color.c27
1 files changed, 17 insertions, 10 deletions
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;
}