]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
389076f1 | 2 | // Name: wx/generic/dcps.h |
c801d85f KB |
3 | // Purpose: wxPostScriptDC class |
4 | // Author: Julian Smart and others | |
5 | // Modified by: | |
c801d85f | 6 | // RCS-ID: $Id$ |
371a5b4e | 7 | // Copyright: (c) Julian Smart and Robert Roebling |
65571936 | 8 | // Licence: wxWindows licence |
c801d85f KB |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
bf38cbff JS |
11 | #ifndef _WX_DCPSG_H_ |
12 | #define _WX_DCPSG_H_ | |
c801d85f | 13 | |
e7445ff8 | 14 | #include "wx/defs.h" |
c801d85f | 15 | |
eb7637b5 | 16 | #if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT |
c801d85f | 17 | |
e7445ff8 | 18 | #include "wx/dc.h" |
bf38cbff JS |
19 | #include "wx/dialog.h" |
20 | #include "wx/module.h" | |
7bcb11d3 | 21 | #include "wx/cmndata.h" |
c9f78968 | 22 | #include "wx/strvararg.h" |
fbc535ff | 23 | |
bf38cbff JS |
24 | //----------------------------------------------------------------------------- |
25 | // wxPostScriptDC | |
26 | //----------------------------------------------------------------------------- | |
f04371f0 | 27 | |
c801d85f KB |
28 | class WXDLLEXPORT wxPostScriptDC: public wxDC |
29 | { | |
bf38cbff | 30 | public: |
3a97d2db | 31 | wxPostScriptDC(); |
7bcb11d3 | 32 | |
3a97d2db RR |
33 | // Recommended constructor |
34 | wxPostScriptDC(const wxPrintData& printData); | |
04ab8b6d | 35 | |
d3c7fc99 | 36 | virtual ~wxPostScriptDC(); |
c801d85f | 37 | |
04ab8b6d RR |
38 | virtual bool Ok() const { return IsOk(); } |
39 | virtual bool IsOk() const; | |
bf38cbff | 40 | |
04ab8b6d | 41 | bool CanDrawBitmap() const { return true; } |
bf38cbff | 42 | |
04ab8b6d RR |
43 | void Clear(); |
44 | void SetFont( const wxFont& font ); | |
45 | void SetPen( const wxPen& pen ); | |
46 | void SetBrush( const wxBrush& brush ); | |
47 | void SetLogicalFunction( int function ); | |
48 | void SetBackground( const wxBrush& brush ); | |
bf38cbff | 49 | |
04ab8b6d | 50 | void DestroyClippingRegion(); |
af0bb3b1 | 51 | |
04ab8b6d RR |
52 | bool StartDoc(const wxString& message); |
53 | void EndDoc(); | |
54 | void StartPage(); | |
55 | void EndPage(); | |
c801d85f | 56 | |
04ab8b6d RR |
57 | wxCoord GetCharHeight() const; |
58 | wxCoord GetCharWidth() const; | |
59 | bool CanGetTextExtent() const { return true; } | |
7bcb11d3 | 60 | |
04ab8b6d RR |
61 | // Resolution in pixels per logical inch |
62 | wxSize GetPPI() const; | |
c801d85f | 63 | |
eb7637b5 RR |
64 | #if wxUSE_NEW_DC |
65 | #else | |
04ab8b6d RR |
66 | // these need to be overridden as wxPostscriptDC inherits |
67 | // from the platform dependent wxDC and this we'd call | |
68 | // e.g. wxMSW specific code here. | |
eb7637b5 | 69 | virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); |
04ab8b6d RR |
70 | virtual void SetMapMode(int mode); |
71 | virtual void SetUserScale(double x, double y); | |
72 | virtual void SetLogicalScale(double x, double y); | |
73 | virtual void SetLogicalOrigin(wxCoord x, wxCoord y); | |
74 | virtual void SetDeviceOrigin(wxCoord x, wxCoord y); | |
eb7637b5 | 75 | #endif |
bf38cbff | 76 | |
04ab8b6d RR |
77 | void SetBackgroundMode(int WXUNUSED(mode)) { } |
78 | void SetPalette(const wxPalette& WXUNUSED(palette)) { } | |
c801d85f | 79 | |
04ab8b6d RR |
80 | void SetPrintData(const wxPrintData& data); |
81 | wxPrintData& GetPrintData() { return m_printData; } | |
af0bb3b1 | 82 | |
04ab8b6d | 83 | virtual int GetDepth() const { return 24; } |
ca65c044 | 84 | |
04ab8b6d RR |
85 | static void SetResolution(int ppi); |
86 | static int GetResolution(); | |
244e5e34 | 87 | |
04ab8b6d | 88 | void PsPrint( const wxString& psdata ); |
244e5e34 | 89 | |
ca65c044 | 90 | private: |
7bcb11d3 | 91 | |
c801d85f | 92 | protected: |
6f02a879 VZ |
93 | bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE); |
94 | bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; | |
95 | void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
96 | void DoCrossHair(wxCoord x, wxCoord y) ; | |
97 | void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc); | |
98 | void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea); | |
99 | void DoDrawPoint(wxCoord x, wxCoord y); | |
100 | void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0); | |
101 | void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); | |
102 | void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); | |
103 | void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
104 | void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20); | |
105 | void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
106 | #if wxUSE_SPLINES | |
107 | void DoDrawSpline(wxList *points); | |
108 | #endif // wxUSE_SPLINES | |
109 | bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
110 | wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, | |
111 | wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); | |
112 | void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); | |
113 | void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false); | |
114 | void DoDrawText(const wxString& text, wxCoord x, wxCoord y); | |
115 | void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); | |
116 | void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
117 | void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip)) { } | |
118 | void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, | |
119 | wxCoord *descent = NULL, | |
120 | wxCoord *externalLeading = NULL, | |
c94f845b | 121 | const wxFont *theFont = NULL) const; |
6f02a879 VZ |
122 | void DoGetSize(int* width, int* height) const; |
123 | void DoGetSizeMM(int *width, int *height) const; | |
3a97d2db | 124 | |
eba33006 RR |
125 | FILE* m_pstream; // PostScript output stream |
126 | wxString m_title; | |
127 | unsigned char m_currentRed; | |
128 | unsigned char m_currentGreen; | |
129 | unsigned char m_currentBlue; | |
130 | int m_pageNumber; | |
131 | bool m_clipping; | |
132 | double m_underlinePosition; | |
133 | double m_underlineThickness; | |
134 | wxPrintData m_printData; | |
eb7637b5 | 135 | double m_pageHeight; |
ca65c044 | 136 | |
eba33006 RR |
137 | private: |
138 | DECLARE_DYNAMIC_CLASS(wxPostScriptDC) | |
c801d85f KB |
139 | }; |
140 | ||
bf38cbff | 141 | #endif |
eb7637b5 | 142 | // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE |
ed880dd4 | 143 | |
c801d85f | 144 | #endif |
bf38cbff | 145 | // _WX_DCPSG_H_ |