m_clipping = TRUE;
- PsPrintf( wxT("gsave\n newpath\n"
- "%d %d moveto\n"
- "%d %d lineto\n"
- "%d %d lineto\n"
- "%d %d lineto\n"
- "closepath clip newpath\n"),
+ PsPrintf( wxT("gsave\n newpath\n")
+ wxT("%d %d moveto\n")
+ wxT("%d %d lineto\n")
+ wxT("%d %d lineto\n")
+ wxT("%d %d lineto\n")
+ wxT("closepath clip newpath\n"),
LogicalToDeviceX(x), LogicalToDeviceY(y),
LogicalToDeviceX(x+w), LogicalToDeviceY(y),
LogicalToDeviceX(x+w), LogicalToDeviceY(y+h),
SetPen( m_pen );
- PsPrintf( wxT("newpath\n"
- "%d %d moveto\n"
- "%d %d lineto\n"
- "stroke\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d moveto\n")
+ wxT("%d %d lineto\n")
+ wxT("stroke\n"),
LogicalToDeviceX(x1), LogicalToDeviceY(y1),
LogicalToDeviceX(x2), LogicalToDeviceY (y2) );
{
SetBrush( m_brush );
- PsPrintf( wxT("newpath\n"
- "%d %d %d %d %d %d ellipse\n"
- "%d %d lineto\n"
- "closepath\n"
- "fill\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d %d %d %d %d ellipse\n")
+ wxT("%d %d lineto\n")
+ wxT("closepath\n")
+ wxT("fill\n"),
LogicalToDeviceX(xc), LogicalToDeviceY(yc), LogicalToDeviceXRel(radius), LogicalToDeviceYRel(radius), (wxCoord)alpha1, (wxCoord) alpha2,
LogicalToDeviceX(xc), LogicalToDeviceY(yc) );
{
SetPen( m_pen );
- PsPrintf( wxT("newpath\n"
- "%d %d %d %d %d %d ellipse\n"
- "%d %d lineto\n"
- "stroke\n"
- "fill\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d %d %d %d %d ellipse\n")
+ wxT("%d %d lineto\n")
+ wxT("stroke\n")
+ wxT("fill\n"),
LogicalToDeviceX(xc), LogicalToDeviceY(yc), LogicalToDeviceXRel(radius), LogicalToDeviceYRel(radius), (wxCoord)alpha1, (wxCoord) alpha2,
LogicalToDeviceX(xc), LogicalToDeviceY(yc) );
{
SetBrush( m_brush );
- PsPrintf( wxT("newpath\n"
- "%d %d %d %d %d %d true ellipticarc\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d %d %d %d %d true ellipticarc\n"),
LogicalToDeviceX(x+w/2), LogicalToDeviceY(y+h/2),
LogicalToDeviceXRel(w/2), LogicalToDeviceYRel(h/2),
(wxCoord)sa, (wxCoord)ea );
{
SetPen( m_pen );
- PsPrintf( wxT("newpath\n"
- "%d %d %d %d %d %d false ellipticarc\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d %d %d %d %d false ellipticarc\n"),
LogicalToDeviceX(x+w/2), LogicalToDeviceY(y+h/2),
LogicalToDeviceXRel(w/2), LogicalToDeviceYRel(h/2),
(wxCoord)sa, (wxCoord)ea );
SetPen (m_pen);
- PsPrintf( wxT("newpath\n"
- "%d %d moveto\n"
- "%d %d lineto\n"
- "stroke\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d moveto\n")
+ wxT("%d %d lineto\n")
+ wxT("stroke\n"),
LogicalToDeviceX(x), LogicalToDeviceY(y),
LogicalToDeviceX(x+1), LogicalToDeviceY(y) );
}
}
-void wxPostScriptDC::DoDrawPolyPolygon (int n, int start[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
+void wxPostScriptDC::DoDrawPolyPolygon (int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
PsPrint( "newpath\n" );
int ofs = 0;
- for (int i = 0; i < n; ofs += start[i++])
+ for (int i = 0; i < n; ofs += count[i++])
{
wxCoord xx = LogicalToDeviceX(points[ofs].x + xoffset);
wxCoord yy = LogicalToDeviceY(points[ofs].y + yoffset);
CalcBoundingBox( points[ofs].x + xoffset, points[ofs].y + yoffset );
- for (int j = 1; j < start[i]; j++)
+ for (int j = 1; j < count[i]; j++)
{
xx = LogicalToDeviceX(points[ofs+j].x + xoffset);
yy = LogicalToDeviceY(points[ofs+j].y + yoffset);
PsPrint( "newpath\n" );
int ofs = 0;
- for (int i = 0; i < n; ofs += start[i++])
+ for (int i = 0; i < n; ofs += count[i++])
{
wxCoord xx = LogicalToDeviceX(points[ofs].x + xoffset);
wxCoord yy = LogicalToDeviceY(points[ofs].y + yoffset);
CalcBoundingBox( points[ofs].x + xoffset, points[ofs].y + yoffset );
- for (int j = 1; j < start[i]; j++)
+ for (int j = 1; j < count[i]; j++)
{
xx = LogicalToDeviceX(points[ofs+j].x + xoffset);
yy = LogicalToDeviceY(points[ofs+j].y + yoffset);
CalcBoundingBox( LogicalToDeviceX(points[i].x+xoffset), LogicalToDeviceY(points[i].y+yoffset));
}
- PsPrintf( wxT("newpath\n"
- "%d %d moveto\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d moveto\n"),
LogicalToDeviceX(points[0].x+xoffset),
LogicalToDeviceY(points[0].y+yoffset) );
{
SetBrush( m_brush );
- PsPrintf( wxT("newpath\n"
- "%d %d moveto\n"
- "%d %d lineto\n"
- "%d %d lineto\n"
- "%d %d lineto\n"
- "closepath\n"
- "fill\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d moveto\n")
+ wxT("%d %d lineto\n")
+ wxT("%d %d lineto\n")
+ wxT("%d %d lineto\n")
+ wxT("closepath\n")
+ wxT("fill\n"),
LogicalToDeviceX(x), LogicalToDeviceY(y),
LogicalToDeviceX(x + width), LogicalToDeviceY(y),
LogicalToDeviceX(x + width), LogicalToDeviceY(y + height),
{
SetPen (m_pen);
- PsPrintf( wxT("newpath\n"
- "%d %d moveto\n"
- "%d %d lineto\n"
- "%d %d lineto\n"
- "%d %d lineto\n"
- "closepath\n"
- "stroke\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d moveto\n")
+ wxT("%d %d lineto\n")
+ wxT("%d %d lineto\n")
+ wxT("%d %d lineto\n")
+ wxT("closepath\n")
+ wxT("stroke\n"),
LogicalToDeviceX(x), LogicalToDeviceY(y),
LogicalToDeviceX(x + width), LogicalToDeviceY(y),
LogicalToDeviceX(x + width), LogicalToDeviceY(y + height),
SetBrush( m_brush );
/* Draw rectangle anticlockwise */
- PsPrintf( wxT("newpath\n"
- "%d %d %d 90 180 arc\n"
- "%d %d moveto\n"
- "%d %d %d 180 270 arc\n"
- "%d %d lineto\n"
- "%d %d %d 270 0 arc\n"
- "%d %d lineto\n"
- "%d %d %d 0 90 arc\n"
- "%d %d lineto\n"
- "closepath\n"
- "fill\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d %d 90 180 arc\n")
+ wxT("%d %d moveto\n")
+ wxT("%d %d %d 180 270 arc\n")
+ wxT("%d %d lineto\n")
+ wxT("%d %d %d 270 0 arc\n")
+ wxT("%d %d lineto\n")
+ wxT("%d %d %d 0 90 arc\n")
+ wxT("%d %d lineto\n")
+ wxT("closepath\n")
+ wxT("fill\n"),
LogicalToDeviceX(x + rad), LogicalToDeviceY(y + rad), LogicalToDeviceXRel(rad),
LogicalToDeviceX(x), LogicalToDeviceY(y + rad),
LogicalToDeviceX(x + rad), LogicalToDeviceY(y + height - rad), LogicalToDeviceXRel(rad),
SetPen (m_pen);
/* Draw rectangle anticlockwise */
- PsPrintf( wxT("newpath\n"
- "%d %d %d 90 180 arc\n"
- "%d %d moveto\n"
- "%d %d %d 180 270 arc\n"
- "%d %d lineto\n"
- "%d %d %d 270 0 arc\n"
- "%d %d lineto\n"
- "%d %d %d 0 90 arc\n"
- "%d %d lineto\n"
- "closepath\n"
- "stroke\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d %d 90 180 arc\n")
+ wxT("%d %d moveto\n")
+ wxT("%d %d %d 180 270 arc\n")
+ wxT("%d %d lineto\n")
+ wxT("%d %d %d 270 0 arc\n")
+ wxT("%d %d lineto\n")
+ wxT("%d %d %d 0 90 arc\n")
+ wxT("%d %d lineto\n")
+ wxT("closepath\n")
+ wxT("stroke\n"),
LogicalToDeviceX(x + rad), LogicalToDeviceY(y + rad), LogicalToDeviceXRel(rad),
LogicalToDeviceX(x), LogicalToDeviceY(y + rad),
LogicalToDeviceX(x + rad), LogicalToDeviceY(y + height - rad), LogicalToDeviceXRel(rad),
{
SetBrush (m_brush);
- PsPrintf( wxT("newpath\n"
- "%d %d %d %d 0 360 ellipse\n"
- "fill\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d %d %d 0 360 ellipse\n")
+ wxT("fill\n"),
LogicalToDeviceX(x + width / 2), LogicalToDeviceY(y + height / 2),
LogicalToDeviceXRel(width / 2), LogicalToDeviceYRel(height / 2) );
{
SetPen (m_pen);
- PsPrintf( wxT("newpath\n"
- "%d %d %d %d 0 360 ellipse\n"
- "stroke\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d %d %d 0 360 ellipse\n")
+ wxT("stroke\n"),
LogicalToDeviceX(x + width / 2), LogicalToDeviceY(y + height / 2),
LogicalToDeviceXRel(width / 2), LogicalToDeviceYRel(height / 2) );
wxCoord xx = LogicalToDeviceX(x);
wxCoord yy = LogicalToDeviceY(y + bitmap.GetHeight());
- PsPrintf( wxT("/origstate save def\n"
- "20 dict begin\n"
- "/pix %d string def\n"
- "/grays %d string def\n"
- "/npixels 0 def\n"
- "/rgbindx 0 def\n"
- "%d %d translate\n"
- "%d %d scale\n"
- "%d %d 8\n"
- "[%d 0 0 %d 0 %d]\n"
- "{currentfile pix readhexstring pop}\n"
- "false 3 colorimage\n"),
+ PsPrintf( wxT("/origstate save def\n")
+ wxT("20 dict begin\n")
+ wxT("/pix %d string def\n")
+ wxT("/grays %d string def\n")
+ wxT("/npixels 0 def\n")
+ wxT("/rgbindx 0 def\n")
+ wxT("%d %d translate\n")
+ wxT("%d %d scale\n")
+ wxT("%d %d 8\n")
+ wxT("[%d 0 0 %d 0 %d]\n")
+ wxT("{currentfile pix readhexstring pop}\n")
+ wxT("false 3 colorimage\n"),
w, w, xx, yy, ww, hh, w, h, w, -h, h );
unsigned char* data = image.GetData();
}
}
+ // We may legitimately call SetFont before BeginDoc
+ if (!m_pstream)
+ return;
+
PsPrint( name );
PsPrint( " reencodeISO def\n" );
PsPrint( name );
#endif
(double)(y1 + d) / 2;
- PsPrintf( wxT("newpath\n"
- "%d %d moveto\n"
- "%d %d lineto\n"),
+ PsPrintf( wxT("newpath\n")
+ wxT("%d %d moveto\n")
+ wxT("%d %d lineto\n"),
LogicalToDeviceX((wxCoord)x1), LogicalToDeviceY((wxCoord)y1),
LogicalToDeviceX((wxCoord)x3), LogicalToDeviceY((wxCoord)y3) );
next-to-last and last point respectively, in the point list
*/
- PsPrintf( wxT("%d %d lineto\n"
- "stroke\n"),
+ PsPrintf( wxT("%d %d lineto\n")
+ wxT("stroke\n"),
LogicalToDeviceX((wxCoord)c), LogicalToDeviceY((wxCoord)d) );
}
{
wxCHECK_MSG( m_ok, FALSE, wxT("invalid postscript dc") );
- if ( m_printData.GetPrintMode() == wxPRINT_MODE_FILE )
+ if ( m_printData.GetPrintMode() != wxPRINT_MODE_STREAM )
{
if (m_printData.GetFilename() == wxT(""))
{