diff options
Diffstat (limited to 'generic/Color.c')
-rw-r--r-- | generic/Color.c | 424 |
1 files changed, 212 insertions, 212 deletions
diff --git a/generic/Color.c b/generic/Color.c index 236b6db..53f798b 100644 --- a/generic/Color.c +++ b/generic/Color.c @@ -1,8 +1,8 @@ /* * Color.c -- Color management module. * - * Authors : Patrick Lecoanet. - * Creation date : Thu Dec 16 15:41:53 1999 + * Authors : Patrick Lecoanet. + * Creation date : Thu Dec 16 15:41:53 1999 * * $Id$ */ @@ -62,8 +62,8 @@ */ static Tcl_HashTable gradient_table; -static int initialized = 0; /* 0 means static structures haven't been - * initialized yet. */ +static int initialized = 0; /* 0 means static structures haven't been + * initialized yet. */ /* @@ -71,13 +71,13 @@ static int initialized = 0; /* 0 means static structures haven't been * * ColorInit -- * - * Initialize the structure used for color management. + * Initialize the structure used for color management. * * Results: - * None. + * None. * * Side effects: - * Read the code. + * Read the code. * *---------------------------------------------------------------------- */ @@ -98,11 +98,11 @@ ColorInit() *---------------------------------------------------------------------- */ XColor * -ZnGetGradientColor(ZnGradient *grad, - ZnReal position, - unsigned short *alpha) +ZnGetGradientColor(ZnGradient *grad, + ZnReal position, + unsigned short *alpha) { - int index, min, max; + int index, min, max; XColor *shade=NULL; if ((grad->num_actual_colors == 1) || (position <= 0.0)) { @@ -124,10 +124,10 @@ ZnGetGradientColor(ZnGradient *grad, while (max - min != 1) { /*printf("color index %d, min: %d, max: %d\n", index, min, max);*/ if (grad->actual_colors[index].position < position) { - min = index; + min = index; } else { - max = index; + max = index; } index = (max + min) / 2; } @@ -142,9 +142,9 @@ ZnGetGradientColor(ZnGradient *grad, void ZnInterpGradientColor(ZnGradient *grad, - ZnReal position, - XColor *color, - unsigned short *alpha) + ZnReal position, + XColor *color, + unsigned short *alpha) { int index, min, max; ZnGradientColor *gc1, *gc2; @@ -165,10 +165,10 @@ ZnInterpGradientColor(ZnGradient *grad, while (max - min != 1) { /*printf("color index %d, min: %d, max: %d\n", index, min, max);*/ if (grad->actual_colors[index].position < position) { - min = index; + min = index; } else { - max = index; + max = index; } index = (max + min) / 2; } @@ -179,24 +179,24 @@ ZnInterpGradientColor(ZnGradient *grad, if (rel_pos > gc1->control) { rel_pos = (rel_pos - gc1->control) * 100.0 / (100.0 - gc1->control); color->red = gc1->mid_rgb->red + - (unsigned short) ((gc2->rgb->red - gc1->mid_rgb->red) * rel_pos / 100.0); + (unsigned short) ((gc2->rgb->red - gc1->mid_rgb->red) * rel_pos / 100.0); color->green = gc1->mid_rgb->green + - (unsigned short) ((gc2->rgb->green - gc1->mid_rgb->green) * rel_pos / 100.0); + (unsigned short) ((gc2->rgb->green - gc1->mid_rgb->green) * rel_pos / 100.0); color->blue = gc1->mid_rgb->blue + - (unsigned short) ((gc2->rgb->blue - gc1->mid_rgb->blue) * rel_pos / 100.0); + (unsigned short) ((gc2->rgb->blue - gc1->mid_rgb->blue) * rel_pos / 100.0); *alpha = gc1->mid_alpha + - (unsigned short) ((gc2->alpha - gc1->mid_alpha) * rel_pos / 100.0); + (unsigned short) ((gc2->alpha - gc1->mid_alpha) * rel_pos / 100.0); } else { rel_pos = rel_pos * 100.0 / gc1->control; color->red = gc1->rgb->red + - (unsigned short) ((gc1->mid_rgb->red - gc1->rgb->red) * rel_pos / 100.0); + (unsigned short) ((gc1->mid_rgb->red - gc1->rgb->red) * rel_pos / 100.0); color->green = gc1->rgb->green + - (unsigned short) ((gc1->mid_rgb->green - gc1->rgb->green) * rel_pos / 100.0); + (unsigned short) ((gc1->mid_rgb->green - gc1->rgb->green) * rel_pos / 100.0); color->blue = gc1->rgb->blue + - (unsigned short) ((gc1->mid_rgb->blue - gc1->rgb->blue) * rel_pos / 100.0); + (unsigned short) ((gc1->mid_rgb->blue - gc1->rgb->blue) * rel_pos / 100.0); *alpha = gc1->alpha + - (unsigned short) ((gc1->mid_alpha - gc1->alpha) * rel_pos / 100.0); + (unsigned short) ((gc1->mid_alpha - gc1->alpha) * rel_pos / 100.0); } } } @@ -207,13 +207,13 @@ ZnInterpGradientColor(ZnGradient *grad, * * ZnGradientFlat -- * - * Returns true if the gradient is defined by a single - * color. + * Returns true if the gradient is defined by a single + * color. * *-------------------------------------------------------------- */ ZnBool -ZnGradientFlat(ZnGradient *grad) +ZnGradientFlat(ZnGradient *grad) { return (grad->num_actual_colors == 1); } @@ -224,38 +224,38 @@ ZnGradientFlat(ZnGradient *grad) * * ZnGetReliefGradient -- * - * Create a data structure containing a range of colors - * used to display a 3D border. Name contains the base - * color for the border. This is a slight variation on - * the syntax of a gradient that make life easier in this - * simple case. + * Create a data structure containing a range of colors + * used to display a 3D border. Name contains the base + * color for the border. This is a slight variation on + * the syntax of a gradient that make life easier in this + * simple case. * * Results: - * The return value is a token for a data structure - * describing a gradient. This token may be passed - * to the drawing routines. - * If an error prevented the gradient from being created - * then NULL is returned and an error message will be - * left in interp. + * The return value is a token for a data structure + * describing a gradient. This token may be passed + * to the drawing routines. + * If an error prevented the gradient from being created + * then NULL is returned and an error message will be + * left in interp. * * Side effects: - * Data structures, etc. are allocated. - * It is the caller's responsibility to eventually call - * ZnFreeGradient to release the resources. + * Data structures, etc. are allocated. + * It is the caller's responsibility to eventually call + * ZnFreeGradient to release the resources. * *-------------------------------------------------------------- */ ZnGradient * -ZnGetReliefGradient(Tcl_Interp *interp, - Tk_Window tkwin, - Tk_Uid name, - unsigned short alpha) +ZnGetReliefGradient(Tcl_Interp *interp, + Tk_Window tkwin, + Tk_Uid name, + unsigned short alpha) { XColor *base, light_color, dark_color, color; - char color_name[COLOR_NAME_SIZE]; - char buffer[COLOR_NAME_SIZE*(3+2*ZN_RELIEF_STEPS)]; - int j, tmp1, tmp2; - int red_range, green_range, blue_range; + char color_name[COLOR_NAME_SIZE]; + char buffer[COLOR_NAME_SIZE*(3+2*ZN_RELIEF_STEPS)]; + int j, tmp1, tmp2; + int red_range, green_range, blue_range; base = Tk_GetColor(interp, tkwin, name); /* @@ -309,7 +309,7 @@ ZnGetReliefGradient(Tcl_Interp *interp, buffer[0] = 0; sprintf(color_name, "#%02x%02x%02x;%d|", - dark_color.red/256, dark_color.green/256, dark_color.blue/256, alpha); + dark_color.red/256, dark_color.green/256, dark_color.blue/256, alpha); red_range = (int) base->red - (int) dark_color.red; green_range = (int) base->green - (int) dark_color.green; blue_range = (int) base->blue - (int) dark_color.blue; @@ -319,11 +319,11 @@ ZnGetReliefGradient(Tcl_Interp *interp, color.green = (int) dark_color.green + green_range * j/ZN_RELIEF_STEPS; color.blue = (int) dark_color.blue + blue_range * j/ZN_RELIEF_STEPS; sprintf(color_name, "#%02x%02x%02x;%d %d|", - color.red/256, color.green/256, color.blue/256, alpha, 50/ZN_RELIEF_STEPS*j); + color.red/256, color.green/256, color.blue/256, alpha, 50/ZN_RELIEF_STEPS*j); strcat(buffer, color_name); } sprintf(color_name, "#%02x%02x%02x;%d 50|", - base->red/256, base->green/256, base->blue/256, alpha); + base->red/256, base->green/256, base->blue/256, alpha); strcat(buffer, color_name); red_range = (int) light_color.red - (int) base->red; green_range = (int) light_color.green - (int) base->green; @@ -333,11 +333,11 @@ ZnGetReliefGradient(Tcl_Interp *interp, color.green = (int) base->green + green_range * j/ZN_RELIEF_STEPS; color.blue = (int) base->blue + blue_range * j/ZN_RELIEF_STEPS; sprintf(color_name, "#%02x%02x%02x;%d %d|", - color.red/256, color.green/256, color.blue/256, alpha, 50+50/ZN_RELIEF_STEPS*j); + color.red/256, color.green/256, color.blue/256, alpha, 50+50/ZN_RELIEF_STEPS*j); strcat(buffer, color_name); } sprintf(color_name, "#%02x%02x%02x;%d", - light_color.red/256, light_color.green/256, light_color.blue/256, alpha); + light_color.red/256, light_color.green/256, light_color.blue/256, alpha); strcat(buffer, color_name); /*printf("gradient relief: %s \n", buffer);*/ @@ -351,22 +351,22 @@ ZnGetReliefGradient(Tcl_Interp *interp, * ZnNameGradient * ZnDeleteGradientName -- * - * Save a gradient under a name or suppress the gradient - * name binding. The save function returns false if the - * name is already in use. + * Save a gradient under a name or suppress the gradient + * name binding. The save function returns false if the + * name is already in use. * *-------------------------------------------------------------- */ ZnBool -ZnNameGradient(Tcl_Interp *interp, - Tk_Window tkwin, - char *grad_descr, - char *name) +ZnNameGradient(Tcl_Interp *interp, + Tk_Window tkwin, + char *grad_descr, + char *name) { - Tcl_HashEntry *hash; - int new; - ZnGradient *grad; - XColor color; + Tcl_HashEntry *hash; + int new; + ZnGradient *grad; + XColor color; /* * First try to find if the name interfere with a color name, @@ -376,20 +376,20 @@ ZnNameGradient(Tcl_Interp *interp, */ if (XParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), name, &color)) { Tcl_AppendResult(interp, "gradient name \"", name, - "\", is a color name", NULL); + "\", is a color name", NULL); return False; } grad = ZnGetGradient(interp, tkwin, grad_descr); if (!grad) { Tcl_AppendResult(interp, "gradient specification \"", grad_descr, - "\", is invalid", NULL); + "\", is invalid", NULL); return False; } hash = Tcl_CreateHashEntry(&gradient_table, Tk_GetUid(name), &new); if (!new) { ZnFreeGradient(grad); Tcl_AppendResult(interp, "gradient name \"", name, - "\", is already in use", NULL); + "\", is already in use", NULL); return False; } else { @@ -400,7 +400,7 @@ ZnNameGradient(Tcl_Interp *interp, } ZnBool -ZnGradientNameExists(char *name) +ZnGradientNameExists(char *name) { if (!initialized) { return False; @@ -409,9 +409,9 @@ ZnGradientNameExists(char *name) } void -ZnDeleteGradientName(char *name) +ZnDeleteGradientName(char *name) { - Tcl_HashEntry *hash; + Tcl_HashEntry *hash; if (!initialized) { return; @@ -425,17 +425,17 @@ ZnDeleteGradientName(char *name) } static void -InterpolateGradientColor(Tk_Window tkwin, - ZnGradientColor *gc1, /* First color */ - ZnGradientColor *gc2, /* Next color */ - ZnGradientColor *gc_interp,/* New interpolated color */ - ZnGradientColor *gc_adjust,/* Adjusted first color. - * Needed if interested in - * the range color1 interp - * color. */ - int interp_pos, - int min_pos, - int span) +InterpolateGradientColor(Tk_Window tkwin, + ZnGradientColor *gc1, /* First color */ + ZnGradientColor *gc2, /* Next color */ + ZnGradientColor *gc_interp,/* New interpolated color */ + ZnGradientColor *gc_adjust,/* Adjusted first color. + * Needed if interested in + * the range color1 interp + * color. */ + int interp_pos, + int min_pos, + int span) { ZnReal pos1, pos2, ipos, interp_rel_pos, tmp; XColor rgb; @@ -509,15 +509,15 @@ InterpolateGradientColor(Tk_Window tkwin, static void -ReduceGradient(Tk_Window tkwin, - ZnGradient *grad) +ReduceGradient(Tk_Window tkwin, + ZnGradient *grad) { ZnReal dx, dy, len, angle; ZnTransfo t; ZnPoint pbbox[4], pgrad[4]; ZnReal maxx, minx, span, start_in_new, end_in_new; - int minx100, maxx100, span100; - int i, j, first_color, last_color; + int minx100, maxx100, span100; + int i, j, first_color, last_color; ZnBool interpolate_first, interpolate_last; dx = grad->e.x - grad->p.x; @@ -585,12 +585,12 @@ ReduceGradient(Tk_Window tkwin, if (end_in_new < 0.0) { grad->actual_colors[0].alpha = grad->colors_in[0].alpha; grad->actual_colors[0].rgb = Tk_GetColorByValue(tkwin, - grad->colors_in[0].rgb); + grad->colors_in[0].rgb); } else { grad->actual_colors[0].alpha = grad->colors_in[grad->num_colors_in].alpha; grad->actual_colors[0].rgb = Tk_GetColorByValue(tkwin, - grad->colors_in[grad->num_colors_in].rgb); + grad->colors_in[grad->num_colors_in].rgb); } } @@ -609,7 +609,7 @@ ReduceGradient(Tk_Window tkwin, */ first_color = 1; while ((first_color < (int) grad->num_colors_in) && - (grad->colors_in[first_color].position < minx100)) { + (grad->colors_in[first_color].position < minx100)) { first_color++; grad->num_actual_colors--; } @@ -637,7 +637,7 @@ ReduceGradient(Tk_Window tkwin, */ last_color = grad->num_colors_in-2; while ((last_color >= 0) && - (grad->colors_in[last_color].position > maxx100)) { + (grad->colors_in[last_color].position > maxx100)) { last_color--; grad->num_actual_colors--; } @@ -658,11 +658,11 @@ ReduceGradient(Tk_Window tkwin, j = 0; if (interpolate_first) { InterpolateGradientColor(tkwin, - &grad->colors_in[first_color-1], - &grad->colors_in[first_color], - &grad->actual_colors[j], - NULL, - minx100, minx100, span100); + &grad->colors_in[first_color-1], + &grad->colors_in[first_color], + &grad->actual_colors[j], + NULL, + minx100, minx100, span100); j++; } else if ((first_color == 0) && (grad->type != ZN_RADIAL_GRADIENT)) { @@ -693,11 +693,11 @@ ReduceGradient(Tk_Window tkwin, if (interpolate_last) { InterpolateGradientColor(tkwin, - &grad->colors_in[last_color], - &grad->colors_in[last_color+1], - &grad->actual_colors[j], - &grad->actual_colors[j-1], - maxx100, minx100, span100); + &grad->colors_in[last_color], + &grad->colors_in[last_color+1], + &grad->actual_colors[j], + &grad->actual_colors[j-1], + maxx100, minx100, span100); } else if (last_color == ((int) grad->num_colors_in)-1) { i = grad->num_colors_in-1; @@ -718,65 +718,65 @@ ReduceGradient(Tk_Window tkwin, * * ZnGetGradient -- * - * Create a data structure containing a range of colors - * used to display a gradient. + * Create a data structure containing a range of colors + * used to display a gradient. * - * The gradient should have the following syntax: + * The gradient should have the following syntax: * - * gradient := [graddesc|]color[|....|color] - * where the | are real characters not meta-syntax. + * gradient := [graddesc|]color[|....|color] + * where the | are real characters not meta-syntax. * - * graddesc := =type args - * where type := axial | radial | path + * graddesc := =type args + * where type := axial | radial | path * - * If type = axial - * args := angle (0..360) | xs ys xe ye (reals) + * If type = axial + * args := angle (0..360) | xs ys xe ye (reals) * * The first form define the axial gradiant by its slope. * With this syntax the gradient fits the whole shape. - * This is a backward compatible syntax. - * The second form specifies a vector which will be used - * to draw the gradient. The vector defines both the angle - * and the gradient area. Parts of the shape that lie before - * the vector origin are filled with the first color and - * parts that lie after the vector end are filled with the - * last color. + * This is a backward compatible syntax. + * The second form specifies a vector which will be used + * to draw the gradient. The vector defines both the angle + * and the gradient area. Parts of the shape that lie before + * the vector origin are filled with the first color and + * parts that lie after the vector end are filled with the + * last color. * - * If type = radial or path - * args := xs ys [xe ye] (reals) + * If type = radial or path + * args := xs ys [xe ye] (reals) * - * The vector specified by the 4 coordinates defines the - * gradient area. Parts of the shape that lie before - * the vector origin are filled with the first color and - * parts that lie after the vector end are filled with the - * last color. The vector end may be omitted, in such case - * the gradient fits exactly the whole shape to be filled, - * this is backward compatible with older gradients. - * - * color := colorvalue | colorvalue position | - * colorvalue control position - * where position and control are in (0..100) + * The vector specified by the 4 coordinates defines the + * gradient area. Parts of the shape that lie before + * the vector origin are filled with the first color and + * parts that lie after the vector end are filled with the + * last color. The vector end may be omitted, in such case + * the gradient fits exactly the whole shape to be filled, + * this is backward compatible with older gradients. + * + * color := colorvalue | colorvalue position | + * colorvalue control position + * where position and control are in (0..100) * - * colorvalue := (colorname | #rgb | cievalue)[;alpha] - * where alpha is in (0..100) + * colorvalue := (colorname | #rgb | cievalue)[;alpha] + * where alpha is in (0..100) * * Results: - * The return value is a token for a data structure - * describing a gradient. This token may be passed - * to the drawing routines. - * If an error prevented the gradient from being created - * then NULL is returned and an error message will be - * left in interp. + * The return value is a token for a data structure + * describing a gradient. This token may be passed + * to the drawing routines. + * If an error prevented the gradient from being created + * then NULL is returned and an error message will be + * left in interp. * * Side effects: - * Data structures, etc. are allocated. - * It is the caller's responsibility to eventually call - * ZnFreeGradient to release the resources. + * Data structures, etc. are allocated. + * It is the caller's responsibility to eventually call + * ZnFreeGradient to release the resources. * *-------------------------------------------------------------- */ ZnGradient * -ZnGetGradientByValue(ZnGradient *grad) +ZnGetGradientByValue(ZnGradient *grad) { grad->ref_count++; return grad; @@ -785,12 +785,12 @@ ZnGetGradientByValue(ZnGradient *grad) static int ParseRealList(const char *str, - const char *stop, - ZnReal *list, - int max) + const char *stop, + ZnReal *list, + int max) { - int num; - char *end; + int num; + char *end; num = 0; while ((num < max) && (str != stop)) { @@ -808,24 +808,24 @@ ParseRealList(const char *str, } ZnGradient * -ZnGetGradient(Tcl_Interp *interp, - Tk_Window tkwin, - Tk_Uid desc) +ZnGetGradient(Tcl_Interp *interp, + Tk_Window tkwin, + Tk_Uid desc) { #define SEGMENT_SIZE 64 - Tcl_HashEntry *hash; - ZnGradient *grad; - unsigned int i, j, nspace, num_colors; - unsigned int size, num_coords=0; - char type; - char const *scan_ptr, *next_ptr, *str_ptr; - ZnReal angle, position, control; - ZnReal coords[4]; - char *color_ptr, *end, segment[SEGMENT_SIZE]; + Tcl_HashEntry *hash; + ZnGradient *grad; + unsigned int i, j, nspace, num_colors; + unsigned int size, num_coords=0; + char type; + char const *scan_ptr, *next_ptr, *str_ptr; + ZnReal angle, position, control; + ZnReal coords[4]; + char *color_ptr, *end, segment[SEGMENT_SIZE]; ZnGradientColor *first, *last; - XColor color; - int new, red_range, green_range, blue_range; - ZnBool simple; + XColor color; + int new, red_range, green_range, blue_range; + ZnBool simple; /* printf("ZnGetGradient : %s\n", desc);*/ if (!desc || !*desc) { @@ -876,7 +876,7 @@ ZnGetGradient(Tcl_Interp *interp, } if (num_colors == 0) { Tcl_AppendResult(interp, "gradient should have at least one color \"", - desc, "\",", NULL); + desc, "\",", NULL); grad_err1: Tcl_DeleteHashEntry(hash); /*printf("ZnGetGradient error : %s\n", desc);*/ @@ -899,9 +899,9 @@ ZnGetGradient(Tcl_Interp *interp, num_coords = ParseRealList(scan_ptr, next_ptr, coords, 4); if ((num_coords != 1) && (num_coords != 4)) { grad_err3: - Tcl_AppendResult(interp, "invalid gradient parameter \"", - desc, "\",", NULL); - goto grad_err1; + Tcl_AppendResult(interp, "invalid gradient parameter \"", + desc, "\",", NULL); + goto grad_err1; } angle = (int) coords[0]; } @@ -910,28 +910,28 @@ ZnGetGradient(Tcl_Interp *interp, type = ZN_CONICAL_GRADIENT; num_coords = ParseRealList(scan_ptr, next_ptr, coords, 4); if ((num_coords < 1) && (num_coords > 4)) { - goto grad_err3; + 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))) { + ((*scan_ptr == 'p') && (strncmp(scan_ptr, "path", 4) == 0))) { if (*scan_ptr == 'r') { - type = ZN_RADIAL_GRADIENT; - scan_ptr += 6; + type = ZN_RADIAL_GRADIENT; + scan_ptr += 6; } else { - type = ZN_PATH_GRADIENT; - scan_ptr += 4; + type = ZN_PATH_GRADIENT; + scan_ptr += 4; } num_coords = ParseRealList(scan_ptr, next_ptr, coords, 4); if ((num_coords != 2) && (num_coords != 4)) { - goto grad_err3; + goto grad_err3; } } else { Tcl_AppendResult(interp, "invalid gradient type \"", - desc, "\",", NULL); + desc, "\",", NULL); goto grad_err1; } scan_ptr = next_ptr + 1; @@ -941,7 +941,7 @@ ZnGetGradient(Tcl_Interp *interp, * Create the gradient structure. */ grad = (ZnGradient *) ZnMalloc(sizeof(ZnGradient) + - sizeof(ZnGradientColor)*(num_colors-1)); + sizeof(ZnGradientColor)*(num_colors-1)); grad->ref_count = 1; simple = True; grad->num_colors_in = num_colors; @@ -952,7 +952,7 @@ ZnGetGradient(Tcl_Interp *interp, switch (type) { case ZN_AXIAL_GRADIENT: if ((num_coords == 4) && - ((coords[0] != coords[2]) || (coords[1] != coords[3]))) { + ((coords[0] != coords[2]) || (coords[1] != coords[3]))) { grad->p.x = coords[0]; grad->p.y = coords[1]; simple = False; @@ -965,7 +965,7 @@ ZnGetGradient(Tcl_Interp *interp, break; case ZN_CONICAL_GRADIENT: if ((num_coords == 4) && - ((coords[0] != coords[2]) || (coords[1] != coords[3]))) { + ((coords[0] != coords[2]) || (coords[1] != coords[3]))) { grad->p.x = coords[0]; grad->p.y = coords[1]; simple = False; @@ -989,7 +989,7 @@ ZnGetGradient(Tcl_Interp *interp, grad->p.x = coords[0]; grad->p.y = coords[1]; if ((num_coords == 4) && - ((coords[0] != coords[2]) || (coords[1] != coords[3]))) { + ((coords[0] != coords[2]) || (coords[1] != coords[3]))) { simple = False; grad->e.x = coords[2]; grad->e.y = coords[3]; @@ -1008,7 +1008,7 @@ ZnGetGradient(Tcl_Interp *interp, /* * Try to parse the color name. */ - nspace = strspn(scan_ptr, " \t"); + nspace = strspn(scan_ptr, " \t"); scan_ptr += nspace; str_ptr = strpbrk(scan_ptr, " \t|"); if (str_ptr) { @@ -1019,10 +1019,10 @@ ZnGetGradient(Tcl_Interp *interp, } if (size > (SEGMENT_SIZE-1)) { Tcl_AppendResult(interp, "color name too long in gradient \"", - desc, "\",", NULL); + desc, "\",", NULL); grad_err2: for (j = 0; j < i; j++) { - Tk_FreeColor(grad->colors_in[j].rgb); + Tk_FreeColor(grad->colors_in[j].rgb); } ZnFree(grad); goto grad_err1; @@ -1044,14 +1044,14 @@ ZnGetGradient(Tcl_Interp *interp, */ control = strtod(scan_ptr, &end); if (end != scan_ptr) { - grad->colors_in[i].control = (int) control; - scan_ptr = end; + grad->colors_in[i].control = (int) control; + scan_ptr = end; } } nspace = strspn(scan_ptr, " \t"); if ((scan_ptr[nspace] != 0) && (scan_ptr+nspace != next_ptr)) { Tcl_AppendResult(interp, "incorrect color description in gradient \"", - desc, "\",", NULL); + desc, "\",", NULL); goto grad_err2; } @@ -1062,7 +1062,7 @@ ZnGetGradient(Tcl_Interp *interp, grad->colors_in[i].rgb = Tk_GetColor(interp, tkwin, Tk_GetUid(segment)); if (grad->colors_in[i].rgb == NULL) { Tcl_AppendResult(interp, "incorrect color value in gradient \"", - desc, "\",", NULL); + desc, "\",", NULL); goto grad_err2; } if (color_ptr) { @@ -1076,10 +1076,10 @@ ZnGetGradient(Tcl_Interp *interp, grad->colors_in[i].position = 100; } if ((i > 0) && - ((grad->colors_in[i].position > 100) || - (grad->colors_in[i].position < grad->colors_in[i-1].position))) { + ((grad->colors_in[i].position > 100) || + (grad->colors_in[i].position < grad->colors_in[i-1].position))) { Tcl_AppendResult(interp, "incorrect color position in gradient \"", - desc, "\",", NULL); + desc, "\",", NULL); goto grad_err2; } if (grad->colors_in[i].control > 100) { @@ -1139,20 +1139,20 @@ ZnGetGradient(Tcl_Interp *interp, * * ZnNameOfGradient -- * - * Given a gradient, return a textual string identifying - * the gradient. + * Given a gradient, return a textual string identifying + * the gradient. * * Results: - * The return value is the string that was used to create - * the gradient. + * The return value is the string that was used to create + * the gradient. * * Side effects: - * None. + * None. * *-------------------------------------------------------------- */ char * -ZnNameOfGradient(ZnGradient *grad) +ZnNameOfGradient(ZnGradient *grad) { return (char *) grad->hash->key.words; } @@ -1163,23 +1163,23 @@ ZnNameOfGradient(ZnGradient *grad) * * ZnFreeGradient -- * - * This procedure is called when a gradient is no longer - * needed. It frees the resources associated with the - * gradient. After this call, the caller should never - * again use the gradient. + * This procedure is called when a gradient is no longer + * needed. It frees the resources associated with the + * gradient. After this call, the caller should never + * again use the gradient. * * Results: - * None. + * None. * * Side effects: - * Resources are freed. + * Resources are freed. * *-------------------------------------------------------------- */ void -ZnFreeGradient(ZnGradient *grad) +ZnFreeGradient(ZnGradient *grad) { - unsigned int i; + unsigned int i; grad->ref_count--; if (grad->ref_count == 0) { @@ -1187,15 +1187,15 @@ ZnFreeGradient(ZnGradient *grad) for (i = 0; i < grad->num_colors_in; i++) { Tk_FreeColor(grad->colors_in[i].rgb); if (grad->colors_in[i].mid_rgb) { - Tk_FreeColor(grad->colors_in[i].mid_rgb); + Tk_FreeColor(grad->colors_in[i].mid_rgb); } } if (grad->actual_colors != grad->colors_in) { for (i = 0; i < grad->num_actual_colors; i++) { - Tk_FreeColor(grad->actual_colors[i].rgb); - if (grad->actual_colors[i].mid_rgb) { - Tk_FreeColor(grad->actual_colors[i].mid_rgb); - } + Tk_FreeColor(grad->actual_colors[i].rgb); + if (grad->actual_colors[i].mid_rgb) { + Tk_FreeColor(grad->actual_colors[i].mid_rgb); + } } ZnFree(grad->actual_colors); } @@ -1209,14 +1209,14 @@ ZnFreeGradient(ZnGradient *grad) * * ZnComposeAlpha -- * - * This procedure takes two alpha values in percent and - * returns the composite value between 0 and 65535. + * This procedure takes two alpha values in percent and + * returns the composite value between 0 and 65535. * *-------------------------------------------------------------- */ int -ZnComposeAlpha(unsigned short alpha1, - unsigned short alpha2) +ZnComposeAlpha(unsigned short alpha1, + unsigned short alpha2) { return (alpha1*alpha2/100)*65535/100; } |