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 virtual void BeginDrawing() {}
48 virtual void EndDrawing() {}
50 bool DoFloodFill(wxCoord x1
, wxCoord y1
, const wxColour
&col
, int style
=wxFLOOD_SURFACE
);
51 bool DoGetPixel(wxCoord x1
, wxCoord y1
, wxColour
*col
) const;
53 void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
54 void DoCrossHair(wxCoord x
, wxCoord y
) ;
55 void DoDrawArc(wxCoord x1
,wxCoord y1
,wxCoord x2
,wxCoord y2
,wxCoord xc
,wxCoord yc
);
56 void DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
);
57 void DoDrawPoint(wxCoord x
, wxCoord y
);
58 void DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0);
59 void DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0, int fillStyle
=wxODDEVEN_RULE
);
60 void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0, int fillStyle
=wxODDEVEN_RULE
);
61 void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
62 void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
= 20);
63 void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
66 void DoDrawSpline(wxList
*points
);
67 #endif // wxUSE_SPLINES
68 bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
69 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
, int rop
= wxCOPY
, bool useMask
= false,
70 wxCoord xsrcMask
= wxDefaultCoord
, wxCoord ysrcMask
= wxDefaultCoord
);
71 bool CanDrawBitmap() const { return true; }
73 void DoDrawIcon( const wxIcon
& icon
, wxCoord x
, wxCoord y
);
74 void DoDrawBitmap( const wxBitmap
& bitmap
, wxCoord x
, wxCoord y
, bool useMask
= false );
76 void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
77 void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
);
80 void SetFont( const wxFont
& font
);
81 void SetPen( const wxPen
& pen
);
82 void SetBrush( const wxBrush
& brush
);
83 void SetLogicalFunction( int function
);
84 void SetBackground( const wxBrush
& brush
);
86 void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
87 void DestroyClippingRegion();
89 void DoSetClippingRegionAsRegion( const wxRegion
&WXUNUSED(clip
) ) { }
91 bool StartDoc(const wxString
& message
);
96 wxCoord
GetCharHeight() const;
97 wxCoord
GetCharWidth() const;
98 bool CanGetTextExtent() const { return true; }
99 void DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
100 wxCoord
*descent
= (wxCoord
*) NULL
,
101 wxCoord
*externalLeading
= (wxCoord
*) NULL
,
102 wxFont
*theFont
= (wxFont
*) NULL
) const;
104 void DoGetSize(int* width
, int* height
) const;
105 void DoGetSizeMM(int *width
, int *height
) const;
107 // Resolution in pixels per logical inch
108 wxSize
GetPPI() const;
110 void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
111 void SetDeviceOrigin( wxCoord x
, wxCoord y
);
113 void SetBackgroundMode(int WXUNUSED(mode
)) { }
114 void SetPalette(const wxPalette
& WXUNUSED(palette
)) { }
116 wxPrintData
& GetPrintData() { return m_printData
; }
117 void SetPrintData(const wxPrintData
& data
) { m_printData
= data
; }
119 virtual int GetDepth() const { return 24; }
121 static void SetResolution(int ppi
);
122 static int GetResolution();
124 void PsPrintf( const wxChar
* fmt
, ... );
125 void PsPrint( const char* psdata
);
126 void PsPrint( int ch
);
129 void PsPrint( const wxChar
* psdata
) { PsPrint( wxConvUTF8
.cWX2MB( psdata
) ); }
133 static float ms_PSScaleFactor
;
137 FILE* m_pstream
; // PostScript output stream
139 unsigned char m_currentRed
;
140 unsigned char m_currentGreen
;
141 unsigned char m_currentBlue
;
144 double m_underlinePosition
;
145 double m_underlineThickness
;
146 wxPrintData m_printData
;
149 DECLARE_DYNAMIC_CLASS(wxPostScriptDC
)
156 // wxUSE_PRINTING_ARCHITECTURE