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 /////////////////////////////////////////////////////////////////////////////
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
15 #pragma interface "dcpsg.h"
20 #if wxUSE_PRINTING_ARCHITECTURE
24 #include "wx/dialog.h"
25 #include "wx/module.h"
26 #include "wx/cmndata.h"
28 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
36 //-----------------------------------------------------------------------------
38 class WXDLLEXPORT wxPostScriptDC
: public wxDC
43 // Recommended constructor
44 wxPostScriptDC(const wxPrintData
& printData
);
46 // Recommended destructor :-)
49 virtual bool Ok() const;
51 virtual void BeginDrawing() {}
52 virtual void EndDrawing() {}
54 bool DoFloodFill(wxCoord x1
, wxCoord y1
, const wxColour
&col
, int style
=wxFLOOD_SURFACE
);
55 bool DoGetPixel(wxCoord x1
, wxCoord y1
, wxColour
*col
) const;
57 void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
58 void DoCrossHair(wxCoord x
, wxCoord y
) ;
59 void DoDrawArc(wxCoord x1
,wxCoord y1
,wxCoord x2
,wxCoord y2
,wxCoord xc
,wxCoord yc
);
60 void DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
);
61 void DoDrawPoint(wxCoord x
, wxCoord y
);
62 void DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0);
63 void DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0, int fillStyle
=wxODDEVEN_RULE
);
64 void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0, int fillStyle
=wxODDEVEN_RULE
);
65 void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
66 void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
= 20);
67 void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
70 void DoDrawSpline(wxList
*points
);
71 #endif // wxUSE_SPLINES
72 bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
73 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
, int rop
= wxCOPY
, bool useMask
= false,
74 wxCoord xsrcMask
= wxDefaultCoord
, wxCoord ysrcMask
= wxDefaultCoord
);
75 bool CanDrawBitmap() const { return true; }
77 void DoDrawIcon( const wxIcon
& icon
, wxCoord x
, wxCoord y
);
78 void DoDrawBitmap( const wxBitmap
& bitmap
, wxCoord x
, wxCoord y
, bool useMask
= false );
80 void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
81 void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
);
84 void SetFont( const wxFont
& font
);
85 void SetPen( const wxPen
& pen
);
86 void SetBrush( const wxBrush
& brush
);
87 void SetLogicalFunction( int function
);
88 void SetBackground( const wxBrush
& brush
);
90 void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
91 void DestroyClippingRegion();
93 void DoSetClippingRegionAsRegion( const wxRegion
&WXUNUSED(clip
) ) { }
95 bool StartDoc(const wxString
& message
);
100 wxCoord
GetCharHeight() const;
101 wxCoord
GetCharWidth() const;
102 bool CanGetTextExtent() const { return true; }
103 void DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
104 wxCoord
*descent
= (wxCoord
*) NULL
,
105 wxCoord
*externalLeading
= (wxCoord
*) NULL
,
106 wxFont
*theFont
= (wxFont
*) NULL
) const;
108 void DoGetSize(int* width
, int* height
) const;
109 void DoGetSizeMM(int *width
, int *height
) const;
111 // Resolution in pixels per logical inch
112 wxSize
GetPPI() const;
114 void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
115 void SetDeviceOrigin( wxCoord x
, wxCoord y
);
117 void SetBackgroundMode(int WXUNUSED(mode
)) { }
118 void SetPalette(const wxPalette
& WXUNUSED(palette
)) { }
120 wxPrintData
& GetPrintData() { return m_printData
; }
121 void SetPrintData(const wxPrintData
& data
) { m_printData
= data
; }
123 virtual int GetDepth() const { return 24; }
125 static void SetResolution(int ppi
);
126 static int GetResolution();
128 void PsPrintf( const wxChar
* fmt
, ... );
129 void PsPrint( const char* psdata
);
130 void PsPrint( int ch
);
133 void PsPrint( const wxChar
* psdata
) { PsPrint( wxConvUTF8
.cWX2MB( psdata
) ); }
137 static float ms_PSScaleFactor
;
141 FILE* m_pstream
; // PostScript output stream
143 unsigned char m_currentRed
;
144 unsigned char m_currentGreen
;
145 unsigned char m_currentBlue
;
148 double m_underlinePosition
;
149 double m_underlineThickness
;
150 wxPrintData m_printData
;
153 DECLARE_DYNAMIC_CLASS(wxPostScriptDC
)
160 // wxUSE_PRINTING_ARCHITECTURE