aboutsummaryrefslogtreecommitdiff
path: root/generic/Rectangle.c
diff options
context:
space:
mode:
authorlecoanet2000-05-11 13:58:17 +0000
committerlecoanet2000-05-11 13:58:17 +0000
commitf0ebc4f3affbac34920f7be557312927e6cf8a81 (patch)
tree99f96d06ee7a903c1df7793802fcf337c14d45c5 /generic/Rectangle.c
parent9663a916b72352db78f2d17d5268c1018904f967 (diff)
downloadtkzinc-f0ebc4f3affbac34920f7be557312927e6cf8a81.zip
tkzinc-f0ebc4f3affbac34920f7be557312927e6cf8a81.tar.gz
tkzinc-f0ebc4f3affbac34920f7be557312927e6cf8a81.tar.bz2
tkzinc-f0ebc4f3affbac34920f7be557312927e6cf8a81.tar.xz
Adaptation suite � la r�alisation des polygones multi-contours.
Diffstat (limited to 'generic/Rectangle.c')
-rw-r--r--generic/Rectangle.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/generic/Rectangle.c b/generic/Rectangle.c
index 10bf3e4..b1be39f 100644
--- a/generic/Rectangle.c
+++ b/generic/Rectangle.c
@@ -455,7 +455,7 @@ ToArea(Item item,
result = -1;
if (ISSET(rect->flags, FILLED_BIT)) {
- result = PolygonInBBox(rect->dev, 4, area);
+ result = PolygonInBBox(rect->dev, 4, area, NULL);
}
else if (rect->line_width > 0) {
int i;
@@ -534,7 +534,9 @@ Draw(Item item)
DrawRectangleGradient(wi, rect->grad_geom, rect->fill_color, &r);
}
else {
- DrawPolygonGradient(wi, rect->grad_geom, rect->fill_color, rect->dev, 4,
+ ZnPoly poly;
+ POLY_CONTOUR1(&poly, rect->dev, 4);
+ DrawPolygonGradient(wi, rect->grad_geom, rect->fill_color, &poly,
&item->item_bounding_box);
}
}
@@ -710,12 +712,12 @@ PostScript(Item item,
*/
static ZnBool
GetClipVertices(Item item,
- ZnPoint **points,
- int *num_points)
+ ZnPoly *poly)
{
RectangleItem rect = (RectangleItem) item;
double delta;
ZnBool aligned;
+ ZnPoint *points;
delta = rect->dev[0].y - rect->dev[1].y;
delta = ABS(delta);
@@ -726,29 +728,28 @@ GetClipVertices(Item item,
if (aligned) {
ZnListAssertSize(item->wi->work_pts, 2);
- *points = (ZnPoint *) ZnListArray(item->wi->work_pts);
- *num_points = 2;
+ points = (ZnPoint *) ZnListArray(item->wi->work_pts);
+ POLY_CONTOUR1(poly, points, 2);
if (rect->dev[0].x < rect->dev[2].x) {
- (*points)[0].x = rect->dev[0].x;
- (*points)[1].x = rect->dev[2].x+1.0;
+ points[0].x = rect->dev[0].x;
+ points[1].x = rect->dev[2].x+1.0;
}
else {
- (*points)[0].x = rect->dev[2].x;
- (*points)[1].x = rect->dev[0].x+1.0;
+ points[0].x = rect->dev[2].x;
+ points[1].x = rect->dev[0].x+1.0;
}
if (rect->dev[0].y < rect->dev[2].y) {
- (*points)[0].y = rect->dev[0].y;
- (*points)[1].y = rect->dev[2].y+1.0;
+ points[0].y = rect->dev[0].y;
+ points[1].y = rect->dev[2].y+1.0;
}
else {
- (*points)[0].y = rect->dev[2].y;
- (*points)[1].y = rect->dev[0].y+1.0;
+ points[0].y = rect->dev[2].y;
+ points[1].y = rect->dev[0].y+1.0;
}
}
else {
- *points = rect->dev;
- *num_points = 4;
+ POLY_CONTOUR1(poly, rect->dev, 4);
}
return aligned;
@@ -765,6 +766,7 @@ GetClipVertices(Item item,
*/
static int
Coords(Item item,
+ int contour,
int index,
int cmd,
ZnPoint **pts,
@@ -833,9 +835,9 @@ Coords(Item item,
*/
static ItemClassStruct RECTANGLE_ITEM_CLASS = {
sizeof(RectangleItemStruct),
- False,
- False,
- False,
+ False, /* has_fields */
+ False, /* has_parts */
+ False, /* has_anchors */
"rectangle",
rect_attrs,
Init,
@@ -843,15 +845,17 @@ static ItemClassStruct RECTANGLE_ITEM_CLASS = {
Destroy,
Configure,
Query,
- NULL,
- NULL,
+ NULL, /* GetFieldSet */
+ NULL, /* GetAnchor */
GetClipVertices,
Coords,
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
IsSensitive,
Pick,
+ NULL, /* PickVertex */
PostScript
};