]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/dc.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/dc.cpp
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ===========================================================================
14 // ===========================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
28 #include "wx/window.h"
31 #include "wx/dialog.h"
33 #include "wx/bitmap.h"
34 #include "wx/dcmemory.h"
39 #include "wx/sysopt.h"
40 #include "wx/dcprint.h"
41 #include "wx/module.h"
42 #include "wx/dynload.h"
44 #ifdef wxHAVE_RAW_BITMAP
45 #include "wx/rawbmp.h"
51 #define AC_SRC_ALPHA 1
54 /* Quaternary raster codes */
56 #define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore))
59 IMPLEMENT_ABSTRACT_CLASS(wxDC
, wxDCBase
)
61 // ---------------------------------------------------------------------------
63 // ---------------------------------------------------------------------------
65 static const int VIEWPORT_EXTENT
= 1000;
67 static const int MM_POINTS
= 9;
68 static const int MM_METRIC
= 10;
70 #define DSTCOPY 0x00AA0029
72 // ---------------------------------------------------------------------------
74 // ---------------------------------------------------------------------------
76 // ----------------------------------------------------------------------------
78 // ----------------------------------------------------------------------------
80 // ===========================================================================
82 // ===========================================================================
84 // ---------------------------------------------------------------------------
86 // ---------------------------------------------------------------------------
88 // Default constructor
97 // This will select current objects out of the DC,
98 // which is what you have to do before deleting the
100 void wxDC::SelectOldObjects(WXHDC dc
)
104 // ---------------------------------------------------------------------------
106 // ---------------------------------------------------------------------------
108 void wxDC::UpdateClipBox()
113 wxDC::DoGetClippingBox(wxCoord
*x
, wxCoord
*y
, wxCoord
*w
, wxCoord
*h
) const
117 // common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion()
118 void wxDC::SetClippingHrgn(WXHRGN hrgn
)
122 void wxDC::DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
)
126 void wxDC::DoSetClippingRegionAsRegion(const wxRegion
& region
)
130 void wxDC::DestroyClippingRegion()
134 // ---------------------------------------------------------------------------
135 // query capabilities
136 // ---------------------------------------------------------------------------
138 bool wxDC::CanDrawBitmap() const
143 bool wxDC::CanGetTextExtent() const
148 int wxDC::GetDepth() const
153 // ---------------------------------------------------------------------------
155 // ---------------------------------------------------------------------------
161 bool wxDC::DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
, int style
)
166 bool wxDC::DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const
171 void wxDC::DoCrossHair(wxCoord x
, wxCoord y
)
175 void wxDC::DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
179 // Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1)
180 // and ending at (x2, y2)
181 void wxDC::DoDrawArc(wxCoord x1
, wxCoord y1
,
182 wxCoord x2
, wxCoord y2
,
183 wxCoord xc
, wxCoord yc
)
187 void wxDC::DoDrawCheckMark(wxCoord x1
, wxCoord y1
,
188 wxCoord width
, wxCoord height
)
192 void wxDC::DoDrawPoint(wxCoord x
, wxCoord y
)
196 void wxDC::DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
,int fillStyle
)
201 wxDC::DoDrawPolyPolygon(int n
,
210 void wxDC::DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
)
214 void wxDC::DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
218 void wxDC::DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
)
222 void wxDC::DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
226 void wxDC::DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
)
230 void wxDC::DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
)
234 void wxDC::DoDrawBitmap( const wxBitmap
&bmp
, wxCoord x
, wxCoord y
, bool useMask
)
238 void wxDC::DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
)
242 void wxDC::DrawAnyText(const wxString
& text
, wxCoord x
, wxCoord y
)
246 void wxDC::DoDrawRotatedText(const wxString
& text
,
247 wxCoord x
, wxCoord y
,
252 // ---------------------------------------------------------------------------
254 // ---------------------------------------------------------------------------
258 void wxDC::DoSelectPalette(bool realize
)
262 void wxDC::SetPalette(const wxPalette
& palette
)
266 void wxDC::InitializePalette()
270 #endif // wxUSE_PALETTE
272 void wxDC::SetFont(const wxFont
& font
)
276 void wxDC::SetPen(const wxPen
& pen
)
280 void wxDC::SetBrush(const wxBrush
& brush
)
284 void wxDC::SetBackground(const wxBrush
& brush
)
288 void wxDC::SetBackgroundMode(int mode
)
292 void wxDC::SetLogicalFunction(int function
)
296 void wxDC::SetRop(WXHDC dc
)
300 bool wxDC::StartDoc(const wxString
& WXUNUSED(message
))
309 void wxDC::StartPage()
317 // ---------------------------------------------------------------------------
319 // ---------------------------------------------------------------------------
321 wxCoord
wxDC::GetCharHeight() const
326 wxCoord
wxDC::GetCharWidth() const
331 void wxDC::DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
332 wxCoord
*descent
, wxCoord
*externalLeading
,
338 bool wxDC::DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const
346 void wxDC::SetMapMode(int mode
)
350 void wxDC::SetUserScale(double x
, double y
)
354 void wxDC::SetAxisOrientation(bool xLeftRight
, bool yBottomUp
)
358 void wxDC::SetSystemScale(double x
, double y
)
362 void wxDC::SetLogicalOrigin(wxCoord x
, wxCoord y
)
366 void wxDC::SetDeviceOrigin(wxCoord x
, wxCoord y
)
370 // ---------------------------------------------------------------------------
371 // coordinates transformations
372 // ---------------------------------------------------------------------------
374 wxCoord
wxDCBase::DeviceToLogicalX(wxCoord x
) const
379 wxCoord
wxDCBase::DeviceToLogicalXRel(wxCoord x
) const
384 wxCoord
wxDCBase::DeviceToLogicalY(wxCoord y
) const
389 wxCoord
wxDCBase::DeviceToLogicalYRel(wxCoord y
) const
394 wxCoord
wxDCBase::LogicalToDeviceX(wxCoord x
) const
399 wxCoord
wxDCBase::LogicalToDeviceXRel(wxCoord x
) const
404 wxCoord
wxDCBase::LogicalToDeviceY(wxCoord y
) const
409 wxCoord
wxDCBase::LogicalToDeviceYRel(wxCoord y
) const
414 // ---------------------------------------------------------------------------
416 // ---------------------------------------------------------------------------
418 bool wxDC::DoBlit(wxCoord xdest
, wxCoord ydest
,
419 wxCoord width
, wxCoord height
,
420 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
421 int rop
, bool useMask
,
422 wxCoord xsrcMask
, wxCoord ysrcMask
)
427 void wxDC::DoGetSize(int *w
, int *h
) const
431 void wxDC::DoGetSizeMM(int *w
, int *h
) const
435 wxSize
wxDC::GetPPI() const
440 void wxDC::SetLogicalScale(double x
, double y
)
444 // ----------------------------------------------------------------------------
446 // ----------------------------------------------------------------------------
448 #if wxUSE_DC_CACHEING
450 wxList
wxDC::sm_bitmapCache
;
451 wxList
wxDC::sm_dcCache
;
453 wxDCCacheEntry::wxDCCacheEntry(WXHBITMAP hBitmap
, int w
, int h
, int depth
)
457 wxDCCacheEntry::wxDCCacheEntry(WXHDC hDC
, int depth
)
461 wxDCCacheEntry::~wxDCCacheEntry()
465 wxDCCacheEntry
* wxDC::FindBitmapInCache(WXHDC dc
, int w
, int h
)
470 wxDCCacheEntry
* wxDC::FindDCInCache(wxDCCacheEntry
* notThis
, WXHDC dc
)
475 void wxDC::AddToBitmapCache(wxDCCacheEntry
* entry
)
479 void wxDC::AddToDCCache(wxDCCacheEntry
* entry
)
483 void wxDC::ClearCache()
487 class wxDCModule
: public wxModule
490 virtual bool OnInit() { return true; }
491 virtual void OnExit() { wxDC::ClearCache(); }
494 DECLARE_DYNAMIC_CLASS(wxDCModule
)
497 IMPLEMENT_DYNAMIC_CLASS(wxDCModule
, wxModule
)
499 #endif // wxUSE_DC_CACHEING