aboutsummaryrefslogtreecommitdiff
path: root/Bezier.c
diff options
context:
space:
mode:
authorlecoanet2001-06-25 11:20:03 +0000
committerlecoanet2001-06-25 11:20:03 +0000
commita3adeee4ca08764b8e78282c4b1cd57a0d830c0d (patch)
tree45ce35e7184460623d82f84842f63326466e3374 /Bezier.c
parente3c6410aaa3aa3257d40a506b496c4cba137ae0c (diff)
downloadtkzinc-a3adeee4ca08764b8e78282c4b1cd57a0d830c0d.zip
tkzinc-a3adeee4ca08764b8e78282c4b1cd57a0d830c0d.tar.gz
tkzinc-a3adeee4ca08764b8e78282c4b1cd57a0d830c0d.tar.bz2
tkzinc-a3adeee4ca08764b8e78282c4b1cd57a0d830c0d.tar.xz
Modification des gradients
Diffstat (limited to 'Bezier.c')
-rw-r--r--Bezier.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/Bezier.c b/Bezier.c
index 9f55f53..d239c4b 100644
--- a/Bezier.c
+++ b/Bezier.c
@@ -75,8 +75,7 @@ typedef struct _BezierItemStruct {
ReliefStyle relief;
int line_width; /* If 0 the path is not drawn, if <2 relief is flat */
Pixmap fill_pattern;
- ZnColorGradient fill_color;
- ZnGradientGeom grad_geom;
+ ZnGradient *fill_color;
Pixmap line_pattern;
ZnColor line_color;
char *tile_name;
@@ -84,7 +83,7 @@ typedef struct _BezierItemStruct {
/* Private data */
ZnImage tile;
ZnList dev_points;
- ZnColorGradient gradient;
+ ZnGradient *gradient;
} BezierItemStruct, *BezierItem;
@@ -98,7 +97,7 @@ static ZnAttrConfig bz_attrs[] = {
{ ZN_CONFIG_BOOL, "-composescale", NULL,
Tk_Offset(BezierItemStruct, header.flags), COMPOSE_SCALE_BIT,
ZN_COORDS_FLAG, False },
- { ZN_CONFIG_GRADIENT_COLOR, "-fillcolor", NULL,
+ { ZN_CONFIG_GRADIENT, "-fillcolor", NULL,
Tk_Offset(BezierItemStruct, fill_color), 0,
ZN_DRAW_FLAG|ZN_BORDER_FLAG, False },
{ ZN_CONFIG_PATTERN, "-fillpattern", NULL,
@@ -107,8 +106,6 @@ static ZnAttrConfig bz_attrs[] = {
Tk_Offset(BezierItemStruct, flags), FILLED_BIT, ZN_COORDS_FLAG, False },
{ ZN_CONFIG_LINE_END, "-firstend", NULL,
Tk_Offset(BezierItemStruct, first_end), 0, ZN_COORDS_FLAG, False },
- { ZN_CONFIG_GRADIENT_GEOM, "-gradient", NULL,
- Tk_Offset(BezierItemStruct, grad_geom), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_LINE_END, "-lastend", NULL,
Tk_Offset(BezierItemStruct, last_end), 0, ZN_COORDS_FLAG, False },
{ ZN_CONFIG_COLOR, "-linecolor", NULL,
@@ -231,10 +228,9 @@ Init(Item item,
bz->line_pattern = ZnUnspecifiedPattern;
bz->cap_style = CapRound;
- bz->fill_color = ZnGetColorGradient(wi->interp, wi->win,
- ZnNameOfColor(wi->fore_color));
+ bz->fill_color = ZnGetGradient(wi->interp, wi->win,
+ ZnNameOfColor(wi->fore_color));
bz->line_color = ZnGetColorByValue(wi->win, wi->fore_color);
- bz->grad_geom = NULL;
return ZN_OK;
}
@@ -257,7 +253,7 @@ Clone(Item item)
bz->dev_points = NULL;
if (bz->gradient) {
- bz->gradient = ZnGetColorGradientByValue(bz->gradient);
+ bz->gradient = ZnGetGradientByValue(bz->gradient);
}
if (bz->points) {
bz->points = ZnListDuplicate(bz->points);
@@ -284,10 +280,7 @@ Clone(Item item)
Tk_NameOfBitmap(wi->dpy, bz->fill_pattern));
}
bz->line_color = ZnGetColorByValue(wi->win, bz->line_color);
- bz->fill_color = ZnGetColorGradientByValue(bz->fill_color);
- if (bz->grad_geom) {
- bz->grad_geom = GradientGeomDuplicate(bz->grad_geom);
- }
+ bz->fill_color = ZnGetGradientByValue(bz->fill_color);
}
@@ -317,7 +310,7 @@ Destroy(Item item)
LineEndDelete(bz->last_end);
}
if (bz->gradient) {
- ZnFreeColorGradient(bz->gradient);
+ ZnFreeGradient(bz->gradient);
}
if (bz->tile != ZnUnspecifiedImage) {
Tk_FreeImage(bz->tile);
@@ -332,11 +325,8 @@ Destroy(Item item)
if (bz->fill_pattern != ZnUnspecifiedPattern) {
Tk_FreeBitmap(wi->dpy, bz->fill_pattern);
}
- ZnFreeColorGradient(bz->fill_color);
+ ZnFreeGradient(bz->fill_color);
ZnFreeColor(bz->line_color);
- if (bz->grad_geom) {
- GradientGeomDelete(bz->grad_geom);
- }
}
@@ -391,12 +381,12 @@ Configure(Item item,
if (bz->gradient &&
(ISSET(*flags, ZN_BORDER_FLAG) || (bz->relief == RELIEF_FLAT))) {
- ZnFreeColorGradient(bz->gradient);
+ ZnFreeGradient(bz->gradient);
bz->gradient = NULL;
}
if ((bz->relief != RELIEF_FLAT) && !bz->gradient) {
bz->gradient = ZnGetReliefGradient(wi->interp, wi->win,
- ZnNameOfColor(ZnColorGradientMidColor(wi->win, bz->fill_color)));
+ ZnNameOfColor(ZnGetGradientColor(wi->win, bz->fill_color, 50.0)));
}
if (ISSET(*flags, ZN_TILE_FLAG)) {
Tk_Image tile;
@@ -697,14 +687,14 @@ Draw(Item item)
* Fill if requested.
*/
if (ISSET(bz->flags, FILLED_OK)) {
- if (bz->grad_geom) {
+ if (!ZnGradientFlat(bz->fill_color)) {
ZnPoly poly;
POLY_CONTOUR1(&poly, points, num_points);
- DrawPolygonGradient(wi, bz->grad_geom, bz->fill_color, &poly,
+ DrawPolygonGradient(wi, bz->fill_color, &poly,
&item->item_bounding_box);
}
else {
- values.foreground = ZnPixel(ZnColorGradientMidColor(wi->win, bz->fill_color));
+ values.foreground = ZnPixel(ZnGetGradientColor(wi->win, bz->fill_color, 50.0));
gc_mask = GCFillStyle;
if (bz->tile != ZnUnspecifiedImage) { /* Fill tiled */
Pixmap pmap = GetImagePixmap(wi->win, bz->tile_name, bz->tile, NULL);