aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generic/Arc.c5
-rw-r--r--generic/Curve.c6
-rw-r--r--generic/Draw.c20
-rw-r--r--generic/Group.c20
-rw-r--r--generic/Item.c16
-rw-r--r--generic/Item.h1
-rw-r--r--generic/Map.c8
-rw-r--r--generic/Rectangle.c6
-rw-r--r--generic/Reticle.c7
-rw-r--r--generic/Text.c2
-rw-r--r--generic/WidgetInfo.h1
11 files changed, 58 insertions, 34 deletions
diff --git a/generic/Arc.c b/generic/Arc.c
index 2df6e7d..6165c9e 100644
--- a/generic/Arc.c
+++ b/generic/Arc.c
@@ -1264,7 +1264,8 @@ Render(Item item)
glPolygonStipple(GetBitmapMask(wi->dpy, arc->fill_pattern)->pixels);
}
color = ZnGetGradientColor(wi->win, arc->fill_color, 0.0, &alpha);
- glColor4us(color->red, color->green, color->blue, alpha*65535/100);
+ alpha = arc->line_alpha*wi->alpha/100*65535/100;
+ glColor4us(color->red, color->green, color->blue, alpha);
ArcRenderCB(arc);
glDisable(GL_POLYGON_STIPPLE);
}
@@ -1277,7 +1278,7 @@ Render(Item item)
p = ZnListArray(arc->render_shape);
num_points = ZnListSize(arc->render_shape);
glColor4us(arc->line_color->red, arc->line_color->green,
- arc->line_color->blue, arc->line_alpha*65535/100);
+ arc->line_color->blue, arc->line_alpha*wi->alpha/100*65535/100);
if ((arc->line_width <= wi->max_line_width) &&
(arc->line_width <= wi->max_point_width)) {
glLineWidth(arc->line_width);
diff --git a/generic/Curve.c b/generic/Curve.c
index 3522a87..7d7d698 100644
--- a/generic/Curve.c
+++ b/generic/Curve.c
@@ -1328,7 +1328,8 @@ Render(Item item)
glPolygonStipple(GetBitmapMask(wi->dpy, cv->fill_pattern)->pixels);
}
color = ZnGetGradientColor(wi->win, cv->fill_color, 0.0, &alpha);
- glColor4us(color->red, color->green, color->blue, alpha*65535/100);
+ alpha = alpha*wi->alpha/100*65535/100;
+ glColor4us(color->red, color->green, color->blue, alpha);
CurveRenderCB(cv);
glDisable(GL_POLYGON_STIPPLE);
}
@@ -1345,7 +1346,8 @@ Render(Item item)
}
else {
color = cv->line_color;
- glColor4us(color->red, color->green, color->blue, cv->line_alpha*65535/100);
+ glColor4us(color->red, color->green, color->blue,
+ cv->line_alpha*wi->alpha/100*65535/100);
if ((cv->line_width <= wi->max_line_width) &&
(cv->line_width <= wi->max_point_width)) {
glLineWidth(cv->line_width);
diff --git a/generic/Draw.c b/generic/Draw.c
index ed8d3ce..1ec7f88 100644
--- a/generic/Draw.c
+++ b/generic/Draw.c
@@ -890,7 +890,7 @@ PolygonRenderCB(ZnPoint *bevels,
XColor *color = ReliefColorOfSegment(bevels[0].x, bevels[0].y,
bevels[3].x, bevels[3].y,
pd->relief, pd->gradient, pd->wi);
- glColor4us(color->red, color->green, color->blue, pd->alpha*65535/100);
+ glColor4us(color->red, color->green, color->blue, pd->alpha);
glBegin(GL_QUADS);
for (i = 0; i < 4; i++) {
glVertex2f(bevels[i].x, bevels[i].y);
@@ -914,7 +914,7 @@ RenderPolygonRelief(WidgetInfo *wi,
pd.wi = wi;
pd.gradient = gradient;
- pd.alpha = alpha;
+ pd.alpha = alpha*wi->alpha/100*65535/100;
pd.smooth = smooth;
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -943,7 +943,7 @@ RenderImage(struct _WidgetInfo *wi,
{
ZnReal nx, ny;
- alpha = alpha*65535/100;
+ alpha = alpha*wi->alpha/100*65535/100;
nx = origin->x + image->width;
ny = origin->y + image->height;
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -982,10 +982,10 @@ RenderTile(struct _WidgetInfo *wi,
if (gradient) {
ZnGetGradientColor(wi->win, gradient, 0.0, &alpha);
- alpha = alpha*65535/100;
+ alpha = alpha*wi->alpha/100*65535/100;
}
else {
- alpha = 65535;
+ alpha = 65535*wi->alpha/100;
}
if (cb) {
@@ -1143,7 +1143,7 @@ RenderGradient(struct _WidgetInfo *wi,
glBegin(GL_QUAD_STRIP);
for (i = 0; i < gradient->num_colors; i++) {
color = gradient->colors[i]->shades[0];
- alpha = gradient->colors[i]->alpha*65535/100;
+ alpha = gradient->colors[i]->alpha*wi->alpha/100*65535/100;
glColor4us(color->red, color->green, color->blue, alpha);
pos = gradient->colors[i]->position;
@@ -1162,7 +1162,7 @@ RenderGradient(struct _WidgetInfo *wi,
if ((control != 50.0) && (i != gradient->num_colors-1)) {
color = gradient->colors[i]->shades[num_shades/2];
- alpha = gradient->colors[i]->alpha*65535/100;
+ alpha = gradient->colors[i]->alpha*wi->alpha/100*65535/100;
glColor4us(color->red, color->green, color->blue, alpha);
npos = gradient->colors[i+1]->position;
@@ -1195,14 +1195,14 @@ RenderGradient(struct _WidgetInfo *wi,
genarc = GetCirclePoints(3, ZN_CIRCLE_MEDIUM, 0, 360, &num_p, NULL);
radius = 0;
color = gradient->colors[0]->shades[0];
- alpha = gradient->colors[0]->alpha*65535/100;
+ alpha = gradient->colors[0]->alpha*wi->alpha/100*65535/100;
control = gradient->colors[0]->control;
for (j = 1; j < gradient->num_colors; j++) {
radius2 = quad[1].x*gradient->colors[j]->position/100.0;
if ((control != 50) && (j != gradient->num_colors-1)) {
glBegin(GL_QUAD_STRIP);
color2 = gradient->colors[j-1]->shades[num_shades/2];
- alpha2 = gradient->colors[j-1]->alpha*65535/100;
+ alpha2 = gradient->colors[j-1]->alpha*wi->alpha/100*65535/100;
radius3 = radius + (radius2-radius)*control/100.0;
for (i = 0; i < num_p; i++) {
x = quad[0].x+genarc[i].x*radius;
@@ -1221,7 +1221,7 @@ RenderGradient(struct _WidgetInfo *wi,
}
glBegin(GL_QUAD_STRIP);
color2 = gradient->colors[j]->shades[0];
- alpha2 = gradient->colors[j]->alpha*65535/100;
+ alpha2 = gradient->colors[j]->alpha*wi->alpha/100*65535/100;
for (i = 0; i < num_p; i++) {
x = quad[0].x+genarc[i].x*radius;
y = quad[0].y+genarc[i].y*radius;
diff --git a/generic/Group.c b/generic/Group.c
index 84e0692..d2f290b 100644
--- a/generic/Group.c
+++ b/generic/Group.c
@@ -48,6 +48,8 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
**********************************************************************************
*/
static ZnAttrConfig group_attrs[] = {
+ { ZN_CONFIG_ALPHA, "-alpha", NULL,
+ Tk_Offset(GroupItemStruct, alpha), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_BOOL, "-atomic", NULL,
Tk_Offset(GroupItemStruct, header.flags), ATOMIC_BIT,
ZN_REPICK_FLAG, False },
@@ -93,6 +95,7 @@ Init(Item item,
group->head = ZN_NO_ITEM;
group->tail = ZN_NO_ITEM;
group->clip = ZN_NO_ITEM;
+ group->alpha = 100;
group->dependents = NULL;
SET(item->flags, VISIBLE_BIT);
SET(item->flags, SENSITIVE_BIT);
@@ -854,17 +857,19 @@ Draw(Item item)
static void
Render(Item item)
{
+#ifdef GLX
GroupItem group = (GroupItem) item;
Item current_item;
-#ifndef GLX
WidgetInfo *wi = item->wi;
ZnBBox *clip_box;
ZnBBox bbox, old_damaged_area;
-#endif
+ unsigned char save_alpha = wi->alpha;
+
+ wi->alpha = wi->alpha * group->alpha / 100;
PushTransform(item);
PushClip(group, True);
-#ifndef GLX
+#if 0
if (group->clip != ZN_NO_ITEM) {
ITEM_P.CurrentClip(wi, NULL, &clip_box, NULL);
old_damaged_area = wi->damaged_area;
@@ -876,7 +881,7 @@ Render(Item item)
current_item = group->tail;
while (current_item != ZN_NO_ITEM) {
if (ISSET(current_item->flags, VISIBLE_BIT)) {
-#ifndef GLX
+#if 0
IntersectBBox(&wi->damaged_area, &current_item->item_bounding_box, &bbox);
if (!IsEmptyBBox(&bbox)) {
#endif
@@ -887,14 +892,14 @@ Render(Item item)
if (current_item->class != ZnGroup) {
PopTransform(current_item);
}
-#ifndef GLX
+#if 0
}
#endif
}
current_item = current_item->previous;
}
-#ifndef GLX
+#if 0
if (group->clip != ZN_NO_ITEM) {
wi->damaged_area = old_damaged_area;
}
@@ -902,6 +907,9 @@ Render(Item item)
PopClip(group, True);
PopTransform(item);
+
+ wi->alpha = save_alpha;
+#endif
}
diff --git a/generic/Item.c b/generic/Item.c
index c47d822..95580d1 100644
--- a/generic/Item.c
+++ b/generic/Item.c
@@ -4348,8 +4348,9 @@ RenderField(WidgetInfo *wi,
#ifdef GLX
int j;
XColor *color;
- int alpha;
-
+ int alpha, alpha2;
+
+ alpha2 = 65535*wi->alpha/100;
/*
* Draw the background.
*/
@@ -4378,7 +4379,8 @@ RenderField(WidgetInfo *wi,
glPolygonStipple(GetBitmapMask(wi->dpy, field_ptr->fill_pattern)->pixels);
}
color = ZnGetGradientColor(wi->win, field_ptr->fill_color, 0.0, &alpha);
- glColor4us(color->red, color->green, color->blue, alpha*65535/100);
+ alpha = alpha*wi->alpha/100*65535/100;
+ glColor4us(color->red, color->green, color->blue, alpha);
FieldRenderCB(clip_bbox);
glDisable(GL_POLYGON_STIPPLE);
}
@@ -4412,7 +4414,7 @@ RenderField(WidgetInfo *wi,
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
color = field_ptr->color;
- glColor4us(color->red, color->green, color->blue, 65535);
+ glColor4us(color->red, color->green, color->blue, alpha2);
glBindTexture(GL_TEXTURE_2D, field_ptr->txf->texobj);
glPushMatrix();
glTranslatef(text_pos->x, text_pos->y, 0.0);
@@ -4444,7 +4446,7 @@ RenderField(WidgetInfo *wi,
*/
if (field_ptr->border_edges != NO_BORDER) {
color = field_ptr->border_color;
- glColor4us(color->red, color->green, color->blue, 65535);
+ glColor4us(color->red, color->green, color->blue, alpha2);
glLineWidth(1);
glBegin(GL_LINES);
if (field_ptr->border_edges & LEFT_BORDER) {
@@ -4756,6 +4758,10 @@ Repair(WidgetInfo *wi)
RenderTile(wi, GetImageTexture(wi->win, wi->tile_name, wi->tile),
NULL, NULL, NULL, (ZnPoint *) &bbox);
}
+ /*
+ * Init the composite group alpha.
+ */
+ wi->alpha = 100;
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
diff --git a/generic/Item.h b/generic/Item.h
index 1d9f554..d3d0bf0 100644
--- a/generic/Item.h
+++ b/generic/Item.h
@@ -109,6 +109,7 @@ typedef struct _GroupItemStruct {
/* Public data */
Item clip;
+ unsigned char alpha;
/* Private data */
Item head; /* Doubly linked list of all items. */
diff --git a/generic/Map.c b/generic/Map.c
index ebf4525..12d953a 100644
--- a/generic/Map.c
+++ b/generic/Map.c
@@ -1281,6 +1281,7 @@ Render(Item item)
unsigned int i, cnt;
int line_width, new_width;
XColor *color;
+ unsigned char alpha;
if (map->map_info == NULL) {
return;
@@ -1288,7 +1289,8 @@ Render(Item item)
map_info = map->map_info;
color = map->color;
- glColor4us(color->red, color->green, color->blue, map->alpha*65535/100);
+ alpha = map->alpha*wi->alpha*65535/100;
+ glColor4us(color->red, color->green, color->blue, alpha);
if (map->filled) {
if (ZnListSize(map->vectors) || ZnListSize(map->arcs)) {
if (map->fill_pattern != ZnUnspecifiedPattern) { /* Fill stippled */
@@ -1453,7 +1455,7 @@ Render(Item item)
p.x = points[i].x-(w+1.0)/2.0;
p.y = points[i].y-(h+1.0)/2.0;
RenderImage(wi, (ImageBits *) GetBitmapTexture(wi->dpy, sym),
- color, map->alpha, &p);
+ color, alpha, &p);
}
}
}
@@ -1468,7 +1470,7 @@ Render(Item item)
for (i = 0; i < cnt; i++, points++) {
p.x = points->x-(w+1)/2;
p.y = points->y-(h+1)/2;
- RenderImage(wi, im_bits, color, map->alpha, &p);
+ RenderImage(wi, im_bits, color, alpha, &p);
}
}
}
diff --git a/generic/Rectangle.c b/generic/Rectangle.c
index 6a5ea69..841a48e 100644
--- a/generic/Rectangle.c
+++ b/generic/Rectangle.c
@@ -732,7 +732,8 @@ Render(Item item)
glPolygonStipple(GetBitmapMask(wi->dpy, rect->fill_pattern)->pixels);
}
color = ZnGetGradientColor(wi->win, rect->fill_color, 0.0, &alpha);
- glColor4us(color->red, color->green, color->blue, alpha*65535/100);
+ alpha = (alpha*wi->alpha/100)*65535/100;
+ glColor4us(color->red, color->green, color->blue, alpha);
RectRenderCB(rect);
glDisable(GL_POLYGON_STIPPLE);
}
@@ -752,7 +753,8 @@ Render(Item item)
}
else {
color = rect->line_color;
- glColor4us(color->red, color->green, color->blue, rect->line_alpha*65535/100);
+ alpha = rect->line_alpha*wi->alpha/100*65535/100;
+ glColor4us(color->red, color->green, color->blue, alpha);
if (rect->line_width < 3) {
SetLineStyle(wi, rect->line_style);
glLineWidth(rect->line_width);
diff --git a/generic/Reticle.c b/generic/Reticle.c
index 5e701bb..31ea083 100644
--- a/generic/Reticle.c
+++ b/generic/Reticle.c
@@ -393,7 +393,7 @@ Render(Item item)
ZnDim radius_max_dev, new, x, y, xo, yo;
unsigned int i, j;
ZnPoint *genarc;
- int num_p;
+ int num_p, alpha;
xo = reticle->dev.x;
yo = reticle->dev.y;
@@ -430,12 +430,13 @@ Render(Item item)
(reticle->num_circles - 1) * reticle->step_size_dev);
}
+ alpha = 65535*wi->alpha/100;
genarc = GetCirclePoints(3, ZN_CIRCLE_FINEST, 0, 360, &num_p, NULL);
glLineWidth(1);
while (radius <= radius_max_dev) {
SetLineStyle(wi, reticle->line_style);
glColor4us(reticle->line_color->red, reticle->line_color->green,
- reticle->line_color->blue, 65535);
+ reticle->line_color->blue, alpha);
for (i = 1; (radius <= radius_max_dev && i < reticle->period); i++) {
if ((xo >= wi->damaged_area.orig.x - radius) &&
(xo <= wi->damaged_area.corner.x + radius) &&
@@ -458,7 +459,7 @@ Render(Item item)
(yo <= wi->damaged_area.corner.y + radius)) {
SetLineStyle(wi, reticle->bright_line_style);
glColor4us(reticle->bright_line_color->red, reticle->bright_line_color->green,
- reticle->bright_line_color->blue, 65535);
+ reticle->bright_line_color->blue, alpha);
glBegin(GL_LINE_LOOP);
for (j = 0; j < num_p; j++) {
x = xo + genarc[j].x * radius;
diff --git a/generic/Text.c b/generic/Text.c
index dd220d5..9fd5c3a 100644
--- a/generic/Text.c
+++ b/generic/Text.c
@@ -782,7 +782,7 @@ Render(Item item)
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4us(text->color->red, text->color->green,
- text->color->blue, text->alpha*65535/100);
+ text->color->blue, text->alpha*wi->alpha/100*65535/100);
glBindTexture(GL_TEXTURE_2D, text->txf->texobj);
lines = (TextLineInfo) ZnListArray(text->text_info);
diff --git a/generic/WidgetInfo.h b/generic/WidgetInfo.h
index d7071b9..46a7cbf 100644
--- a/generic/WidgetInfo.h
+++ b/generic/WidgetInfo.h
@@ -190,6 +190,7 @@ typedef struct _WidgetInfo {
ZnBool has_x_shape; /* Tell if the X shape ext. is avail. */
ZnBool has_x_input; /* Tell if the X input ext. is avail. */
ZnBool render;
+ unsigned char alpha; /* Current composite group alpha. */
int events_flags; /* NEED_REPICK et al */
Window real_top;
Item top_group;