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 && wxUSE_POSTSCRIPT
19 #include "wx/dialog.h"
20 #include "wx/module.h"
21 #include "wx/cmndata.h"
22 #include "wx/strvararg.h"
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
28 class WXDLLEXPORT wxPostScriptDC
: public wxDC
33 // Recommended constructor
34 wxPostScriptDC(const wxPrintData
& printData
);
36 virtual ~wxPostScriptDC();
38 virtual bool Ok() const { return IsOk(); }
39 virtual bool IsOk() const;
41 bool CanDrawBitmap() const { return true; }
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
);
50 void DestroyClippingRegion();
52 bool StartDoc(const wxString
& message
);
57 wxCoord
GetCharHeight() const;
58 wxCoord
GetCharWidth() const;
59 bool CanGetTextExtent() const { return true; }
61 // Resolution in pixels per logical inch
62 wxSize
GetPPI() const;
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
);
76 virtual void ComputeScaleAndOrigin();
78 void SetBackgroundMode(int WXUNUSED(mode
)) { }
79 void SetPalette(const wxPalette
& WXUNUSED(palette
)) { }
81 void SetPrintData(const wxPrintData
& data
);
82 wxPrintData
& GetPrintData() { return m_printData
; }
84 virtual int GetDepth() const { return 24; }
86 static void SetResolution(int ppi
);
87 static int GetResolution();
89 void PsPrint( const wxString
& psdata
);
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
);
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;
126 FILE* m_pstream
; // PostScript output stream
128 unsigned char m_currentRed
;
129 unsigned char m_currentGreen
;
130 unsigned char m_currentBlue
;
133 double m_underlinePosition
;
134 double m_underlineThickness
;
135 wxPrintData m_printData
;
139 DECLARE_DYNAMIC_CLASS(wxPostScriptDC
)
143 // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE