]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/dc.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: William Osborne
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ===========================================================================
14 // ===========================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "dc.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
32 #include "wx/window.h"
35 #include "wx/dialog.h"
37 #include "wx/bitmap.h"
38 #include "wx/dcmemory.h"
43 #include "wx/sysopt.h"
44 #include "wx/dcprint.h"
45 #include "wx/module.h"
46 #include "wx/dynload.h"
48 #ifdef wxHAVE_RAW_BITMAP
49 #include "wx/rawbmp.h"
56 #define AC_SRC_ALPHA 1
59 /* Quaternary raster codes */
61 #define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore))
64 IMPLEMENT_ABSTRACT_CLASS(wxDC
, wxDCBase
)
66 // ---------------------------------------------------------------------------
68 // ---------------------------------------------------------------------------
70 static const int VIEWPORT_EXTENT
= 1000;
72 static const int MM_POINTS
= 9;
73 static const int MM_METRIC
= 10;
75 // usually this is defined in math.h
77 static const double M_PI
= 3.14159265358979323846;
80 #define DSTCOPY 0x00AA0029
82 // ---------------------------------------------------------------------------
84 // ---------------------------------------------------------------------------
86 // ----------------------------------------------------------------------------
88 // ----------------------------------------------------------------------------
90 // ===========================================================================
92 // ===========================================================================
94 // ---------------------------------------------------------------------------
96 // ---------------------------------------------------------------------------
98 // Default constructor
107 // This will select current objects out of the DC,
108 // which is what you have to do before deleting the
110 void wxDC::SelectOldObjects(WXHDC dc
)
114 // ---------------------------------------------------------------------------
116 // ---------------------------------------------------------------------------
118 void wxDC::UpdateClipBox()
123 wxDC::DoGetClippingBox(wxCoord
*x
, wxCoord
*y
, wxCoord
*w
, wxCoord
*h
) const
127 // common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion()
128 void wxDC::SetClippingHrgn(WXHRGN hrgn
)
132 void wxDC::DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
)
136 void wxDC::DoSetClippingRegionAsRegion(const wxRegion
& region
)
140 void wxDC::DestroyClippingRegion()
144 // ---------------------------------------------------------------------------
145 // query capabilities
146 // ---------------------------------------------------------------------------
148 bool wxDC::CanDrawBitmap() const
153 bool wxDC::CanGetTextExtent() const
158 int wxDC::GetDepth() const
163 // ---------------------------------------------------------------------------
165 // ---------------------------------------------------------------------------
171 bool wxDC::DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
, int style
)
176 bool wxDC::DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const
181 void wxDC::DoCrossHair(wxCoord x
, wxCoord y
)
185 void wxDC::DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
189 // Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1)
190 // and ending at (x2, y2)
191 void wxDC::DoDrawArc(wxCoord x1
, wxCoord y1
,
192 wxCoord x2
, wxCoord y2
,
193 wxCoord xc
, wxCoord yc
)
197 void wxDC::DoDrawCheckMark(wxCoord x1
, wxCoord y1
,
198 wxCoord width
, wxCoord height
)
202 void wxDC::DoDrawPoint(wxCoord x
, wxCoord y
)
206 void wxDC::DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
,int fillStyle
)
211 wxDC::DoDrawPolyPolygon(int n
,
220 void wxDC::DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
)
224 void wxDC::DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
228 void wxDC::DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
)
232 void wxDC::DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
236 void wxDC::DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
)
240 void wxDC::DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
)
244 void wxDC::DoDrawBitmap( const wxBitmap
&bmp
, wxCoord x
, wxCoord y
, bool useMask
)
248 void wxDC::DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
)
252 void wxDC::DrawAnyText(const wxString
& text
, wxCoord x
, wxCoord y
)
256 void wxDC::DoDrawRotatedText(const wxString
& text
,
257 wxCoord x
, wxCoord y
,
262 // ---------------------------------------------------------------------------
264 // ---------------------------------------------------------------------------
268 void wxDC::DoSelectPalette(bool realize
)
272 void wxDC::SetPalette(const wxPalette
& palette
)
276 void wxDC::InitializePalette()
280 #endif // wxUSE_PALETTE
282 void wxDC::SetFont(const wxFont
& font
)
286 void wxDC::SetPen(const wxPen
& pen
)
290 void wxDC::SetBrush(const wxBrush
& brush
)
294 void wxDC::SetBackground(const wxBrush
& brush
)
298 void wxDC::SetBackgroundMode(int mode
)
302 void wxDC::SetLogicalFunction(int function
)
306 void wxDC::SetRop(WXHDC dc
)
310 bool wxDC::StartDoc(const wxString
& WXUNUSED(message
))
319 void wxDC::StartPage()
327 // ---------------------------------------------------------------------------
329 // ---------------------------------------------------------------------------
331 wxCoord
wxDC::GetCharHeight() const
336 wxCoord
wxDC::GetCharWidth() const
341 void wxDC::DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
342 wxCoord
*descent
, wxCoord
*externalLeading
,
348 bool wxDC::DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const
356 void wxDC::SetMapMode(int mode
)
360 void wxDC::SetUserScale(double x
, double y
)
364 void wxDC::SetAxisOrientation(bool xLeftRight
, bool yBottomUp
)
368 void wxDC::SetSystemScale(double x
, double y
)
372 void wxDC::SetLogicalOrigin(wxCoord x
, wxCoord y
)
376 void wxDC::SetDeviceOrigin(wxCoord x
, wxCoord y
)
380 // ---------------------------------------------------------------------------
381 // coordinates transformations
382 // ---------------------------------------------------------------------------
384 wxCoord
wxDCBase::DeviceToLogicalX(wxCoord x
) const
389 wxCoord
wxDCBase::DeviceToLogicalXRel(wxCoord x
) const
394 wxCoord
wxDCBase::DeviceToLogicalY(wxCoord y
) const
399 wxCoord
wxDCBase::DeviceToLogicalYRel(wxCoord y
) const
404 wxCoord
wxDCBase::LogicalToDeviceX(wxCoord x
) const
409 wxCoord
wxDCBase::LogicalToDeviceXRel(wxCoord x
) const
414 wxCoord
wxDCBase::LogicalToDeviceY(wxCoord y
) const
419 wxCoord
wxDCBase::LogicalToDeviceYRel(wxCoord y
) const
424 // ---------------------------------------------------------------------------
426 // ---------------------------------------------------------------------------
428 bool wxDC::DoBlit(wxCoord xdest
, wxCoord ydest
,
429 wxCoord width
, wxCoord height
,
430 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
431 int rop
, bool useMask
,
432 wxCoord xsrcMask
, wxCoord ysrcMask
)
437 void wxDC::DoGetSize(int *w
, int *h
) const
441 void wxDC::DoGetSizeMM(int *w
, int *h
) const
445 wxSize
wxDC::GetPPI() const
450 void wxDC::SetLogicalScale(double x
, double y
)
454 // ----------------------------------------------------------------------------
456 // ----------------------------------------------------------------------------
458 #if wxUSE_DC_CACHEING
460 wxList
wxDC::sm_bitmapCache
;
461 wxList
wxDC::sm_dcCache
;
463 wxDCCacheEntry::wxDCCacheEntry(WXHBITMAP hBitmap
, int w
, int h
, int depth
)
467 wxDCCacheEntry::wxDCCacheEntry(WXHDC hDC
, int depth
)
471 wxDCCacheEntry::~wxDCCacheEntry()
475 wxDCCacheEntry
* wxDC::FindBitmapInCache(WXHDC dc
, int w
, int h
)
480 wxDCCacheEntry
* wxDC::FindDCInCache(wxDCCacheEntry
* notThis
, WXHDC dc
)
485 void wxDC::AddToBitmapCache(wxDCCacheEntry
* entry
)
489 void wxDC::AddToDCCache(wxDCCacheEntry
* entry
)
493 void wxDC::ClearCache()
497 class wxDCModule
: public wxModule
500 virtual bool OnInit() { return true; }
501 virtual void OnExit() { wxDC::ClearCache(); }
504 DECLARE_DYNAMIC_CLASS(wxDCModule
)
507 IMPLEMENT_DYNAMIC_CLASS(wxDCModule
, wxModule
)
509 #endif // wxUSE_DC_CACHEING