]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/dcpsg.h
Border corrections
[wxWidgets.git] / include / wx / generic / dcpsg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/dcps.h
3 // Purpose: wxPostScriptDC class
4 // Author: Julian Smart and others
5 // Modified by:
6 // RCS-ID: $Id$
7 // Copyright: (c) Julian Smart and Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_DCPSG_H_
12 #define _WX_DCPSG_H_
13
14 #include "wx/defs.h"
15
16 #if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
17
18 #include "wx/dc.h"
19 #include "wx/dialog.h"
20 #include "wx/module.h"
21 #include "wx/cmndata.h"
22 #include "wx/strvararg.h"
23
24 //-----------------------------------------------------------------------------
25 // wxPostScriptDC
26 //-----------------------------------------------------------------------------
27
28 class WXDLLEXPORT wxPostScriptDC: public wxDC
29 {
30 public:
31 wxPostScriptDC();
32
33 // Recommended constructor
34 wxPostScriptDC(const wxPrintData& printData);
35
36 virtual ~wxPostScriptDC();
37
38 virtual bool Ok() const { return IsOk(); }
39 virtual bool IsOk() const;
40
41 bool CanDrawBitmap() const { return true; }
42
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 );
49
50 void DestroyClippingRegion();
51
52 bool StartDoc(const wxString& message);
53 void EndDoc();
54 void StartPage();
55 void EndPage();
56
57 wxCoord GetCharHeight() const;
58 wxCoord GetCharWidth() const;
59 bool CanGetTextExtent() const { return true; }
60
61 // Resolution in pixels per logical inch
62 wxSize GetPPI() const;
63
64 #if wxUSE_NEW_DC
65 #else
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.
69 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
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);
75 #endif
76 virtual void ComputeScaleAndOrigin();
77
78 void SetBackgroundMode(int WXUNUSED(mode)) { }
79 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
80
81 void SetPrintData(const wxPrintData& data);
82 wxPrintData& GetPrintData() { return m_printData; }
83
84 virtual int GetDepth() const { return 24; }
85
86 static void SetResolution(int ppi);
87 static int GetResolution();
88
89 void PsPrint( const wxString& psdata );
90
91 private:
92
93 protected:
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
108 void DoDrawSpline(const wxPointList *points);
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,
122 const wxFont *theFont = NULL) const;
123 void DoGetSize(int* width, int* height) const;
124 void DoGetSizeMM(int *width, int *height) const;
125
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;
136 double m_pageHeight;
137
138 private:
139 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
140 };
141
142 #endif
143 // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE
144
145 #endif
146 // _WX_DCPSG_H_