aboutsummaryrefslogtreecommitdiff
path: root/generic/Color.c
diff options
context:
space:
mode:
authorlecoanet2002-03-15 14:13:24 +0000
committerlecoanet2002-03-15 14:13:24 +0000
commit1130d6cd5b4bbc52c3cbd81c46b7b26008bf87e4 (patch)
tree6a2b2369991efd5672b17b7a0e6162a327918ff1 /generic/Color.c
parent3d4ee44e88120a74d95b9daf03485c2f781c3656 (diff)
downloadtkzinc-1130d6cd5b4bbc52c3cbd81c46b7b26008bf87e4.zip
tkzinc-1130d6cd5b4bbc52c3cbd81c46b7b26008bf87e4.tar.gz
tkzinc-1130d6cd5b4bbc52c3cbd81c46b7b26008bf87e4.tar.bz2
tkzinc-1130d6cd5b4bbc52c3cbd81c46b7b26008bf87e4.tar.xz
ajout de l'alpha dans les gradients reliefs.
Diffstat (limited to 'generic/Color.c')
-rw-r--r--generic/Color.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/generic/Color.c b/generic/Color.c
index f60722a..851086f 100644
--- a/generic/Color.c
+++ b/generic/Color.c
@@ -294,7 +294,7 @@ FindClosestColor(Tk_Window tkwin, /* Window where color will
vis_info = XGetVisualInfo(Tk_Display(tkwin), VisualIDMask,
&template, &num_found);
if (num_found < 1) {
- ZnWarning("FindClosestColor (Zinc) couldn't lookup visual");
+ ZnWarning("FindClosestColor (Zinc) couldn't lookup visual\n");
abort();
}
stress->num_colors = vis_info->colormap_size;
@@ -323,7 +323,7 @@ FindClosestColor(Tk_Window tkwin, /* Window where color will
*/
while (1) {
if (stress->num_colors == 0) {
- ZnWarning("FindClosestColor (Zinc) ran out of colors");
+ ZnWarning("FindClosestColor (Zinc) ran out of colors\n");
abort();
}
closest_dist = 1e30;
@@ -709,7 +709,7 @@ ZnFreeColor(XColor *color) /* Color to be released. Must have been
* allocated by ZnGetColor.
*/
if (tk_col->magic != COLOR_MAGIC) {
- ZnWarning("ZnFreeColor called with bogus color");
+ ZnWarning("ZnFreeColor called with bogus color\n");
abort();
}
@@ -943,7 +943,8 @@ ZnGradientFlat(ZnGradient *grad)
ZnGradient *
ZnGetReliefGradient(Tcl_Interp *interp,
Tk_Window tkwin,
- Tk_Uid name)
+ Tk_Uid name,
+ int alpha)
{
XColor *base, light_color, dark_color, color;
char color_name[COLOR_NAME_SIZE];
@@ -1002,8 +1003,8 @@ ZnGetReliefGradient(Tcl_Interp *interp,
light_color.blue = MAX(tmp1, tmp2);
buffer[0] = 0;
- sprintf(color_name, "#%02x%02x%02x|",
- dark_color.red/256, dark_color.green/256, dark_color.blue/256);
+ sprintf(color_name, "#%02x%02x%02x:%d|",
+ 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;
@@ -1012,26 +1013,26 @@ ZnGetReliefGradient(Tcl_Interp *interp,
color.red =(int) dark_color.red + red_range * j/RELIEF_STEPS;
color.green = (int) dark_color.green + green_range * j/RELIEF_STEPS;
color.blue = (int) dark_color.blue + blue_range * j/RELIEF_STEPS;
- sprintf(color_name, "#%02x%02x%02x %d|",
- color.red/256, color.green/256, color.blue/256, 50/RELIEF_STEPS*j);
+ sprintf(color_name, "#%02x%02x%02x:%d %d|",
+ color.red/256, color.green/256, color.blue/256, alpha, 50/RELIEF_STEPS*j);
strcat(buffer, color_name);
}
- sprintf(color_name, "#%02x%02x%02x 50|",
- base->red/256, base->green/256, base->blue/256);
+ sprintf(color_name, "#%02x%02x%02x:%d 50|",
+ 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;
blue_range = (int) light_color.blue - (int) base->blue;
for (j = 1; j < RELIEF_STEPS; j++) {
- color.red =(int) base->red + red_range * j/RELIEF_STEPS;
+ color.red = (int) base->red + red_range * j/RELIEF_STEPS;
color.green = (int) base->green + green_range * j/RELIEF_STEPS;
color.blue = (int) base->blue + blue_range * j/RELIEF_STEPS;
- sprintf(color_name, "#%02x%02x%02x %d|",
- color.red/256, color.green/256, color.blue/256, 50+50/RELIEF_STEPS*j);
+ sprintf(color_name, "#%02x%02x%02x:%d %d|",
+ color.red/256, color.green/256, color.blue/256, alpha, 50+50/RELIEF_STEPS*j);
strcat(buffer, color_name);
}
- sprintf(color_name, "#%02x%02x%02x",
- light_color.red/256, light_color.green/256, light_color.blue/256);
+ sprintf(color_name, "#%02x%02x%02x:%d",
+ light_color.red/256, light_color.green/256, light_color.blue/256, alpha);
strcat(buffer, color_name);
/*printf("gradient relief: %s \n", buffer);*/