aboutsummaryrefslogtreecommitdiff
path: root/generic/Color.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/Color.c')
-rw-r--r--generic/Color.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/generic/Color.c b/generic/Color.c
index 4863b52..a395fa1 100644
--- a/generic/Color.c
+++ b/generic/Color.c
@@ -904,7 +904,7 @@ ZnGetGradient(Tcl_Interp *interp,
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)) {
+ if ((num_coords < 1) && (num_coords > 4)) {
goto grad_err3;
}
angle = (int) coords[0];
@@ -941,8 +941,22 @@ ZnGetGradient(Tcl_Interp *interp,
simple = True;
grad->num_colors_in = num_colors;
grad->type = type;
+ grad->p.x = grad->p.y = grad->e.x = grad->e.y = 0.0;
+
switch (type) {
case ZN_AXIAL_GRADIENT:
+ if ((num_coords == 4) &&
+ ((coords[0] != coords[2]) || (coords[1] != coords[3]))) {
+ grad->p.x = coords[0];
+ grad->p.y = coords[1];
+ simple = False;
+ grad->e.x = coords[2];
+ grad->e.y = coords[3];
+ }
+ else {
+ grad->angle = (int) angle;
+ }
+ break;
case ZN_CONICAL_GRADIENT:
if ((num_coords == 4) &&
((coords[0] != coords[2]) || (coords[1] != coords[3]))) {
@@ -952,7 +966,12 @@ ZnGetGradient(Tcl_Interp *interp,
grad->e.x = coords[2];
grad->e.y = coords[3];
}
- else if ((type == ZN_CONICAL_GRADIENT) && (num_coords == 3)) {
+ else if (num_coords == 2) {
+ grad->p.x = coords[0];
+ grad->p.y = coords[1];
+ grad->angle = 0;
+ }
+ else if (num_coords == 3) {
grad->p.x = coords[0];
grad->p.y = coords[1];
grad->angle = (int) coords[2];