aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlecoanet2003-10-02 12:29:44 +0000
committerlecoanet2003-10-02 12:29:44 +0000
commitd98a6e6123e7510aebd0debd08a0c2f3882bd27b (patch)
tree79f9611488e6e9b67edd05bb08c895eeac43a5f8
parentf3f42dd59ad0c3283effef189e2b105607fb1efd (diff)
downloadtkzinc-d98a6e6123e7510aebd0debd08a0c2f3882bd27b.zip
tkzinc-d98a6e6123e7510aebd0debd08a0c2f3882bd27b.tar.gz
tkzinc-d98a6e6123e7510aebd0debd08a0c2f3882bd27b.tar.bz2
tkzinc-d98a6e6123e7510aebd0debd08a0c2f3882bd27b.tar.xz
Changed the CONICAL gradient parameters. If only one value is given
it is taken for the gradient starting angle, the center being 0,0. If two values are given, they are taken as the gradient center, the starting angle being 0. If three values are given they are the gradient center followed by the gradient starting angle. If four values are given, they are two points defining the center and the angle/extent of the gradient (vector based definition).
-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];