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
20 #include "wx/dialog.h"
21 #include "wx/module.h"
22 #include "wx/cmndata.h"
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
32 //-----------------------------------------------------------------------------
34 class WXDLLEXPORT wxPostScriptDC
: public wxDC
39 // Recommended constructor
40 wxPostScriptDC(const wxPrintData
& printData
);
42 // Recommended destructor :-)
45 virtual bool Ok() const;
47 bool DoFloodFill(wxCoord x1
, wxCoord y1
, const wxColour
&col
, int style
=wxFLOOD_SURFACE
);
48 bool DoGetPixel(wxCoord x1
, wxCoord y1
, wxColour
*col
) const;
50 void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
51 void DoCrossHair(wxCoord x
, wxCoord y
) ;
52 void DoDrawArc(wxCoord x1
,wxCoord y1
,wxCoord x2
,wxCoord y2
,wxCoord xc
,wxCoord yc
);
53 void DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
);
54 void DoDrawPoint(wxCoord x
, wxCoord y
);
55 void DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0);
56 void DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0, int fillStyle
=wxODDEVEN_RULE
);
57 void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0, int fillStyle
=wxODDEVEN_RULE
);
58 void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
59 void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
= 20);
60 void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
63 void DoDrawSpline(wxList
*points
);
64 #endif // wxUSE_SPLINES
65 bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
66 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
, int rop
= wxCOPY
, bool useMask
= false,
67 wxCoord xsrcMask
= wxDefaultCoord
, wxCoord ysrcMask
= wxDefaultCoord
);
68 bool CanDrawBitmap() const { return true; }
70 void DoDrawIcon( const wxIcon
& icon
, wxCoord x
, wxCoord y
);
71 void DoDrawBitmap( const wxBitmap
& bitmap
, wxCoord x
, wxCoord y
, bool useMask
= false );
73 void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
74 void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
);
77 void SetFont( const wxFont
& font
);
78 void SetPen( const wxPen
& pen
);
79 void SetBrush( const wxBrush
& brush
);
80 void SetLogicalFunction( int function
);
81 void SetBackground( const wxBrush
& brush
);
83 void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
84 void DestroyClippingRegion();
86 void DoSetClippingRegionAsRegion( const wxRegion
&WXUNUSED(clip
) ) { }
88 bool StartDoc(const wxString
& message
);
93 wxCoord
GetCharHeight() const;
94 wxCoord
GetCharWidth() const;
95 bool CanGetTextExtent() const { return true; }
96 void DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
97 wxCoord
*descent
= (wxCoord
*) NULL
,
98 wxCoord
*externalLeading
= (wxCoord
*) NULL
,
99 wxFont
*theFont
= (wxFont
*) NULL
) const;
101 void DoGetSize(int* width
, int* height
) const;
102 void DoGetSizeMM(int *width
, int *height
) const;
104 // Resolution in pixels per logical inch
105 wxSize
GetPPI() const;
107 void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
108 void SetDeviceOrigin( wxCoord x
, wxCoord y
);
110 void SetBackgroundMode(int WXUNUSED(mode
)) { }
111 void SetPalette(const wxPalette
& WXUNUSED(palette
)) { }
113 wxPrintData
& GetPrintData() { return m_printData
; }
114 void SetPrintData(const wxPrintData
& data
) { m_printData
= data
; }
116 virtual int GetDepth() const { return 24; }
118 static void SetResolution(int ppi
);
119 static int GetResolution();
121 void PsPrintf( const wxChar
* fmt
, ... );
122 void PsPrint( const char* psdata
);
123 void PsPrint( int ch
);
126 void PsPrint( const wxChar
* psdata
) { PsPrint( wxConvUTF8
.cWX2MB( psdata
) ); }
130 static float ms_PSScaleFactor
;
134 FILE* m_pstream
; // PostScript output stream
136 unsigned char m_currentRed
;
137 unsigned char m_currentGreen
;
138 unsigned char m_currentBlue
;
141 double m_underlinePosition
;
142 double m_underlineThickness
;
143 wxPrintData m_printData
;
146 DECLARE_DYNAMIC_CLASS(wxPostScriptDC
)
153 // wxUSE_PRINTING_ARCHITECTURE