]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/dc.cpp
fixed SaveDIB() crash with BW images (patch 1045884)
[wxWidgets.git] / src / palmos / dc.cpp
CommitLineData
ffecfa5a
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: dc.cpp
3// Purpose: wxDC class
4// Author: William Osborne
5// Modified by:
6// Created: 10/13/04
7// RCS-ID: $Id:
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ===========================================================================
13// declarations
14// ===========================================================================
15
16// ---------------------------------------------------------------------------
17// headers
18// ---------------------------------------------------------------------------
19
20#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "dc.h"
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
28 #pragma hdrstop
29#endif
30
31#ifndef WX_PRECOMP
32 #include "wx/window.h"
33 #include "wx/dc.h"
34 #include "wx/utils.h"
35 #include "wx/dialog.h"
36 #include "wx/app.h"
37 #include "wx/bitmap.h"
38 #include "wx/dcmemory.h"
39 #include "wx/log.h"
40 #include "wx/icon.h"
41#endif
42
43#include "wx/sysopt.h"
44#include "wx/dcprint.h"
45#include "wx/module.h"
46#include "wx/dynload.h"
47
48#ifdef wxHAVE_RAW_BITMAP
49#include "wx/rawbmp.h"
50#endif
51
52#include <string.h>
53#include <math.h>
54
55#ifndef AC_SRC_ALPHA
56#define AC_SRC_ALPHA 1
57#endif
58
59/* Quaternary raster codes */
60#ifndef MAKEROP4
61#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore))
62#endif
63
64IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase)
65
66// ---------------------------------------------------------------------------
67// constants
68// ---------------------------------------------------------------------------
69
70static const int VIEWPORT_EXTENT = 1000;
71
72static const int MM_POINTS = 9;
73static const int MM_METRIC = 10;
74
75// usually this is defined in math.h
76#ifndef M_PI
77 static const double M_PI = 3.14159265358979323846;
78#endif // M_PI
79
80#define DSTCOPY 0x00AA0029
81
82// ---------------------------------------------------------------------------
83// private functions
84// ---------------------------------------------------------------------------
85
86// ----------------------------------------------------------------------------
87// private classes
88// ----------------------------------------------------------------------------
89
90// ===========================================================================
91// implementation
92// ===========================================================================
93
94// ---------------------------------------------------------------------------
95// wxDC
96// ---------------------------------------------------------------------------
97
98// Default constructor
99wxDC::wxDC()
100{
101}
102
103wxDC::~wxDC()
104{
105}
106
107// This will select current objects out of the DC,
108// which is what you have to do before deleting the
109// DC.
110void wxDC::SelectOldObjects(WXHDC dc)
111{
112}
113
114// ---------------------------------------------------------------------------
115// clipping
116// ---------------------------------------------------------------------------
117
118void wxDC::UpdateClipBox()
119{
120}
121
122void
123wxDC::DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
124{
125}
126
127// common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion()
128void wxDC::SetClippingHrgn(WXHRGN hrgn)
129{
130}
131
132void wxDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
133{
134}
135
136void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region)
137{
138}
139
140void wxDC::DestroyClippingRegion()
141{
142}
143
144// ---------------------------------------------------------------------------
145// query capabilities
146// ---------------------------------------------------------------------------
147
148bool wxDC::CanDrawBitmap() const
149{
150 return false;
151}
152
153bool wxDC::CanGetTextExtent() const
154{
155 return false;
156}
157
158int wxDC::GetDepth() const
159{
160 return 0;
161}
162
163// ---------------------------------------------------------------------------
164// drawing
165// ---------------------------------------------------------------------------
166
167void wxDC::Clear()
168{
169}
170
171bool wxDC::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style)
172{
173 return false;
174}
175
176bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
177{
178 return false;
179}
180
181void wxDC::DoCrossHair(wxCoord x, wxCoord y)
182{
183}
184
185void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
186{
187}
188
189// Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1)
190// and ending at (x2, y2)
191void wxDC::DoDrawArc(wxCoord x1, wxCoord y1,
192 wxCoord x2, wxCoord y2,
193 wxCoord xc, wxCoord yc)
194{
195}
196
197void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1,
198 wxCoord width, wxCoord height)
199{
200}
201
202void wxDC::DoDrawPoint(wxCoord x, wxCoord y)
203{
204}
205
206void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle)
207{
208}
209
210void
211wxDC::DoDrawPolyPolygon(int n,
212 int count[],
213 wxPoint points[],
214 wxCoord xoffset,
215 wxCoord yoffset,
216 int fillStyle)
217{
218}
219
220void wxDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
221{
222}
223
224void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
225{
226}
227
228void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
229{
230}
231
232void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
233{
234}
235
236void wxDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
237{
238}
239
240void wxDC::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
241{
242}
243
244void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask )
245{
246}
247
248void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
249{
250}
251
252void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y)
253{
254}
255
256void wxDC::DoDrawRotatedText(const wxString& text,
257 wxCoord x, wxCoord y,
258 double angle)
259{
260}
261
262// ---------------------------------------------------------------------------
263// set GDI objects
264// ---------------------------------------------------------------------------
265
266#if wxUSE_PALETTE
267
268void wxDC::DoSelectPalette(bool realize)
269{
270}
271
272void wxDC::SetPalette(const wxPalette& palette)
273{
274}
275
276void wxDC::InitializePalette()
277{
278}
279
280#endif // wxUSE_PALETTE
281
282void wxDC::SetFont(const wxFont& font)
283{
284}
285
286void wxDC::SetPen(const wxPen& pen)
287{
288}
289
290void wxDC::SetBrush(const wxBrush& brush)
291{
292}
293
294void wxDC::SetBackground(const wxBrush& brush)
295{
296}
297
298void wxDC::SetBackgroundMode(int mode)
299{
300}
301
302void wxDC::SetLogicalFunction(int function)
303{
304}
305
306void wxDC::SetRop(WXHDC dc)
307{
308}
309
310bool wxDC::StartDoc(const wxString& WXUNUSED(message))
311{
312 return true;
313}
314
315void wxDC::EndDoc()
316{
317}
318
319void wxDC::StartPage()
320{
321}
322
323void wxDC::EndPage()
324{
325}
326
327// ---------------------------------------------------------------------------
328// text metrics
329// ---------------------------------------------------------------------------
330
331wxCoord wxDC::GetCharHeight() const
332{
333 return 0;
334}
335
336wxCoord wxDC::GetCharWidth() const
337{
338 return 0;
339}
340
341void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
342 wxCoord *descent, wxCoord *externalLeading,
343 wxFont *font) const
344{
345}
346
347
348bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
349{
350 return false;
351}
352
353
354
355
356void wxDC::SetMapMode(int mode)
357{
358}
359
360void wxDC::SetUserScale(double x, double y)
361{
362}
363
364void wxDC::SetAxisOrientation(bool xLeftRight, bool yBottomUp)
365{
366}
367
368void wxDC::SetSystemScale(double x, double y)
369{
370}
371
372void wxDC::SetLogicalOrigin(wxCoord x, wxCoord y)
373{
374}
375
376void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y)
377{
378}
379
380// ---------------------------------------------------------------------------
381// coordinates transformations
382// ---------------------------------------------------------------------------
383
384wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
385{
386 return 0;
387}
388
389wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
390{
391 return 0;
392}
393
394wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
395{
396 return 0;
397}
398
399wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
400{
401 return 0;
402}
403
404wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
405{
406 return 0;
407}
408
409wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
410{
411 return 0;
412}
413
414wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
415{
416 return 0;
417}
418
419wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
420{
421 return 0;
422}
423
424// ---------------------------------------------------------------------------
425// bit blit
426// ---------------------------------------------------------------------------
427
428bool 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)
433{
434 return false;
435}
436
437void wxDC::DoGetSize(int *w, int *h) const
438{
439}
440
441void wxDC::DoGetSizeMM(int *w, int *h) const
442{
443}
444
445wxSize wxDC::GetPPI() const
446{
447 return wxSize(0, 0);
448}
449
450void wxDC::SetLogicalScale(double x, double y)
451{
452}
453
454// ----------------------------------------------------------------------------
455// DC caching
456// ----------------------------------------------------------------------------
457
458#if wxUSE_DC_CACHEING
459
460wxList wxDC::sm_bitmapCache;
461wxList wxDC::sm_dcCache;
462
463wxDCCacheEntry::wxDCCacheEntry(WXHBITMAP hBitmap, int w, int h, int depth)
464{
465}
466
467wxDCCacheEntry::wxDCCacheEntry(WXHDC hDC, int depth)
468{
469}
470
471wxDCCacheEntry::~wxDCCacheEntry()
472{
473}
474
475wxDCCacheEntry* wxDC::FindBitmapInCache(WXHDC dc, int w, int h)
476{
477 return NULL;
478}
479
480wxDCCacheEntry* wxDC::FindDCInCache(wxDCCacheEntry* notThis, WXHDC dc)
481{
482 return NULL;
483}
484
485void wxDC::AddToBitmapCache(wxDCCacheEntry* entry)
486{
487}
488
489void wxDC::AddToDCCache(wxDCCacheEntry* entry)
490{
491}
492
493void wxDC::ClearCache()
494{
495}
496
497class wxDCModule : public wxModule
498{
499public:
500 virtual bool OnInit() { return true; }
501 virtual void OnExit() { wxDC::ClearCache(); }
502
503private:
504 DECLARE_DYNAMIC_CLASS(wxDCModule)
505};
506
507IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule)
508
509#endif // wxUSE_DC_CACHEING
510