]>
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 |
c0845ad3 | 76 | virtual void ComputeScaleAndOrigin(); |
bf38cbff | 77 | |
04ab8b6d RR |
78 | void SetBackgroundMode(int WXUNUSED(mode)) { } |
79 | void SetPalette(const wxPalette& WXUNUSED(palette)) { } | |
c801d85f | 80 | |
04ab8b6d RR |
81 | void SetPrintData(const wxPrintData& data); |
82 | wxPrintData& GetPrintData() { return m_printData; } | |
af0bb3b1 | 83 | |
04ab8b6d | 84 | virtual int GetDepth() const { return 24; } |
ca65c044 | 85 | |
04ab8b6d RR |
86 | static void SetResolution(int ppi); |
87 | static int GetResolution(); | |
244e5e34 | 88 | |
04ab8b6d | 89 | void PsPrint( const wxString& psdata ); |
244e5e34 | 90 | |
ca65c044 | 91 | private: |
7bcb11d3 | 92 | |
c801d85f | 93 | protected: |
6f02a879 VZ |
94 | bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE); |
95 | bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; | |
96 | void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
97 | void DoCrossHair(wxCoord x, wxCoord y) ; | |
98 | void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc); | |
99 | void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea); | |
100 | void DoDrawPoint(wxCoord x, wxCoord y); | |
101 | void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0); | |
102 | void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); | |
103 | void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); | |
104 | void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
105 | void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20); | |
106 | void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
107 | #if wxUSE_SPLINES | |
b0d7707b | 108 | void DoDrawSpline(const wxPointList *points); |
6f02a879 VZ |
109 | #endif // wxUSE_SPLINES |
110 | bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
111 | wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, | |
112 | wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); | |
113 | void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); | |
114 | void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false); | |
115 | void DoDrawText(const wxString& text, wxCoord x, wxCoord y); | |
116 | void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); | |
117 | void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
118 | void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip)) { } | |
119 | void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, | |
120 | wxCoord *descent = NULL, | |
121 | wxCoord *externalLeading = NULL, | |
c94f845b | 122 | const wxFont *theFont = NULL) const; |
6f02a879 VZ |
123 | void DoGetSize(int* width, int* height) const; |
124 | void DoGetSizeMM(int *width, int *height) const; | |
3a97d2db | 125 | |
eba33006 RR |
126 | FILE* m_pstream; // PostScript output stream |
127 | wxString m_title; | |
128 | unsigned char m_currentRed; | |
129 | unsigned char m_currentGreen; | |
130 | unsigned char m_currentBlue; | |
131 | int m_pageNumber; | |
132 | bool m_clipping; | |
133 | double m_underlinePosition; | |
134 | double m_underlineThickness; | |
135 | wxPrintData m_printData; | |
eb7637b5 | 136 | double m_pageHeight; |
ca65c044 | 137 | |
eba33006 RR |
138 | private: |
139 | DECLARE_DYNAMIC_CLASS(wxPostScriptDC) | |
c801d85f KB |
140 | }; |
141 | ||
bf38cbff | 142 | #endif |
eb7637b5 | 143 | // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE |
ed880dd4 | 144 | |
c801d85f | 145 | #endif |
bf38cbff | 146 | // _WX_DCPSG_H_ |