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/dcprint.h"
20 #include "wx/dialog.h"
21 #include "wx/module.h"
22 #include "wx/cmndata.h"
23 #include "wx/strvararg.h"
25 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
30 class WXDLLIMPEXP_CORE wxPostScriptDC
: public wxDC
35 // Recommended constructor
36 wxPostScriptDC(const wxPrintData
& printData
);
39 DECLARE_DYNAMIC_CLASS(wxPostScriptDC
)
42 class WXDLLIMPEXP_CORE wxPostScriptDCImpl
: public wxDCImpl
45 wxPostScriptDCImpl( wxPrinterDC
*owner
);
46 wxPostScriptDCImpl( wxPrinterDC
*owner
, const wxPrintData
& data
);
47 wxPostScriptDCImpl( wxPostScriptDC
*owner
);
48 wxPostScriptDCImpl( wxPostScriptDC
*owner
, const wxPrintData
& data
);
52 virtual ~wxPostScriptDCImpl();
54 virtual bool Ok() const { return IsOk(); }
55 virtual bool IsOk() const;
57 bool CanDrawBitmap() const { return true; }
60 void SetFont( const wxFont
& font
);
61 void SetPen( const wxPen
& pen
);
62 void SetBrush( const wxBrush
& brush
);
63 void SetLogicalFunction( int function
);
64 void SetBackground( const wxBrush
& brush
);
66 void DestroyClippingRegion();
68 bool StartDoc(const wxString
& message
);
73 wxCoord
GetCharHeight() const;
74 wxCoord
GetCharWidth() const;
75 bool CanGetTextExtent() const { return true; }
77 // Resolution in pixels per logical inch
78 wxSize
GetPPI() const;
80 virtual void ComputeScaleAndOrigin();
82 void SetBackgroundMode(int WXUNUSED(mode
)) { }
83 void SetPalette(const wxPalette
& WXUNUSED(palette
)) { }
85 void SetPrintData(const wxPrintData
& data
);
86 wxPrintData
& GetPrintData() { return m_printData
; }
88 virtual int GetDepth() const { return 24; }
90 void PsPrint( const wxString
& psdata
);
92 // Overrridden for wxPrinterDC Impl
94 virtual int GetResolution() const;
95 virtual wxRect
GetPaperRect() const;
98 bool DoFloodFill(wxCoord x1
, wxCoord y1
, const wxColour
&col
, int style
= wxFLOOD_SURFACE
);
99 bool DoGetPixel(wxCoord x1
, wxCoord y1
, wxColour
*col
) const;
100 void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
101 void DoCrossHair(wxCoord x
, wxCoord y
) ;
102 void DoDrawArc(wxCoord x1
,wxCoord y1
,wxCoord x2
,wxCoord y2
,wxCoord xc
,wxCoord yc
);
103 void DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
);
104 void DoDrawPoint(wxCoord x
, wxCoord y
);
105 void DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0);
106 void DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0, int fillStyle
= wxODDEVEN_RULE
);
107 void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0, int fillStyle
= wxODDEVEN_RULE
);
108 void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
109 void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
= 20);
110 void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
112 void DoDrawSpline(const wxPointList
*points
);
114 bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
115 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
, int rop
= wxCOPY
, bool useMask
= false,
116 wxCoord xsrcMask
= wxDefaultCoord
, wxCoord ysrcMask
= wxDefaultCoord
);
117 void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
);
118 void DoDrawBitmap(const wxBitmap
& bitmap
, wxCoord x
, wxCoord y
, bool useMask
= false);
119 void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
120 void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
);
121 void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
122 void DoSetDeviceClippingRegion( const wxRegion
&WXUNUSED(clip
))
124 wxFAIL_MSG( "not implemented" );
126 void DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
127 wxCoord
*descent
= NULL
,
128 wxCoord
*externalLeading
= NULL
,
129 const wxFont
*theFont
= NULL
) const;
130 void DoGetSize(int* width
, int* height
) const;
131 void DoGetSizeMM(int *width
, int *height
) const;
133 FILE* m_pstream
; // PostScript output stream
134 unsigned char m_currentRed
;
135 unsigned char m_currentGreen
;
136 unsigned char m_currentBlue
;
139 double m_underlinePosition
;
140 double m_underlineThickness
;
141 wxPrintData m_printData
;
145 DECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl
)
149 // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE