aboutsummaryrefslogtreecommitdiff
path: root/generic/Draw.c
diff options
context:
space:
mode:
authorlecoanet2001-11-12 09:57:49 +0000
committerlecoanet2001-11-12 09:57:49 +0000
commit708edd284f45b7728388c13159d6be977605b73a (patch)
tree2336c1d3cdc6b52bd83b38379964dc9a01565f90 /generic/Draw.c
parentd19f1f05bebe4aac95841345b91f9ba000e393d8 (diff)
downloadtkzinc-708edd284f45b7728388c13159d6be977605b73a.zip
tkzinc-708edd284f45b7728388c13159d6be977605b73a.tar.gz
tkzinc-708edd284f45b7728388c13159d6be977605b73a.tar.bz2
tkzinc-708edd284f45b7728388c13159d6be977605b73a.tar.xz
Am�lioration de la pr�cision des reliefs sur les polygones.
Correction de plusieurs bugs dans les d�grad�s. Les d�grad�s radiaux acceptent un facteur de forme.
Diffstat (limited to 'generic/Draw.c')
-rw-r--r--generic/Draw.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/generic/Draw.c b/generic/Draw.c
index 1ec7f88..3812450 100644
--- a/generic/Draw.c
+++ b/generic/Draw.c
@@ -619,6 +619,10 @@ DoPolygon(ZnPoint *p,
}
else {
folded = !IntersectLines(&new_pp1, &new_pp2, &pp1, &pp2, &bevel_points[2]);
+ /*printf("new_pp1 %g@%g, new_pp2 %g@%g, pp1 %g@%g, pp2 %g@%g, inter %g@%g\n",
+ new_pp1.x, new_pp1.y, new_pp2.x, new_pp2.y,
+ pp1.x, pp1.y, pp2.x, pp2.y,
+ bevel_points[2].x, bevel_points[2].y);*/
folded = folded && (dotp < 0);
if (folded) {
/*printf("DoPolygonRelief: folded edges detected, %g@%g, %g@%g, %g@%g, %g@%g\n",
@@ -890,10 +894,11 @@ 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);
glBegin(GL_QUADS);
for (i = 0; i < 4; i++) {
- glVertex2f(bevels[i].x, bevels[i].y);
+ glVertex2f(REAL_TO_INT(bevels[i].x), REAL_TO_INT(bevels[i].y));
}
glEnd();
@@ -1187,34 +1192,39 @@ RenderGradient(struct _WidgetInfo *wi,
glEnd();
}
else if (type == ZN_RADIAL_GRADIENT) {
- ZnReal x, y, radius, radius2, radius3;
+ ZnReal x, radiusx, radius2x, radius3x;
+ ZnReal y, radiusy, radius2y, radius3y;
int num_p, alpha2;
ZnPoint *genarc;
XColor *color2;
- genarc = GetCirclePoints(3, ZN_CIRCLE_MEDIUM, 0, 360, &num_p, NULL);
- radius = 0;
+ genarc = GetCirclePoints(3, ZN_CIRCLE_FINEST, 0, 360, &num_p, NULL);
+ radiusx = 0;
+ radiusy = 0;
color = gradient->colors[0]->shades[0];
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;
+ radius2x = quad[1].x*gradient->colors[j]->position/100.0;
+ radius2y = quad[1].y*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*wi->alpha/100*65535/100;
- radius3 = radius + (radius2-radius)*control/100.0;
+ radius3x = radiusx + (radius2x-radiusx)*control/100.0;
+ radius3y = radiusy + (radius2y-radiusy)*control/100.0;
for (i = 0; i < num_p; i++) {
- x = quad[0].x+genarc[i].x*radius;
- y = quad[0].y+genarc[i].y*radius;
+ x = quad[0].x+genarc[i].x*radiusx;
+ y = quad[0].y+genarc[i].y*radiusy;
glColor4us(color->red, color->green, color->blue, alpha);
glVertex2f(x, y);
- x = quad[0].x+genarc[i].x*radius3;
- y = quad[0].y+genarc[i].y*radius3;
+ x = quad[0].x+genarc[i].x*radius3x;
+ y = quad[0].y+genarc[i].y*radius3y;
glColor4us(color2->red, color2->green, color2->blue, alpha);
glVertex2f(x, y);
}
- radius = radius3;
+ radiusx = radius3x;
+ radiusy = radius3y;
color = color2;
alpha = alpha2;
glEnd();
@@ -1223,17 +1233,18 @@ RenderGradient(struct _WidgetInfo *wi,
color2 = gradient->colors[j]->shades[0];
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;
+ x = quad[0].x+genarc[i].x*radiusx;
+ y = quad[0].y+genarc[i].y*radiusy;
glColor4us(color->red, color->green, color->blue, alpha);
glVertex2f(x, y);
- x = quad[0].x+genarc[i].x*radius2;
- y = quad[0].y+genarc[i].y*radius2;
- glColor4us(color2->red, color2->green, color2->blue, alpha);
+ x = quad[0].x+genarc[i].x*radius2x;
+ y = quad[0].y+genarc[i].y*radius2y;
+ glColor4us(color2->red, color2->green, color2->blue, alpha2);
glVertex2f(x, y);
}
glEnd();
- radius = radius2;
+ radiusx = radius2x;
+ radiusy = radius2y;
color = color2;
alpha = alpha2;
control = gradient->colors[j]->control;