summaryrefslogtreecommitdiff
path: root/src/drv
diff options
context:
space:
mode:
authorscuri <scuri>2010-04-29 16:12:58 +0000
committerscuri <scuri>2010-04-29 16:12:58 +0000
commitafaff9e085b51c822f0ce31ac91cc8196bfa5113 (patch)
treec8eb0a5437797c1efbea40d1d479f7a0035dc40b /src/drv
parent960149c4fc4aee0cc886d5447670e66a07531965 (diff)
Changed: CD_DXF now supports solid filled primitives for polygons and rectangles.
Diffstat (limited to 'src/drv')
-rw-r--r--src/drv/cddxf.c46
1 files changed, 40 insertions, 6 deletions
diff --git a/src/drv/cddxf.c b/src/drv/cddxf.c
index 1c961fa..9f67ef4 100644
--- a/src/drv/cddxf.c
+++ b/src/drv/cddxf.c
@@ -465,7 +465,7 @@ static void cdline (cdCtxCanvas *ctxcanvas, int x1, int y1, int x2, int y2)
writepoly (ctxcanvas, line, 2); /* draw line as a polygon */
}
-static void cdboxrect(cdCtxCanvas *ctxcanvas, int xmin, int xmax, int ymin, int ymax)
+static void cdrect(cdCtxCanvas *ctxcanvas, int xmin, int xmax, int ymin, int ymax)
{
cdPoint rect[5]; /* uses new array of points to avoid */
@@ -482,6 +482,23 @@ static void cdboxrect(cdCtxCanvas *ctxcanvas, int xmin, int xmax, int ymin, int
writepoly (ctxcanvas, rect, 5); /* draw box as a polygon */
}
+static void cdbox(cdCtxCanvas *ctxcanvas, int xmin, int xmax, int ymin, int ymax)
+{
+ cdPoint rect[5]; /* uses new array of points to avoid */
+
+ rect[0].x = xmin;
+ rect[0].y = ymin;
+ rect[1].x = xmin;
+ rect[1].y = ymax;
+ rect[2].x = xmax; /* box edges */
+ rect[2].y = ymax;
+ rect[3].x = xmax;
+ rect[3].y = ymin;
+ rect[4].x = xmin;
+ rect[4].y = ymin;
+ writehatch (ctxcanvas, rect, 5); /* write fill area */
+}
+
static void cdfpoly(cdCtxCanvas *ctxcanvas, int mode, cdfPoint* poly, int n)
{
if (mode == CD_CLOSED_LINES || mode == CD_FILL)
@@ -508,7 +525,7 @@ static void cdfline (cdCtxCanvas *ctxcanvas, double x1, double y1, double x2, do
writepolyf (ctxcanvas, line, 2); /* draw line as a polygon */
}
-static void cdfboxrect(cdCtxCanvas *ctxcanvas, double xmin, double xmax, double ymin, double ymax)
+static void cdfrect(cdCtxCanvas *ctxcanvas, double xmin, double xmax, double ymin, double ymax)
{
cdfPoint rect[5]; /* uses new array of points to avoid */
@@ -525,6 +542,23 @@ static void cdfboxrect(cdCtxCanvas *ctxcanvas, double xmin, double xmax, double
writepolyf (ctxcanvas, rect, 5); /* draw box as a polygon */
}
+static void cdfbox(cdCtxCanvas *ctxcanvas, double xmin, double xmax, double ymin, double ymax)
+{
+ cdfPoint rect[5]; /* uses new array of points to avoid */
+
+ rect[0].x = xmin;
+ rect[0].y = ymin;
+ rect[1].x = xmin;
+ rect[1].y = ymax;
+ rect[2].x = xmax; /* box edges */
+ rect[2].y = ymax;
+ rect[3].x = xmax;
+ rect[3].y = ymin;
+ rect[4].x = xmin;
+ rect[4].y = ymin;
+ writehatchf (ctxcanvas, rect, 5); /* write fill area */
+}
+
/*--------------------------------------------------------------------------*/
/* gives radius of the circle most resembling elliptic arc at angle t */
/*--------------------------------------------------------------------------*/
@@ -1270,12 +1304,12 @@ static void cdinittable(cdCanvas* canvas)
canvas->cxPixel = cdpixel;
canvas->cxLine = cdline;
canvas->cxPoly = cdpoly;
- canvas->cxRect = cdboxrect;
- canvas->cxBox = cdboxrect;
+ canvas->cxRect = cdrect;
+ canvas->cxBox = cdbox;
canvas->cxFLine = cdfline;
canvas->cxFPoly = cdfpoly;
- canvas->cxFRect = cdfboxrect;
- canvas->cxFBox = cdfboxrect;
+ canvas->cxFRect = cdfrect;
+ canvas->cxFBox = cdfbox;
canvas->cxArc = cdarc;
canvas->cxSector = cdsector;
canvas->cxText = cdtext;