summaryrefslogtreecommitdiff
path: root/src/drv
diff options
context:
space:
mode:
authorscuri <scuri>2010-06-02 18:48:00 +0000
committerscuri <scuri>2010-06-02 18:48:00 +0000
commitdd7a1955dbf538734dc54225eac5282e3ab35ff8 (patch)
tree4d29a87dbfc619b465451b2c7f737aa3ae60aab9 /src/drv
parent8fad87fe337472713488db707e58c6853fbe7662 (diff)
*** empty log message ***
Diffstat (limited to 'src/drv')
-rw-r--r--src/drv/cdpdf.c46
-rw-r--r--src/drv/cdps.c15
2 files changed, 38 insertions, 23 deletions
diff --git a/src/drv/cdpdf.c b/src/drv/cdpdf.c
index f6621d3..bc91a15 100644
--- a/src/drv/cdpdf.c
+++ b/src/drv/cdpdf.c
@@ -544,7 +544,7 @@ static void cdpoly(cdCtxCanvas *ctxcanvas, int mode, cdPoint* poly, int n)
int p;
/* if there is any current path, remove it */
- PDF_endpath(ctxcanvas->pdf);
+ /* Don't use PDF_endpath because here usually there will be no path scope */
i = 0;
for (p=0; p<ctxcanvas->canvas->path_n; p++)
@@ -552,7 +552,7 @@ static void cdpoly(cdCtxCanvas *ctxcanvas, int mode, cdPoint* poly, int n)
switch(ctxcanvas->canvas->path[p])
{
case CD_PATH_NEW:
- PDF_endpath(ctxcanvas->pdf);
+ /* Don't use PDF_endpath because here usually there will be no path scope */
break;
case CD_PATH_MOVETO:
if (i+1 > n) return;
@@ -561,7 +561,7 @@ static void cdpoly(cdCtxCanvas *ctxcanvas, int mode, cdPoint* poly, int n)
break;
case CD_PATH_LINETO:
if (i+1 > n) return;
- PDF_moveto(ctxcanvas->pdf, poly[i].x, poly[i].y);
+ PDF_lineto(ctxcanvas->pdf, poly[i].x, poly[i].y);
i++;
break;
case CD_PATH_ARC:
@@ -582,18 +582,22 @@ static void cdpoly(cdCtxCanvas *ctxcanvas, int mode, cdPoint* poly, int n)
}
else /* Ellipse: change the scale to create from the circle */
{
- PDF_save(ctxcanvas->pdf); /* save to use the local transform */
+ /* NOT SUPPORTED IN PATH SCOPE!!!!
+ PDF_save(ctxcanvas->pdf);
PDF_translate(ctxcanvas->pdf, xc, yc);
PDF_scale(ctxcanvas->pdf, w/h, 1);
- PDF_translate(ctxcanvas->pdf, -xc, -yc);
+ PDF_translate(ctxcanvas->pdf, -xc, -yc); */
+ double s = h;
+ if (w > h)
+ s = w;
if ((a2-a1)<0)
- PDF_arcn(ctxcanvas->pdf, xc, yc, 0.5*h, a1, a2);
+ PDF_arcn(ctxcanvas->pdf, xc, yc, 0.5*s, a1, a2);
else
- PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*h, a1, a2);
+ PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*s, a1, a2);
- PDF_restore(ctxcanvas->pdf); /* restore from local */
+ /* PDF_restore(ctxcanvas->pdf); */
}
i += 3;
@@ -711,7 +715,7 @@ static void cdfpoly(cdCtxCanvas *ctxcanvas, int mode, cdfPoint* poly, int n)
break;
case CD_PATH_LINETO:
if (i+1 > n) return;
- PDF_moveto(ctxcanvas->pdf, poly[i].x, poly[i].y);
+ PDF_lineto(ctxcanvas->pdf, poly[i].x, poly[i].y);
i++;
break;
case CD_PATH_ARC:
@@ -724,18 +728,30 @@ static void cdfpoly(cdCtxCanvas *ctxcanvas, int mode, cdfPoint* poly, int n)
return;
if (w==h)
- PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*w, a1, a2);
+ {
+ if ((a2-a1)<0)
+ PDF_arcn(ctxcanvas->pdf, xc, yc, 0.5*w, a1, a2);
+ else
+ PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*w, a1, a2);
+ }
else /* Ellipse: change the scale to create from the circle */
{
- PDF_save(ctxcanvas->pdf); /* save to use the local transform */
+ /* NOT SUPPORTED IN PATH SCOPE!!!!
+ PDF_save(ctxcanvas->pdf);
PDF_translate(ctxcanvas->pdf, xc, yc);
PDF_scale(ctxcanvas->pdf, w/h, 1);
- PDF_translate(ctxcanvas->pdf, -xc, -yc);
+ PDF_translate(ctxcanvas->pdf, -xc, -yc); */
+ double s = h;
+ if (w > h)
+ s = w;
- PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*h, a1, a2);
+ if ((a2-a1)<0)
+ PDF_arcn(ctxcanvas->pdf, xc, yc, 0.5*s, a1, a2);
+ else
+ PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*s, a1, a2);
- PDF_restore(ctxcanvas->pdf); /* restore from local */
+ /* PDF_restore(ctxcanvas->pdf); */
}
i += 3;
@@ -831,7 +847,7 @@ static void cdfpoly(cdCtxCanvas *ctxcanvas, int mode, cdfPoint* poly, int n)
static int cdlinestyle(cdCtxCanvas *ctxcanvas, int style)
{
double mm = (72.0/25.4) / ctxcanvas->scale;
- char options[80];
+ char options[200];
switch (style)
{
diff --git a/src/drv/cdps.c b/src/drv/cdps.c
index 357abf4..5c40103 100644
--- a/src/drv/cdps.c
+++ b/src/drv/cdps.c
@@ -1109,12 +1109,13 @@ static void cdpoly(cdCtxCanvas *ctxcanvas, int mode, cdPoint* poly, int n)
break;
case CD_PATH_ARC:
{
- double xc, yc, w, h, a1, a2;
+ int xc, yc, w, h;
+ double a1, a2;
char* arc = "arc";
if (i+3 > n) return;
- if (!cdCanvasGetArcPathF(ctxcanvas->canvas, poly+i, &xc, &yc, &w, &h, &a1, &a2))
+ if (!cdCanvasGetArcPath(ctxcanvas->canvas, poly+i, &xc, &yc, &w, &h, &a1, &a2))
return;
if ((a2-a1)<0)
@@ -1122,14 +1123,13 @@ static void cdpoly(cdCtxCanvas *ctxcanvas, int mode, cdPoint* poly, int n)
if (w==h) /* Circulo: PS implementa direto */
{
- fprintf(ctxcanvas->file, "N %d %d %g %g %g %s\n", xc, yc, 0.5*w, a1, a2, arc);
+ fprintf(ctxcanvas->file, "%d %d %g %g %g %s\n", xc, yc, 0.5*w, a1, a2, arc);
}
else /* Elipse: mudar a escala p/ criar a partir do circulo */
{
fprintf(ctxcanvas->file, "[0 0 0 0 0 0] currentmatrix\n"); /* fill new matrix from CTM */
fprintf(ctxcanvas->file, "%d %d translate\n", xc, yc);
fprintf(ctxcanvas->file, "1 %g scale\n", ((double)h)/w);
- fprintf(ctxcanvas->file, "N\n");
fprintf(ctxcanvas->file, "0 0 %g %g %g %s\n", 0.5*w, a1, a2, arc);
fprintf(ctxcanvas->file, "setmatrix\n"); /* back to CTM */
}
@@ -1171,9 +1171,9 @@ static void cdpoly(cdCtxCanvas *ctxcanvas, int mode, cdPoint* poly, int n)
break;
case CD_PATH_CLIP:
if (ctxcanvas->canvas->fill_mode==CD_EVENODD)
- fprintf(ctxcanvas->file, "C eoclip\n");
+ fprintf(ctxcanvas->file, "closepath eoclip\n");
else
- fprintf(ctxcanvas->file, "C clip\n");
+ fprintf(ctxcanvas->file, "closepath clip\n");
break;
}
}
@@ -1315,14 +1315,13 @@ static void cdfpoly(cdCtxCanvas *ctxcanvas, int mode, cdfPoint* poly, int n)
if (w==h) /* Circulo: PS implementa direto */
{
- fprintf(ctxcanvas->file, "N %g %g %g %g %g %s\n", xc, yc, 0.5*w, a1, a2, arc);
+ fprintf(ctxcanvas->file, "%g %g %g %g %g %s\n", xc, yc, 0.5*w, a1, a2, arc);
}
else /* Elipse: mudar a escala p/ criar a partir do circulo */
{
fprintf(ctxcanvas->file, "[0 0 0 0 0 0] currentmatrix\n"); /* fill new matrix from CTM */
fprintf(ctxcanvas->file, "%g %g translate\n", xc, yc);
fprintf(ctxcanvas->file, "1 %g scale\n", ((double)h)/w);
- fprintf(ctxcanvas->file, "N\n");
fprintf(ctxcanvas->file, "0 0 %g %g %g %s\n", 0.5*w, a1, a2, arc);
fprintf(ctxcanvas->file, "setmatrix\n"); /* back to CTM */
}