]>
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"
55 #define AC_SRC_ALPHA 1
58 /* Quaternary raster codes */
60 #define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore))
63 IMPLEMENT_ABSTRACT_CLASS(wxDC
, wxDCBase
)
65 // ---------------------------------------------------------------------------
67 // ---------------------------------------------------------------------------
69 static const int VIEWPORT_EXTENT
= 1000;
71 static const int MM_POINTS
= 9;
72 static const int MM_METRIC
= 10;
74 #define DSTCOPY 0x00AA0029
76 // ---------------------------------------------------------------------------
78 // ---------------------------------------------------------------------------
80 // ----------------------------------------------------------------------------
82 // ----------------------------------------------------------------------------
84 // ===========================================================================
86 // ===========================================================================
88 // ---------------------------------------------------------------------------
90 // ---------------------------------------------------------------------------
92 // Default constructor
101 // This will select current objects out of the DC,
102 // which is what you have to do before deleting the
104 void wxDC::SelectOldObjects(WXHDC dc
)
108 // ---------------------------------------------------------------------------
110 // ---------------------------------------------------------------------------
112 void wxDC::UpdateClipBox()
117 wxDC::DoGetClippingBox(wxCoord
*x
, wxCoord
*y
, wxCoord
*w
, wxCoord
*h
) const
121 // common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion()
122 void wxDC::SetClippingHrgn(WXHRGN hrgn
)
126 void wxDC::DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
)
130 void wxDC::DoSetClippingRegionAsRegion(const wxRegion
& region
)
134 void wxDC::DestroyClippingRegion()
138 // ---------------------------------------------------------------------------
139 // query capabilities
140 // ---------------------------------------------------------------------------
142 bool wxDC::CanDrawBitmap() const
147 bool wxDC::CanGetTextExtent() const
152 int wxDC::GetDepth() const
157 // ---------------------------------------------------------------------------
159 // ---------------------------------------------------------------------------
165 bool wxDC::DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
, int style
)
170 bool wxDC::DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const
175 void wxDC::DoCrossHair(wxCoord x
, wxCoord y
)
179 void wxDC::DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
183 // Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1)
184 // and ending at (x2, y2)
185 void wxDC::DoDrawArc(wxCoord x1
, wxCoord y1
,
186 wxCoord x2
, wxCoord y2
,
187 wxCoord xc
, wxCoord yc
)
191 void wxDC::DoDrawCheckMark(wxCoord x1
, wxCoord y1
,
192 wxCoord width
, wxCoord height
)
196 void wxDC::DoDrawPoint(wxCoord x
, wxCoord y
)
200 void wxDC::DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
,int fillStyle
)
205 wxDC::DoDrawPolyPolygon(int n
,
214 void wxDC::DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
)
218 void wxDC::DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
222 void wxDC::DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
)
226 void wxDC::DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
230 void wxDC::DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
)
234 void wxDC::DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
)
238 void wxDC::DoDrawBitmap( const wxBitmap
&bmp
, wxCoord x
, wxCoord y
, bool useMask
)
242 void wxDC::DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
)
246 void wxDC::DrawAnyText(const wxString
& text
, wxCoord x
, wxCoord y
)
250 void wxDC::DoDrawRotatedText(const wxString
& text
,
251 wxCoord x
, wxCoord y
,
256 // ---------------------------------------------------------------------------
258 // ---------------------------------------------------------------------------
262 void wxDC::DoSelectPalette(bool realize
)
266 void wxDC::SetPalette(const wxPalette
& palette
)
270 void wxDC::InitializePalette()
274 #endif // wxUSE_PALETTE
276 void wxDC::SetFont(const wxFont
& font
)
280 void wxDC::SetPen(const wxPen
& pen
)
284 void wxDC::SetBrush(const wxBrush
& brush
)
288 void wxDC::SetBackground(const wxBrush
& brush
)
292 void wxDC::SetBackgroundMode(int mode
)
296 void wxDC::SetLogicalFunction(int function
)
300 void wxDC::SetRop(WXHDC dc
)
304 bool wxDC::StartDoc(const wxString
& WXUNUSED(message
))
313 void wxDC::StartPage()
321 // ---------------------------------------------------------------------------
323 // ---------------------------------------------------------------------------
325 wxCoord
wxDC::GetCharHeight() const
330 wxCoord
wxDC::GetCharWidth() const
335 void wxDC::DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
336 wxCoord
*descent
, wxCoord
*externalLeading
,
342 bool wxDC::DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const
350 void wxDC::SetMapMode(int mode
)
354 void wxDC::SetUserScale(double x
, double y
)
358 void wxDC::SetAxisOrientation(bool xLeftRight
, bool yBottomUp
)
362 void wxDC::SetSystemScale(double x
, double y
)
366 void wxDC::SetLogicalOrigin(wxCoord x
, wxCoord y
)
370 void wxDC::SetDeviceOrigin(wxCoord x
, wxCoord y
)
374 // ---------------------------------------------------------------------------
375 // coordinates transformations
376 // ---------------------------------------------------------------------------
378 wxCoord
wxDCBase::DeviceToLogicalX(wxCoord x
) const
383 wxCoord
wxDCBase::DeviceToLogicalXRel(wxCoord x
) const
388 wxCoord
wxDCBase::DeviceToLogicalY(wxCoord y
) const
393 wxCoord
wxDCBase::DeviceToLogicalYRel(wxCoord y
) const
398 wxCoord
wxDCBase::LogicalToDeviceX(wxCoord x
) const
403 wxCoord
wxDCBase::LogicalToDeviceXRel(wxCoord x
) const
408 wxCoord
wxDCBase::LogicalToDeviceY(wxCoord y
) const
413 wxCoord
wxDCBase::LogicalToDeviceYRel(wxCoord y
) const
418 // ---------------------------------------------------------------------------
420 // ---------------------------------------------------------------------------
422 bool wxDC::DoBlit(wxCoord xdest
, wxCoord ydest
,
423 wxCoord width
, wxCoord height
,
424 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
425 int rop
, bool useMask
,
426 wxCoord xsrcMask
, wxCoord ysrcMask
)
431 void wxDC::DoGetSize(int *w
, int *h
) const
435 void wxDC::DoGetSizeMM(int *w
, int *h
) const
439 wxSize
wxDC::GetPPI() const
444 void wxDC::SetLogicalScale(double x
, double y
)
448 // ----------------------------------------------------------------------------
450 // ----------------------------------------------------------------------------
452 #if wxUSE_DC_CACHEING
454 wxList
wxDC::sm_bitmapCache
;
455 wxList
wxDC::sm_dcCache
;
457 wxDCCacheEntry::wxDCCacheEntry(WXHBITMAP hBitmap
, int w
, int h
, int depth
)
461 wxDCCacheEntry::wxDCCacheEntry(WXHDC hDC
, int depth
)
465 wxDCCacheEntry::~wxDCCacheEntry()
469 wxDCCacheEntry
* wxDC::FindBitmapInCache(WXHDC dc
, int w
, int h
)
474 wxDCCacheEntry
* wxDC::FindDCInCache(wxDCCacheEntry
* notThis
, WXHDC dc
)
479 void wxDC::AddToBitmapCache(wxDCCacheEntry
* entry
)
483 void wxDC::AddToDCCache(wxDCCacheEntry
* entry
)
487 void wxDC::ClearCache()
491 class wxDCModule
: public wxModule
494 virtual bool OnInit() { return true; }
495 virtual void OnExit() { wxDC::ClearCache(); }
498 DECLARE_DYNAMIC_CLASS(wxDCModule
)
501 IMPLEMENT_DYNAMIC_CLASS(wxDCModule
, wxModule
)
503 #endif // wxUSE_DC_CACHEING