]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/generic/dcpsg.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" |
4f37154e | 19 | #include "wx/dcprint.h" |
bf38cbff JS |
20 | #include "wx/dialog.h" |
21 | #include "wx/module.h" | |
7bcb11d3 | 22 | #include "wx/cmndata.h" |
c9f78968 | 23 | #include "wx/strvararg.h" |
fbc535ff | 24 | |
bf38cbff JS |
25 | //----------------------------------------------------------------------------- |
26 | // wxPostScriptDC | |
27 | //----------------------------------------------------------------------------- | |
f04371f0 | 28 | |
4f37154e | 29 | |
53a2db12 | 30 | class WXDLLIMPEXP_CORE wxPostScriptDC : public wxDC |
4f37154e RR |
31 | { |
32 | public: | |
33 | wxPostScriptDC(); | |
34 | ||
35 | // Recommended constructor | |
36 | wxPostScriptDC(const wxPrintData& printData); | |
b1f0e54a | 37 | |
4f37154e RR |
38 | private: |
39 | DECLARE_DYNAMIC_CLASS(wxPostScriptDC) | |
40 | }; | |
41 | ||
53a2db12 | 42 | class WXDLLIMPEXP_CORE wxPostScriptDCImpl : public wxDCImpl |
c801d85f | 43 | { |
bf38cbff | 44 | public: |
888dde65 RR |
45 | wxPostScriptDCImpl( wxPrinterDC *owner ); |
46 | wxPostScriptDCImpl( wxPrinterDC *owner, const wxPrintData& data ); | |
47 | wxPostScriptDCImpl( wxPostScriptDC *owner ); | |
48 | wxPostScriptDCImpl( wxPostScriptDC *owner, const wxPrintData& data ); | |
7bcb11d3 | 49 | |
4f37154e RR |
50 | void Init(); |
51 | ||
888dde65 | 52 | virtual ~wxPostScriptDCImpl(); |
c801d85f | 53 | |
04ab8b6d RR |
54 | virtual bool Ok() const { return IsOk(); } |
55 | virtual bool IsOk() const; | |
bf38cbff | 56 | |
04ab8b6d | 57 | bool CanDrawBitmap() const { return true; } |
bf38cbff | 58 | |
04ab8b6d RR |
59 | void Clear(); |
60 | void SetFont( const wxFont& font ); | |
61 | void SetPen( const wxPen& pen ); | |
62 | void SetBrush( const wxBrush& brush ); | |
89efaf2b | 63 | void SetLogicalFunction( wxRasterOperationMode function ); |
04ab8b6d | 64 | void SetBackground( const wxBrush& brush ); |
bf38cbff | 65 | |
04ab8b6d | 66 | void DestroyClippingRegion(); |
af0bb3b1 | 67 | |
04ab8b6d RR |
68 | bool StartDoc(const wxString& message); |
69 | void EndDoc(); | |
70 | void StartPage(); | |
71 | void EndPage(); | |
c801d85f | 72 | |
04ab8b6d RR |
73 | wxCoord GetCharHeight() const; |
74 | wxCoord GetCharWidth() const; | |
75 | bool CanGetTextExtent() const { return true; } | |
7bcb11d3 | 76 | |
04ab8b6d RR |
77 | // Resolution in pixels per logical inch |
78 | wxSize GetPPI() const; | |
c801d85f | 79 | |
c0845ad3 | 80 | virtual void ComputeScaleAndOrigin(); |
bf38cbff | 81 | |
04ab8b6d RR |
82 | void SetBackgroundMode(int WXUNUSED(mode)) { } |
83 | void SetPalette(const wxPalette& WXUNUSED(palette)) { } | |
c801d85f | 84 | |
04ab8b6d RR |
85 | void SetPrintData(const wxPrintData& data); |
86 | wxPrintData& GetPrintData() { return m_printData; } | |
af0bb3b1 | 87 | |
04ab8b6d | 88 | virtual int GetDepth() const { return 24; } |
ca65c044 | 89 | |
04ab8b6d | 90 | void PsPrint( const wxString& psdata ); |
b1f0e54a | 91 | |
4f37154e | 92 | // Overrridden for wxPrinterDC Impl |
b1f0e54a | 93 | |
6d52ca53 FM |
94 | virtual int GetResolution() const; |
95 | virtual wxRect GetPaperRect() const; | |
7bcb11d3 | 96 | |
9eefb5c1 RD |
97 | virtual void* GetHandle() const { return NULL; } |
98 | ||
c801d85f | 99 | protected: |
03647350 | 100 | bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, |
89efaf2b | 101 | wxFloodFillStyle style = wxFLOOD_SURFACE); |
6f02a879 VZ |
102 | bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; |
103 | void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
104 | void DoCrossHair(wxCoord x, wxCoord y) ; | |
105 | void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc); | |
106 | void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea); | |
107 | void DoDrawPoint(wxCoord x, wxCoord y); | |
4787c92d PC |
108 | void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0); |
109 | void DoDrawPolygon(int n, const wxPoint points[], | |
03647350 | 110 | wxCoord xoffset = 0, wxCoord yoffset = 0, |
89efaf2b | 111 | wxPolygonFillMode fillStyle = wxODDEVEN_RULE); |
4787c92d | 112 | void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], |
03647350 | 113 | wxCoord xoffset = 0, wxCoord yoffset = 0, |
89efaf2b | 114 | wxPolygonFillMode fillStyle = wxODDEVEN_RULE); |
6f02a879 VZ |
115 | void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); |
116 | void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20); | |
117 | void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
118 | #if wxUSE_SPLINES | |
b0d7707b | 119 | void DoDrawSpline(const wxPointList *points); |
4f37154e | 120 | #endif |
6f02a879 | 121 | bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, |
03647350 | 122 | wxDC *source, wxCoord xsrc, wxCoord ysrc, |
89efaf2b | 123 | wxRasterOperationMode rop = wxCOPY, bool useMask = false, |
6f02a879 VZ |
124 | wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); |
125 | void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); | |
126 | void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false); | |
127 | void DoDrawText(const wxString& text, wxCoord x, wxCoord y); | |
128 | void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); | |
129 | void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
fdaad94e VZ |
130 | void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip)) |
131 | { | |
132 | wxFAIL_MSG( "not implemented" ); | |
133 | } | |
6f02a879 VZ |
134 | void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, |
135 | wxCoord *descent = NULL, | |
136 | wxCoord *externalLeading = NULL, | |
c94f845b | 137 | const wxFont *theFont = NULL) const; |
6f02a879 VZ |
138 | void DoGetSize(int* width, int* height) const; |
139 | void DoGetSizeMM(int *width, int *height) const; | |
3a97d2db | 140 | |
eba33006 | 141 | FILE* m_pstream; // PostScript output stream |
eba33006 RR |
142 | unsigned char m_currentRed; |
143 | unsigned char m_currentGreen; | |
144 | unsigned char m_currentBlue; | |
145 | int m_pageNumber; | |
146 | bool m_clipping; | |
147 | double m_underlinePosition; | |
148 | double m_underlineThickness; | |
149 | wxPrintData m_printData; | |
eb7637b5 | 150 | double m_pageHeight; |
ca65c044 | 151 | |
eba33006 | 152 | private: |
888dde65 | 153 | DECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl) |
c801d85f KB |
154 | }; |
155 | ||
bf38cbff | 156 | #endif |
eb7637b5 | 157 | // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE |
ed880dd4 | 158 | |
c801d85f | 159 | #endif |
bf38cbff | 160 | // _WX_DCPSG_H_ |