From f800b944fc713fdd428f314c7d4c5bc6317dcb96 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 9 May 2003 14:59:01 +0000 Subject: * (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). --- generic/Draw.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'generic/Draw.c') 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); -- cgit v1.1