aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generic/Arc.c57
-rw-r--r--generic/Rectangle.c89
2 files changed, 57 insertions, 89 deletions
diff --git a/generic/Arc.c b/generic/Arc.c
index 5b69992..147bf83 100644
--- a/generic/Arc.c
+++ b/generic/Arc.c
@@ -70,7 +70,6 @@ typedef struct _ArcItemStruct {
int start_angle;
int angle_extent;
ZnImage line_pattern;
- ZnImage fill_pattern;
ZnGradient *fill_color;
ZnGradient *line_color;
ZnDim line_width;
@@ -109,7 +108,7 @@ static ZnAttrConfig arc_attrs[] = {
{ ZN_CONFIG_BOOL, "-filled", NULL,
Tk_Offset(ArcItemStruct, flags), FILLED_BIT, ZN_COORDS_FLAG, False },
{ ZN_CONFIG_BITMAP, "-fillpattern", NULL,
- Tk_Offset(ArcItemStruct, fill_pattern), 0, ZN_DRAW_FLAG, False },
+ Tk_Offset(ArcItemStruct, tile), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_LINE_END, "-firstend", NULL,
Tk_Offset(ArcItemStruct, first_end), 0, ZN_COORDS_FLAG, False },
{ ZN_CONFIG_LINE_END, "-lastend", NULL,
@@ -177,7 +176,6 @@ Init(ZnItem item,
CLEAR(arc->flags, PIE_SLICE_BIT);
CLEAR(arc->flags, USING_POLY_BIT);
arc->line_pattern = ZnUnspecifiedImage;
- arc->fill_pattern = ZnUnspecifiedImage;
arc->tile = ZnUnspecifiedImage;
arc->line_style = ZN_LINE_SIMPLE;
arc->line_width = 1;
@@ -233,9 +231,6 @@ Clone(ZnItem item)
if (arc->line_pattern != ZnUnspecifiedImage) {
arc->line_pattern = ZnGetImageByValue(arc->line_pattern);
}
- if (arc->fill_pattern != ZnUnspecifiedImage) {
- arc->fill_pattern = ZnGetImageByValue(arc->fill_pattern);
- }
arc->line_color = ZnGetGradientByValue(arc->line_color);
arc->fill_color = ZnGetGradientByValue(arc->fill_color);
arc->grad_geo = NULL;
@@ -274,10 +269,6 @@ Destroy(ZnItem item)
ZnFreeImage(arc->line_pattern);
arc->line_pattern = ZnUnspecifiedImage;
}
- if (arc->fill_pattern != ZnUnspecifiedImage) {
- ZnFreeImage(arc->fill_pattern);
- arc->fill_pattern = ZnUnspecifiedImage;
- }
if (arc->grad_geo) {
ZnFree(arc->grad_geo);
}
@@ -1017,23 +1008,25 @@ Draw(ZnItem item)
if (ISSET(arc->flags, FILLED_BIT)) {
values.foreground = ZnPixel(ZnGetGradientColor(arc->fill_color, 0.0, NULL));
values.arc_mode = ISSET(arc->flags, PIE_SLICE_BIT) ? ArcPieSlice : ArcChord;
- if (arc->tile != ZnUnspecifiedImage) { /* Fill Tiled */
- values.fill_style = FillTiled;
- values.tile = ZnImagePixmap(arc->tile);
- values.ts_x_origin = (int) item->item_bounding_box.orig.x;
- values.ts_y_origin = (int) item->item_bounding_box.orig.y;
- XChangeGC(wi->dpy, wi->gc,
- GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile|GCArcMode,
- &values);
- }
- else if (arc->fill_pattern != ZnUnspecifiedImage) { /* Fill stippled */
- values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(arc->fill_pattern);
- values.ts_x_origin = (int) item->item_bounding_box.orig.x;
- values.ts_y_origin = (int) item->item_bounding_box.orig.y;
- XChangeGC(wi->dpy, wi->gc,
- GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCStipple|GCForeground|GCArcMode,
- &values);
+ if (arc->tile != ZnUnspecifiedImage) {
+ if (!ZnImageIsBitmap(arc->tile)) { /* Fill tiled */
+ values.fill_style = FillTiled;
+ values.tile = ZnImagePixmap(arc->tile);
+ values.ts_x_origin = (int) item->item_bounding_box.orig.x;
+ values.ts_y_origin = (int) item->item_bounding_box.orig.y;
+ XChangeGC(wi->dpy, wi->gc,
+ GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile|GCArcMode,
+ &values);
+ }
+ else { /* Fill stippled */
+ values.fill_style = FillStippled;
+ values.stipple = ZnImagePixmap(arc->tile);
+ values.ts_x_origin = (int) item->item_bounding_box.orig.x;
+ values.ts_y_origin = (int) item->item_bounding_box.orig.y;
+ XChangeGC(wi->dpy, wi->gc,
+ GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCStipple|GCForeground|GCArcMode,
+ &values);
+ }
}
else { /* Fill solid */
values.fill_style = FillSolid;
@@ -1231,23 +1224,15 @@ Render(ZnItem item)
ZnRenderGradient(wi, arc->fill_color, ArcRenderCB, arc,
arc->grad_geo, &poly);
}
- else if (arc->tile != ZnUnspecifiedImage) { /* Fill tiled */
+ else if (arc->tile != ZnUnspecifiedImage) { /* Fill tiled/stippled */
ZnRenderTile(wi, arc->tile, arc->fill_color, ArcRenderCB, arc,
(ZnPoint *) &item->item_bounding_box);
}
else {
- if (arc->fill_pattern != ZnUnspecifiedImage) { /* Fill stippled */
- /*
- * Setup polygon stippling.
- */
- glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(ZnImageMask(arc->fill_pattern, NULL));
- }
color = ZnGetGradientColor(arc->fill_color, 0.0, &alpha);
alpha = ZnComposeAlpha(alpha, wi->alpha);
glColor4us(color->red, color->green, color->blue, alpha);
ArcRenderCB(arc);
- glDisable(GL_POLYGON_STIPPLE);
}
}
diff --git a/generic/Rectangle.c b/generic/Rectangle.c
index 9aa98cb..d15356d 100644
--- a/generic/Rectangle.c
+++ b/generic/Rectangle.c
@@ -65,7 +65,6 @@ typedef struct _RectangleItemStruct {
ZnLineStyle line_style;
ZnDim line_width;
ZnGradient *line_color;
- ZnImage fill_pattern;
ZnImage line_pattern;
ZnGradient *fill_color;
ZnImage tile;
@@ -93,7 +92,7 @@ static ZnAttrConfig rect_attrs[] = {
{ ZN_CONFIG_BOOL, "-filled", NULL,
Tk_Offset(RectangleItemStruct, flags), FILLED_BIT, ZN_COORDS_FLAG, False },
{ ZN_CONFIG_BITMAP, "-fillpattern", NULL,
- Tk_Offset(RectangleItemStruct, fill_pattern), 0, ZN_DRAW_FLAG, False },
+ Tk_Offset(RectangleItemStruct, tile), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_GRADIENT, "-linecolor", NULL,
Tk_Offset(RectangleItemStruct, line_color), 0,
ZN_DRAW_FLAG, False },
@@ -175,7 +174,6 @@ Init(ZnItem item,
rect->line_width = 1;
rect->line_pattern = ZnUnspecifiedImage;
rect->tile = ZnUnspecifiedImage;
- rect->fill_pattern = ZnUnspecifiedImage;
rect->line_color = ZnGetGradientByValue(wi->fore_color);
rect->fill_color = ZnGetGradientByValue(wi->fore_color);
@@ -204,9 +202,6 @@ Clone(ZnItem item)
if (rect->line_pattern != ZnUnspecifiedImage) {
rect->line_pattern = ZnGetImageByValue(rect->line_pattern);
}
- if (rect->fill_pattern != ZnUnspecifiedImage) {
- rect->fill_pattern = ZnGetImageByValue(rect->fill_pattern);
- }
rect->line_color = ZnGetGradientByValue(rect->line_color);
rect->fill_color = ZnGetGradientByValue(rect->fill_color);
rect->grad_geo = NULL;
@@ -236,10 +231,6 @@ Destroy(ZnItem item)
ZnFreeImage(rect->line_pattern);
rect->line_pattern = ZnUnspecifiedImage;
}
- if (rect->fill_pattern != ZnUnspecifiedImage) {
- ZnFreeImage(rect->fill_pattern);
- rect->fill_pattern = ZnUnspecifiedImage;
- }
if (rect->grad_geo) {
ZnFree(rect->grad_geo);
}
@@ -509,34 +500,36 @@ Draw(ZnItem item)
*/
if (ISSET(rect->flags, FILLED_BIT)) {
values.foreground = ZnPixel(ZnGetGradientColor(rect->fill_color, 0.0, NULL));
- if (rect->tile != ZnUnspecifiedImage) { /* Fill tiled */
- values.fill_style = FillTiled;
- values.tile = ZnImagePixmap(rect->tile);
- if (ISSET(rect->flags, ALIGNED_BIT)) {
- values.ts_x_origin = (int) r.x;
- values.ts_y_origin = (int) r.y;
+ if (rect->tile != ZnUnspecifiedImage) {
+ if (!ZnImageIsBitmap(rect->tile)) { /* Fill tiled */
+ values.fill_style = FillTiled;
+ values.tile = ZnImagePixmap(rect->tile);
+ if (ISSET(rect->flags, ALIGNED_BIT)) {
+ values.ts_x_origin = (int) r.x;
+ values.ts_y_origin = (int) r.y;
+ }
+ else {
+ values.ts_x_origin = (int) item->item_bounding_box.orig.x;
+ values.ts_y_origin = (int) item->item_bounding_box.orig.y;
+ }
+ XChangeGC(wi->dpy, wi->gc,
+ GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile, &values);
}
else {
- values.ts_x_origin = (int) item->item_bounding_box.orig.x;
- values.ts_y_origin = (int) item->item_bounding_box.orig.y;
- }
- XChangeGC(wi->dpy, wi->gc,
- GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile, &values);
- }
- else if (rect->fill_pattern != ZnUnspecifiedImage) { /* Fill stippled */
- values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(rect->fill_pattern);
- if (ISSET(rect->flags, ALIGNED_BIT)) {
- values.ts_x_origin = (int) r.x;
- values.ts_y_origin = (int) r.y;
+ values.fill_style = FillStippled;
+ values.stipple = ZnImagePixmap(rect->tile);
+ if (ISSET(rect->flags, ALIGNED_BIT)) {
+ values.ts_x_origin = (int) r.x;
+ values.ts_y_origin = (int) r.y;
}
- else {
- values.ts_x_origin = (int) item->item_bounding_box.orig.x;
- values.ts_y_origin = (int) item->item_bounding_box.orig.y;
+ else {
+ values.ts_x_origin = (int) item->item_bounding_box.orig.x;
+ values.ts_y_origin = (int) item->item_bounding_box.orig.y;
+ }
+ XChangeGC(wi->dpy, wi->gc,
+ GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCStipple|GCForeground,
+ &values);
}
- XChangeGC(wi->dpy, wi->gc,
- GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCStipple|GCForeground,
- &values);
}
else { /* Fill solid */
values.fill_style = FillSolid;
@@ -629,8 +622,8 @@ Render(ZnItem item)
{
ZnWInfo *wi = item->wi;
RectangleItem rect = (RectangleItem) item;
- XColor *color;
int i;
+ XColor *color;
unsigned short alpha;
#ifdef GL_LIST
@@ -650,25 +643,15 @@ Render(ZnItem item)
fast ? NULL: RectRenderCB, rect,
fast ? rect->dev : rect->grad_geo, &poly);
}
+ else if (rect->tile != ZnUnspecifiedImage) { /* Fill tiled/patterned */
+ ZnRenderTile(wi, rect->tile, rect->fill_color, RectRenderCB,
+ rect, (ZnPoint *) &item->item_bounding_box);
+ }
else {
- if (rect->tile != ZnUnspecifiedImage) { /* Fill tiled */
- ZnRenderTile(wi, rect->tile, rect->fill_color, RectRenderCB,
- rect, (ZnPoint *) &item->item_bounding_box);
- }
- else {
- if (rect->fill_pattern != ZnUnspecifiedImage) { /* Fill stippled */
- /*
- * Setup polygon stippling.
- */
- glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(ZnImageMask(rect->fill_pattern, NULL));
- }
- color = ZnGetGradientColor(rect->fill_color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, wi->alpha);
- glColor4us(color->red, color->green, color->blue, alpha);
- RectRenderCB(rect);
- glDisable(GL_POLYGON_STIPPLE);
- }
+ color = ZnGetGradientColor(rect->fill_color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, wi->alpha);
+ glColor4us(color->red, color->green, color->blue, alpha);
+ RectRenderCB(rect);
}
}