aboutsummaryrefslogtreecommitdiff
path: root/generic/Draw.c
diff options
context:
space:
mode:
authorlecoanet2003-05-09 14:59:01 +0000
committerlecoanet2003-05-09 14:59:01 +0000
commitf800b944fc713fdd428f314c7d4c5bc6317dcb96 (patch)
tree5ff0cd3d71e4f292013bfa386c3a1534703712fb /generic/Draw.c
parentbfcc3438325ba1b9ebce8fb8a7ed66e0d0e84bd1 (diff)
downloadtkzinc-f800b944fc713fdd428f314c7d4c5bc6317dcb96.zip
tkzinc-f800b944fc713fdd428f314c7d4c5bc6317dcb96.tar.gz
tkzinc-f800b944fc713fdd428f314c7d4c5bc6317dcb96.tar.bz2
tkzinc-f800b944fc713fdd428f314c7d4c5bc6317dcb96.tar.xz
* (ZnCompute...Gradient): Test whether the shape has multiple
contours to skip clockwise contours in computing the gradient bbox. This enable the description of a filled clockwise mono contour. * (ZnRenderTile): Slightly changed to enable drawing patterns using the same routine depending on the image status (photo or bitmap).
Diffstat (limited to 'generic/Draw.c')
-rw-r--r--generic/Draw.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/generic/Draw.c b/generic/Draw.c
index f7b4a11..9405546 100644
--- a/generic/Draw.c
+++ b/generic/Draw.c
@@ -1344,12 +1344,14 @@ ZnRenderTile(ZnWInfo *wi,
int width, height, num_clips = ZnListSize(wi->clip_stack);
unsigned short alpha;
GLuint texobj;
-
+ XColor *color;
+
if (gradient) {
- ZnGetGradientColor(gradient, 0.0, &alpha);
+ color = ZnGetGradientColor(gradient, 0.0, &alpha);
alpha = ZnComposeAlpha(alpha, wi->alpha);
}
else {
+ color = NULL;
alpha = ZnComposeAlpha(100, wi->alpha);
}
@@ -1371,7 +1373,12 @@ ZnRenderTile(ZnWInfo *wi,
ZnSizeOfImage(tile, &width, &height);
texobj = ZnImageTex(tile, &tilet, &tiles);
glEnable(GL_TEXTURE_2D);
- glColor4us(65535, 65535, 65535, alpha);
+ if (color && ZnImageIsBitmap(tile)) {
+ glColor4us(color->red, color->green, color->blue, alpha);
+ }
+ else {
+ glColor4us(65535, 65535, 65535, alpha);
+ }
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture(GL_TEXTURE_2D, texobj);
@@ -1437,7 +1444,7 @@ ZnComputeAxialGradient(ZnWInfo *wi,
c = shape->contours;
ZnResetBBox(&bbox);
for (i = 0; i < shape->num_contours; i++, c++) {
- if (c->cw) {
+ if (c->cw && (shape->num_contours > 1)) {
continue;
}
ZnListAssertSize(wi->work_pts, c->num_points);
@@ -1484,7 +1491,7 @@ ZnComputeRadialGradient(ZnWInfo *wi,
c = shape->contours;
dist = 0.0;
for (j = 0; j < shape->num_contours; j++, c++) {
- if (c->cw) {
+ if (c->cw && (shape->num_contours > 1)) {
continue;
}
ZnAddPointsToBBox(&bbox, c->points, c->num_points);
@@ -1541,7 +1548,7 @@ ZnComputeRadialGradient(ZnWInfo *wi,
*/
c = shape->contours;
for (j = 0; j < shape->num_contours; j++, c++) {
- if (c->cw) {
+ if (c->cw && (shape->num_contours > 1)) {
continue;
}
for (i = 0, points = c->points; i < c->num_points; i++, points++) {
@@ -1590,7 +1597,7 @@ ZnComputePathGradient(ZnWInfo *wi,
ZnResetBBox(&bbox);
c = shape->contours;
for (j = 0; j < shape->num_contours; j++, c++) {
- if (c->cw) {
+ if (c->cw && (shape->num_contours > 1)) {
continue;
}
ZnAddPointsToBBox(&bbox, c->points, c->num_points);