1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/dcps.h
3 // Purpose: wxPostScriptDC class
4 // Author: Julian Smart and others
7 // Copyright: (c) Julian Smart and Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
16 #if wxUSE_PRINTING_ARCHITECTURE
21 #include "wx/dialog.h"
22 #include "wx/module.h"
23 #include "wx/cmndata.h"
24 #include "wx/strvararg.h"
26 extern WXDLLIMPEXP_DATA_CORE(int) wxPageNumber
;
28 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
36 //-----------------------------------------------------------------------------
38 class WXDLLEXPORT wxPostScriptDC
: public wxDC
43 // Recommended constructor
44 wxPostScriptDC(const wxPrintData
& printData
);
46 // Recommended destructor :-)
47 virtual ~wxPostScriptDC();
49 virtual bool Ok() const { return IsOk(); }
50 virtual bool IsOk() const;
52 bool CanDrawBitmap() const { return true; }
55 void SetFont( const wxFont
& font
);
56 void SetPen( const wxPen
& pen
);
57 void SetBrush( const wxBrush
& brush
);
58 void SetLogicalFunction( int function
);
59 void SetBackground( const wxBrush
& brush
);
61 void DestroyClippingRegion();
63 bool StartDoc(const wxString
& message
);
68 wxCoord
GetCharHeight() const;
69 wxCoord
GetCharWidth() const;
70 bool CanGetTextExtent() const { return true; }
72 // Resolution in pixels per logical inch
73 wxSize
GetPPI() const;
75 void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
76 void SetDeviceOrigin( wxCoord x
, wxCoord y
);
78 void SetBackgroundMode(int WXUNUSED(mode
)) { }
79 void SetPalette(const wxPalette
& WXUNUSED(palette
)) { }
81 wxPrintData
& GetPrintData() { return m_printData
; }
82 void SetPrintData(const wxPrintData
& data
) { m_printData
= data
; }
84 virtual int GetDepth() const { return 24; }
86 static void SetResolution(int ppi
);
87 static int GetResolution();
89 WX_DEFINE_VARARG_FUNC_VOID(PsPrintf
, DoPsPrintfFormat
)
90 void PsPrint( const wxString
& psdata
);
91 void PsPrint( int ch
);
94 void DoPsPrintfFormat(const wxChar
*fmt
, ... );
96 static float ms_PSScaleFactor
;
99 bool DoFloodFill(wxCoord x1
, wxCoord y1
, const wxColour
&col
, int style
= wxFLOOD_SURFACE
);
100 bool DoGetPixel(wxCoord x1
, wxCoord y1
, wxColour
*col
) const;
101 void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
102 void DoCrossHair(wxCoord x
, wxCoord y
) ;
103 void DoDrawArc(wxCoord x1
,wxCoord y1
,wxCoord x2
,wxCoord y2
,wxCoord xc
,wxCoord yc
);
104 void DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
);
105 void DoDrawPoint(wxCoord x
, wxCoord y
);
106 void DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0);
107 void DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0, int fillStyle
= wxODDEVEN_RULE
);
108 void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0, int fillStyle
= wxODDEVEN_RULE
);
109 void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
110 void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
= 20);
111 void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
113 void DoDrawSpline(wxList
*points
);
114 #endif // wxUSE_SPLINES
115 bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
116 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
, int rop
= wxCOPY
, bool useMask
= false,
117 wxCoord xsrcMask
= wxDefaultCoord
, wxCoord ysrcMask
= wxDefaultCoord
);
118 void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
);
119 void DoDrawBitmap(const wxBitmap
& bitmap
, wxCoord x
, wxCoord y
, bool useMask
= false);
120 void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
121 void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
);
122 void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
123 void DoSetClippingRegionAsRegion( const wxRegion
&WXUNUSED(clip
)) { }
124 void DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
125 wxCoord
*descent
= NULL
,
126 wxCoord
*externalLeading
= NULL
,
127 wxFont
*theFont
= NULL
) const;
128 void DoGetSize(int* width
, int* height
) const;
129 void DoGetSizeMM(int *width
, int *height
) const;
131 FILE* m_pstream
; // PostScript output stream
133 unsigned char m_currentRed
;
134 unsigned char m_currentGreen
;
135 unsigned char m_currentBlue
;
138 double m_underlinePosition
;
139 double m_underlineThickness
;
140 wxPrintData m_printData
;
143 DECLARE_DYNAMIC_CLASS(wxPostScriptDC
)
150 // wxUSE_PRINTING_ARCHITECTURE