1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/dcpsg.h
3 // Purpose: wxPostScriptDC class
4 // Author: Julian Smart and others
6 // Copyright: (c) Julian Smart and Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
15 #if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
18 #include "wx/dcprint.h"
19 #include "wx/dialog.h"
20 #include "wx/module.h"
21 #include "wx/cmndata.h"
22 #include "wx/strvararg.h"
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
29 class WXDLLIMPEXP_CORE wxPostScriptDC
: public wxDC
34 // Recommended constructor
35 wxPostScriptDC(const wxPrintData
& printData
);
38 DECLARE_DYNAMIC_CLASS(wxPostScriptDC
)
41 class WXDLLIMPEXP_CORE wxPostScriptDCImpl
: public wxDCImpl
44 wxPostScriptDCImpl( wxPrinterDC
*owner
);
45 wxPostScriptDCImpl( wxPrinterDC
*owner
, const wxPrintData
& data
);
46 wxPostScriptDCImpl( wxPostScriptDC
*owner
);
47 wxPostScriptDCImpl( wxPostScriptDC
*owner
, const wxPrintData
& data
);
51 virtual ~wxPostScriptDCImpl();
53 virtual bool Ok() const { return IsOk(); }
54 virtual bool IsOk() const;
56 bool CanDrawBitmap() const { return true; }
59 void SetFont( const wxFont
& font
);
60 void SetPen( const wxPen
& pen
);
61 void SetBrush( const wxBrush
& brush
);
62 void SetLogicalFunction( wxRasterOperationMode function
);
63 void SetBackground( const wxBrush
& brush
);
65 void DestroyClippingRegion();
67 bool StartDoc(const wxString
& message
);
72 wxCoord
GetCharHeight() const;
73 wxCoord
GetCharWidth() const;
74 bool CanGetTextExtent() const { return true; }
76 // Resolution in pixels per logical inch
77 wxSize
GetPPI() const;
79 virtual void ComputeScaleAndOrigin();
81 void SetBackgroundMode(int WXUNUSED(mode
)) { }
82 void SetPalette(const wxPalette
& WXUNUSED(palette
)) { }
84 void SetPrintData(const wxPrintData
& data
);
85 wxPrintData
& GetPrintData() { return m_printData
; }
87 virtual int GetDepth() const { return 24; }
89 void PsPrint( const wxString
& psdata
);
91 // Overrridden for wxPrinterDC Impl
93 virtual int GetResolution() const;
94 virtual wxRect
GetPaperRect() const;
96 virtual void* GetHandle() const { return NULL
; }
99 bool DoFloodFill(wxCoord x1
, wxCoord y1
, const wxColour
&col
,
100 wxFloodFillStyle style
= wxFLOOD_SURFACE
);
101 bool DoGetPixel(wxCoord x1
, wxCoord y1
, wxColour
*col
) const;
102 void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
103 void DoCrossHair(wxCoord x
, wxCoord y
) ;
104 void DoDrawArc(wxCoord x1
,wxCoord y1
,wxCoord x2
,wxCoord y2
,wxCoord xc
,wxCoord yc
);
105 void DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
);
106 void DoDrawPoint(wxCoord x
, wxCoord y
);
107 void DoDrawLines(int n
, const wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0);
108 void DoDrawPolygon(int n
, const wxPoint points
[],
109 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
110 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
);
111 void DoDrawPolyPolygon(int n
, const int count
[], const wxPoint points
[],
112 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
113 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
);
114 void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
115 void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
= 20);
116 void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
118 void DoDrawSpline(const wxPointList
*points
);
120 bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
121 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
122 wxRasterOperationMode rop
= wxCOPY
, bool useMask
= false,
123 wxCoord xsrcMask
= wxDefaultCoord
, wxCoord ysrcMask
= wxDefaultCoord
);
124 void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
);
125 void DoDrawBitmap(const wxBitmap
& bitmap
, wxCoord x
, wxCoord y
, bool useMask
= false);
126 void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
127 void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
);
128 void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
129 void DoSetDeviceClippingRegion( const wxRegion
&WXUNUSED(clip
))
131 wxFAIL_MSG( "not implemented" );
133 void DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
134 wxCoord
*descent
= NULL
,
135 wxCoord
*externalLeading
= NULL
,
136 const wxFont
*theFont
= NULL
) const;
137 void DoGetSize(int* width
, int* height
) const;
138 void DoGetSizeMM(int *width
, int *height
) const;
140 FILE* m_pstream
; // PostScript output stream
141 unsigned char m_currentRed
;
142 unsigned char m_currentGreen
;
143 unsigned char m_currentBlue
;
146 double m_underlinePosition
;
147 double m_underlineThickness
;
148 wxPrintData m_printData
;
152 DECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl
)
156 // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE