From f0ebc4f3affbac34920f7be557312927e6cf8a81 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Thu, 11 May 2000 13:58:17 +0000 Subject: Adaptation suite � la r�alisation des polygones multi-contours. --- generic/Rectangle.c | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'generic/Rectangle.c') 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 }; -- cgit v1.1