diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/Curve.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/generic/Curve.c b/generic/Curve.c index 46eaa05..df32562 100644 --- a/generic/Curve.c +++ b/generic/Curve.c @@ -88,12 +88,16 @@ typedef struct _CurveItemStruct { Pixmap line_pattern; ZnColor line_color; ZnColor marker_color; - char *tile_name; + int line_alpha; + int fill_alpha; + char *tile_name; /* Private data */ ZnImage tile; ZnPoly dev_shape; ZnColorGradient gradient; + ArtSVP *outline_svp; + ArtSVP *fill_svp; #ifdef GPC gpc_tristrip tristrip; #endif @@ -111,6 +115,8 @@ static ZnAttrConfig cv_attrs[] = { { ZN_CONFIG_BOOL, "-composescale", NULL, Tk_Offset(CurveItemStruct, header.flags), COMPOSE_SCALE_BIT, 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, Tk_Offset(CurveItemStruct, fill_color), 0, ZN_DRAW_FLAG|ZN_BORDER_FLAG, False }, @@ -127,6 +133,8 @@ static ZnAttrConfig cv_attrs[] = { ZN_COORDS_FLAG, False }, { ZN_CONFIG_LINE_END, "-lastend", NULL, Tk_Offset(CurveItemStruct, last_end), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_UINT, "-linealpha", NULL, + Tk_Offset(CurveItemStruct, line_alpha), 0, ZN_DRAW_FLAG, False }, { ZN_CONFIG_COLOR, "-linecolor", NULL, Tk_Offset(CurveItemStruct, line_color), 0, ZN_DRAW_FLAG, False }, @@ -276,6 +284,7 @@ Init(Item item, cv->line_color = ZnGetColorByValue(wi->win, wi->fore_color); cv->marker_color = ZnGetColorByValue(wi->win, wi->fore_color); cv->grad_geom = NULL; + cv->outline_svp = cv->fill_svp = NULL; return ZN_OK; } @@ -354,6 +363,10 @@ Clone(Item item) if (cv->grad_geom) { cv->grad_geom = GradientGeomDuplicate(cv->grad_geom); } + if (cv->outline_svp) { + } + if (cv->fill_svp) { + } } @@ -409,6 +422,12 @@ Destroy(Item item) gpc_free_tristrip(&cv->tristrip); } #endif + if (cv->outline_svp) { + art_svp_free(cv->outline_svp); + } + if (cv->fill_svp) { + art_svp_free(cv->fill_svp); + } } @@ -1173,6 +1192,38 @@ Draw(Item item) /* ********************************************************************************** * + * Render -- + * + ********************************************************************************** + */ +static void +Render(Item item) +{ + WidgetInfo *wi = item->wi; + CurveItem cv = (CurveItem) item; + XColor *color = ZnColorGradientMidColor(wi->win, cv->fill_color); + ArtPixBuf *pixbuf = NULL; + + if (cv->fill_svp != NULL) { + if (strlen(cv->tile_name) != 0) { + pixbuf = GetImagePixbuf(wi->win, cv->tile_name, cv->tile); + } + ITEM_P.RenderSVP(wi, cv->fill_svp, color->red, color->green, + color->blue, cv->fill_alpha & 0xff, + item->item_bounding_box.orig.x, + item->item_bounding_box.orig.y, pixbuf); + } + if (cv->outline_svp != NULL) { + ITEM_P.RenderSVP(wi, cv->outline_svp, cv->line_color->red, + cv->line_color->green, cv->line_color->blue, + cv->line_alpha & 0xff, 0, 0, NULL); + } +} + + +/* + ********************************************************************************** + * * IsSensitive -- * ********************************************************************************** @@ -1664,6 +1715,7 @@ static ItemClassStruct CURVE_ITEM_CLASS = { ComputeCoordinates, ToArea, Draw, + Render, IsSensitive, Pick, PickVertex, /* PickVertex */ |