From 16796950056756918d2a106206af3177c941809f Mon Sep 17 00:00:00 2001 From: lecoanet Date: Mon, 16 Jun 2003 14:56:43 +0000 Subject: Changes in the structure to match the vector syntax and the new gradient type. --- generic/Color.h | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/generic/Color.h b/generic/Color.h index f0f2369..16c0ca2 100644 --- a/generic/Color.h +++ b/generic/Color.h @@ -41,6 +41,7 @@ #define ZN_AXIAL_GRADIENT 0 #define ZN_RADIAL_GRADIENT 1 #define ZN_PATH_GRADIENT 2 +#define ZN_CONICAL_GRADIENT 3 typedef struct _ZnGradientColor { unsigned char position; /* Color starting position along the gradient axis. @@ -58,26 +59,32 @@ typedef struct _ZnGradient { Tcl_HashEntry *hash; char type; /* Either ZN_AXIAL_GRADIENT, ZN_RADIAL_GRADIENT or * ZN_PATH_GRADIENT. */ - ZnBool simple; /* Angle is used for axial gradients, end is not - * specified for paths/radials. */ - union { - int angle; /* Angle spec for an axial gradient (Degrees). */ - ZnPoint p; /* Start for an axial/radial/path gradiant. */ - } g; - ZnPoint e; /* End of the gradiant. */ - unsigned int num_colors; /* Number of colors in gradient spec. */ - ZnGradientColor colors[1]; + int angle; /* Angle for an axial gradient (Degrees). */ + ZnPoint p; /* Start for an axial/radial/path gradiant. In + * percent of the bbox. */ + ZnPoint e; /* End of the axial/radial gradiant in percent + * of bbox. */ + unsigned int num_actual_colors;/* Number of adjusted colors */ + ZnGradientColor *actual_colors;/* Actual adjusted gradient color spec. May + * be the same array as color_spec. */ + unsigned int num_colors_in; /* Number of colors in gradient spec. */ + ZnGradientColor colors_in[1]; /* Gradient color spec */ } ZnGradient; +#define ZnGetGradientPixel(gradient, position) \ + ZnPixel(ZnGetGradientColor(gradient, position, NULL)) + ZnGradient *ZnGetGradient(Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name); ZnGradient *ZnGetGradientByValue(ZnGradient *gradient); ZnGradient *ZnGetReliefGradient(Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name, unsigned short alpha); ZnBool ZnGradientFlat(ZnGradient *grad); -XColor *ZnGetGradientColor(ZnGradient *gradient, - ZnReal position, unsigned short *alpha); +XColor *ZnGetGradientColor(ZnGradient *gradient, ZnReal position, + unsigned short *alpha); +void ZnInterpGradientColor(ZnGradient *gradient, ZnReal position, + XColor *color, unsigned short *alpha); char *ZnNameOfGradient(ZnGradient *gradient); void ZnFreeGradient(ZnGradient *gradient); void ZnDeleteGradientName(char *name); -- cgit v1.1