aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generic/Rectangle.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/generic/Rectangle.c b/generic/Rectangle.c
index 8d083a3..6ebc137 100644
--- a/generic/Rectangle.c
+++ b/generic/Rectangle.c
@@ -197,8 +197,8 @@ Init(Item item,
rect->tile_name = "";
rect->tile = ZnUnspecifiedImage;
rect->fill_pattern = ZnUnspecifiedPattern;
- rect->line_color = ZnGetGradientByValue(wi->fore_gradient);
- rect->fill_color = ZnGetGradientByValue(wi->fore_gradient);
+ rect->line_color = ZnGetGradientByValue(wi->fore_color);
+ rect->fill_color = ZnGetGradientByValue(wi->fore_color);
return ZN_OK;
}
@@ -222,7 +222,7 @@ Clone(Item item)
rect->gradient = ZnGetGradientByValue(rect->gradient);
}
rect->grad_geo = NULL;
- if (strlen(rect->tile_name) != 0) {
+ if (rect->tile != ZnUnspecifiedImage) {
text = ZnMalloc((strlen(rect->tile_name) + 1) * sizeof(char));
strcpy(text, rect->tile_name);
rect->tile_name = text;
@@ -295,6 +295,8 @@ Configure(Item item,
WidgetInfo *wi = item->wi;
RectangleItem rect = (RectangleItem) item;
int status = ZN_OK;
+ XColor *color;
+ int alpha;
status = ITEM_P.ConfigureAttributes((char *) item, -1, argc, argv, flags);
@@ -304,35 +306,18 @@ Configure(Item item,
rect->gradient = NULL;
}
if ((rect->relief != RELIEF_FLAT) && !rect->gradient) {
+ color = ZnGetGradientColor(rect->line_color, 51.0, &alpha);
rect->gradient = ZnGetReliefGradient(wi->interp, wi->win,
- ZnNameOfColor(ZnGetGradientColor(rect->fill_color,
- 50.0,
- NULL)));
+ ZnNameOfColor(color), alpha);
if (rect->gradient == NULL) {
status = ZN_ERROR;
}
}
if (ISSET(*flags, ZN_TILE_FLAG)) {
- Tk_Image tile;
-
- if (strcmp(rect->tile_name, "") != 0) {
- tile = Tk_GetImage(wi->interp, wi->win, rect->tile_name,
- RectTileChange, (ClientData) rect);
- if (tile == NULL) {
- /*
- * The name will not be in sync with the image in
- * this case.
- */
- status = ZN_ERROR;
- }
- }
- else {
- tile = ZnUnspecifiedImage;
- }
- if (rect->tile != ZnUnspecifiedImage) {
- Tk_FreeImage(rect->tile);
+ if (ValidateImage(wi, item, rect->tile_name, RectTileChange,
+ &rect->tile, "rectangle -tile") == ZN_ERROR) {
+ status = ZN_ERROR;
}
- rect->tile = tile;
}
return status;
@@ -713,8 +698,6 @@ Render(Item item)
}
if (rect->line_width) {
- color = ZnGetGradientColor(rect->line_color, 0, &alpha);
- alpha = ZnComposeAlpha(alpha, wi->alpha);
if (rect->relief != RELIEF_FLAT) {
ZnPoint p[5];
for (i = 0; i < 4; i++) {
@@ -722,8 +705,8 @@ Render(Item item)
p[4-i].y = rect->dev[i].y;
}
p[0] = p[4];
- RenderPolygonRelief(wi, rect->relief, rect->gradient,
- alpha, 0, p, 5, rect->line_width);
+ RenderPolygonRelief(wi, rect->relief, rect->gradient, False,
+ p, 5, rect->line_width);
}
else {
if ((rect->line_width <= wi->max_line_width) &&