aboutsummaryrefslogtreecommitdiff
path: root/generic/Curve.c
diff options
context:
space:
mode:
authorlecoanet2001-06-25 11:20:03 +0000
committerlecoanet2001-06-25 11:20:03 +0000
commita3adeee4ca08764b8e78282c4b1cd57a0d830c0d (patch)
tree45ce35e7184460623d82f84842f63326466e3374 /generic/Curve.c
parente3c6410aaa3aa3257d40a506b496c4cba137ae0c (diff)
downloadtkzinc-a3adeee4ca08764b8e78282c4b1cd57a0d830c0d.zip
tkzinc-a3adeee4ca08764b8e78282c4b1cd57a0d830c0d.tar.gz
tkzinc-a3adeee4ca08764b8e78282c4b1cd57a0d830c0d.tar.bz2
tkzinc-a3adeee4ca08764b8e78282c4b1cd57a0d830c0d.tar.xz
Modification des gradients
Diffstat (limited to 'generic/Curve.c')
-rw-r--r--generic/Curve.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/generic/Curve.c b/generic/Curve.c
index 8bda064..48b64ba 100644
--- a/generic/Curve.c
+++ b/generic/Curve.c
@@ -83,8 +83,7 @@ typedef struct _CurveItemStruct {
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;
ZnColor marker_color;
@@ -95,7 +94,7 @@ typedef struct _CurveItemStruct {
/* Private data */
ZnImage tile;
ZnPoly dev_shape;
- ZnColorGradient gradient;
+ ZnGradient *gradient;
#ifdef LIBART
ArtSVP *outline_svp;
ArtSVP *fill_svp;
@@ -119,7 +118,7 @@ static ZnAttrConfig cv_attrs[] = {
ZN_COORDS_FLAG, False },
{ ZN_CONFIG_UINT, "-fillalpha", NULL,
Tk_Offset(CurveItemStruct, fill_alpha), 0, ZN_DRAW_FLAG, False },
- { ZN_CONFIG_GRADIENT_COLOR, "-fillcolor", NULL,
+ { ZN_CONFIG_GRADIENT, "-fillcolor", NULL,
Tk_Offset(CurveItemStruct, fill_color), 0,
ZN_DRAW_FLAG|ZN_BORDER_FLAG, False },
{ ZN_CONFIG_PATTERN, "-fillpattern", NULL,
@@ -128,8 +127,6 @@ static ZnAttrConfig cv_attrs[] = {
Tk_Offset(CurveItemStruct, flags), FILLED_BIT, ZN_COORDS_FLAG, False },
{ ZN_CONFIG_LINE_END, "-firstend", NULL,
Tk_Offset(CurveItemStruct, first_end), 0, ZN_COORDS_FLAG, False },
- { ZN_CONFIG_GRADIENT_GEOM, "-gradient", NULL,
- Tk_Offset(CurveItemStruct, grad_geom), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_JOIN_STYLE, "-joinstyle", NULL,
Tk_Offset(CurveItemStruct, join_style), 0,
ZN_COORDS_FLAG, False },
@@ -282,12 +279,11 @@ Init(Item item,
SET(cv->flags, MARKED_BIT);
cv->marker = ZnUnspecifiedPattern;
cv->fill_alpha = 255;
- cv->fill_color = ZnGetColorGradient(wi->interp, wi->win,
- ZnNameOfColor(wi->fore_color));
+ cv->fill_color = ZnGetGradient(wi->interp, wi->win,
+ ZnNameOfColor(wi->fore_color));
cv->line_alpha = 255;
cv->line_color = ZnGetColorByValue(wi->win, wi->fore_color);
cv->marker_color = ZnGetColorByValue(wi->win, wi->fore_color);
- cv->grad_geom = NULL;
#ifdef LIBART
cv->outline_svp = cv->fill_svp = NULL;
#endif
@@ -336,7 +332,7 @@ Clone(Item item)
}
if (cv->gradient) {
- cv->gradient = ZnGetColorGradientByValue(cv->gradient);
+ cv->gradient = ZnGetGradientByValue(cv->gradient);
}
if (cv->line_pattern != ZnUnspecifiedPattern) {
cv->line_pattern = Tk_GetBitmap(wi->interp, wi->win,
@@ -364,11 +360,8 @@ Clone(Item item)
Tk_NameOfBitmap(wi->dpy, cv->marker));
}
cv->line_color = ZnGetColorByValue(wi->win, cv->line_color);
- cv->fill_color = ZnGetColorGradientByValue(cv->fill_color);
+ cv->fill_color = ZnGetGradientByValue(cv->fill_color);
cv->marker_color = ZnGetColorByValue(wi->win, cv->marker_color);
- if (cv->grad_geom) {
- cv->grad_geom = GradientGeomDuplicate(cv->grad_geom);
- }
#ifdef LIBART
cv->outline_svp = cv->fill_svp = NULL;
#endif
@@ -399,7 +392,7 @@ Destroy(Item item)
LineEndDelete(cv->last_end);
}
if (cv->gradient) {
- ZnFreeColorGradient(cv->gradient);
+ ZnFreeGradient(cv->gradient);
}
if (cv->tile != ZnUnspecifiedImage) {
Tk_FreeImage(cv->tile);
@@ -417,12 +410,9 @@ Destroy(Item item)
if (cv->marker != ZnUnspecifiedPattern) {
Tk_FreeBitmap(wi->dpy, cv->marker);
}
- ZnFreeColorGradient(cv->fill_color);
+ ZnFreeGradient(cv->fill_color);
ZnFreeColor(cv->line_color);
ZnFreeColor(cv->marker_color);
- if (cv->grad_geom) {
- GradientGeomDelete(cv->grad_geom);
- }
#ifdef GPC
if (cv->tristrip.num_strips) {
gpc_free_tristrip(&cv->tristrip);
@@ -499,12 +489,12 @@ Configure(Item item,
if (cv->gradient &&
(ISSET(*flags, ZN_BORDER_FLAG) || (cv->relief == RELIEF_FLAT))) {
- ZnFreeColorGradient(cv->gradient);
+ ZnFreeGradient(cv->gradient);
cv->gradient = NULL;
}
if ((cv->relief != RELIEF_FLAT) && !cv->gradient) {
cv->gradient = ZnGetReliefGradient(wi->interp, wi->win,
- ZnNameOfColor(ZnColorGradientMidColor(wi->win, cv->fill_color)));
+ ZnNameOfColor(ZnGetGradientColor(wi->win, cv->fill_color, 50.0)));
}
if (ISSET(*flags, ZN_TILE_FLAG)) {
Tk_Image tile;
@@ -1051,12 +1041,12 @@ Draw(Item item)
* Fill if requested.
*/
if (ISSET(cv->flags, FILLED_OK)) {
- if (cv->grad_geom) {
- DrawPolygonGradient(wi, cv->grad_geom, cv->fill_color, &cv->dev_shape,
+ if (!ZnGradientFlat(cv->fill_color)) {
+ DrawPolygonGradient(wi, cv->fill_color, &cv->dev_shape,
&item->item_bounding_box);
}
else {
- values.foreground = ZnPixel(ZnColorGradientMidColor(wi->win, cv->fill_color));
+ values.foreground = ZnPixel(ZnGetGradientColor(wi->win, cv->fill_color, 50.0));
gc_mask = GCFillStyle;
if (cv->tile != ZnUnspecifiedImage) { /* Fill tiled */
Pixmap pmap = GetImagePixmap(wi->win, cv->tile_name, cv->tile, NULL);
@@ -1267,7 +1257,7 @@ Render(Item item)
#ifdef LIBART
WidgetInfo *wi = item->wi;
CurveItem cv = (CurveItem) item;
- XColor *color = ZnColorGradientMidColor(wi->win, cv->fill_color);
+ XColor *color = ZnGetGradientColor(wi->win, cv->fill_color, 50.0);
ArtPixBuf *pixbuf = NULL;
if (cv->fill_svp != NULL) {