diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/Draw.c | 38 | ||||
-rw-r--r-- | generic/Draw.h | 6 |
2 files changed, 32 insertions, 12 deletions
diff --git a/generic/Draw.c b/generic/Draw.c index ea93823..92b22b5 100644 --- a/generic/Draw.c +++ b/generic/Draw.c @@ -1139,24 +1139,42 @@ ZnRenderPolyline(WidgetInfo *wi, void +ZnRenderIcon(WidgetInfo *wi, + ZnImage image, + ZnGradient *gradient, + ZnPoint *origin, + ZnBool modulate) +{ + ZnPoint p[4]; + int width, height; + + ZnSizeOfImage(image, &width, &height); + p[0] = *origin; + p[1].x = origin->x; + p[1].y = origin->y + height; + p[2].x = origin->x + width; + p[2].y = p[1].y; + p[3].x = p[2].x; + p[3].y = origin->y; + ZnRenderImage(wi, image, gradient, p, modulate); +} + + +void ZnRenderImage(WidgetInfo *wi, ZnImage image, ZnGradient *gradient, - ZnPoint *origin, + ZnPoint *quad, ZnBool modulate) { - ZnReal nx, ny; XColor *color; - int alpha, width, height; + int alpha; ZnReal t, s; GLuint texobj; color = ZnGetGradientColor(gradient, 0, &alpha); alpha = ZnComposeAlpha(alpha, wi->alpha); - ZnSizeOfImage(image, &width, &height); texobj = ZnImageTex(image, &t, &s); - nx = origin->x + width; - ny = origin->y + height; glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glEnable(GL_TEXTURE_2D); @@ -1169,13 +1187,13 @@ ZnRenderImage(WidgetInfo *wi, } glBegin(GL_QUADS); glTexCoord2f(0.0, 0.0); - glVertex2f(origin->x, origin->y); + glVertex2f(quad[0].x, quad[0].y); glTexCoord2f(0.0, t); - glVertex2f(origin->x, ny); + glVertex2f(quad[1].x, quad[1].y); glTexCoord2f(s, t); - glVertex2f(nx, ny); + glVertex2f(quad[2].x, quad[2].y); glTexCoord2f(s, 0.0); - glVertex2f(nx, origin->y); + glVertex2f(quad[3].x, quad[3].y); glEnd(); glDisable(GL_TEXTURE_2D); } diff --git a/generic/Draw.h b/generic/Draw.h index 258f297..0ffea0d 100644 --- a/generic/Draw.h +++ b/generic/Draw.h @@ -121,8 +121,10 @@ void ZnRenderGradient(struct _WidgetInfo *wi, ZnGradient *gradient, ZnPoly *poly); void ZnRenderTile(struct _WidgetInfo *wi, ZnImage tile, ZnGradient *gradient, void cb(void *), void *closure, ZnPoint *quad); -void ZnRenderImage(struct _WidgetInfo *wi, ZnImage image, - ZnGradient *gradient, ZnPoint *origin, ZnBool modulate); +void ZnRenderIcon(struct _WidgetInfo *wi, ZnImage image, ZnGradient *gradient, + ZnPoint *origin, ZnBool modulate); +void ZnRenderImage(struct _WidgetInfo *wi, ZnImage image, ZnGradient *gradient, + ZnPoint *quad, ZnBool modulate); void RenderHollowDot(struct _WidgetInfo *wi, ZnPoint *p, ZnReal size); void ZnRenderGlyph(ZnTexFontInfo *tfi, int c); |