aboutsummaryrefslogtreecommitdiff
path: root/generic/Curve.c
diff options
context:
space:
mode:
authorlecoanet2000-11-13 10:14:51 +0000
committerlecoanet2000-11-13 10:14:51 +0000
commit43907650b84fe72741678e0c992555d762f50777 (patch)
tree6123809c61225a62f02242837de9f9f98e23f74f /generic/Curve.c
parent96679897294bf893e91a81b0005ef05c82c03258 (diff)
downloadtkzinc-43907650b84fe72741678e0c992555d762f50777.zip
tkzinc-43907650b84fe72741678e0c992555d762f50777.tar.gz
tkzinc-43907650b84fe72741678e0c992555d762f50777.tar.bz2
tkzinc-43907650b84fe72741678e0c992555d762f50777.tar.xz
D�but d'impl�mentation de la m�thode Render et modif de
ComputeCoordinates. Ajout des attributs -linealpha et -fillalpha.
Diffstat (limited to 'generic/Curve.c')
-rw-r--r--generic/Curve.c54
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 */