]> git.saurik.com Git - wxWidgets.git/blame - src/common/dcgraph.cpp
Use gdk_window_invalidate instead of gtk_widget_queue_draw as the latter doesn't...
[wxWidgets.git] / src / common / dcgraph.cpp
CommitLineData
1b89a5cd
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/common/graphcmn.cpp
3// Purpose: graphics context methods common to all platforms
4// Author: Stefan Csomor
5// Modified by:
6c0aace2 6// Created:
1b89a5cd
SC
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#if defined(__BORLANDC__)
16 #pragma hdrstop
17#endif
18
19#if wxUSE_GRAPHICS_CONTEXT
20
21#include "wx/graphics.h"
888dde65 22#include "wx/dcgraph.h"
1b89a5cd
SC
23
24#ifndef WX_PRECOMP
25 #include "wx/icon.h"
26 #include "wx/bitmap.h"
27 #include "wx/dcmemory.h"
28 #include "wx/region.h"
29#endif
30
b02d4340
VZ
31#include "wx/dcclient.h"
32
0b6a49c2 33#ifdef __WXOSX_OR_COCOA__
c933e267
SC
34#ifdef __WXOSX_IPHONE__
35 #include <CoreGraphics/CoreGraphics.h>
36#else
37 #include <ApplicationServices/ApplicationServices.h>
38#endif
fcaea2fa 39#endif
b02d4340 40
1b89a5cd
SC
41//-----------------------------------------------------------------------------
42// constants
43//-----------------------------------------------------------------------------
44
45static const double RAD2DEG = 180.0 / M_PI;
46
47//-----------------------------------------------------------------------------
48// Local functions
49//-----------------------------------------------------------------------------
50
51static inline double DegToRad(double deg)
52{
53 return (deg * M_PI) / 180.0;
54}
55
bf02a7f9
SC
56static bool TranslateRasterOp(wxRasterOperationMode function, wxCompositionMode *op)
57{
58 switch ( function )
59 {
60 case wxCOPY: // (default) src
61 *op = wxCOMPOSITION_SOURCE; //
62 break;
63 case wxOR: // src OR dst
64 *op = wxCOMPOSITION_ADD;
65 break;
66 case wxNO_OP: // dst
67 *op = wxCOMPOSITION_DEST; // ignore the source
68 break;
69 case wxCLEAR: // 0
70 *op = wxCOMPOSITION_CLEAR;// clear dst
71 break;
72 case wxXOR: // src XOR dst
73 *op = wxCOMPOSITION_XOR;
74 break;
75
76 case wxAND: // src AND dst
77 case wxAND_INVERT: // (NOT src) AND dst
78 case wxAND_REVERSE:// src AND (NOT dst)
79 case wxEQUIV: // (NOT src) XOR dst
80 case wxINVERT: // NOT dst
81 case wxNAND: // (NOT src) OR (NOT dst)
82 case wxNOR: // (NOT src) AND (NOT dst)
83 case wxOR_INVERT: // (NOT src) OR dst
84 case wxOR_REVERSE: // src OR (NOT dst)
85 case wxSET: // 1
86 case wxSRC_INVERT: // NOT src
87 default:
88 return false;
89 }
90 return true;
91}
92
1b89a5cd
SC
93//-----------------------------------------------------------------------------
94// wxDC bridge class
95//-----------------------------------------------------------------------------
96
1b89a5cd 97IMPLEMENT_DYNAMIC_CLASS(wxGCDC, wxDC)
888dde65 98
7b1a66bb
RR
99wxGCDC::wxGCDC(const wxWindowDC& dc) :
100 wxDC( new wxGCDCImpl( this, dc ) )
888dde65 101{
888dde65
RR
102}
103
7b1a66bb
RR
104wxGCDC::wxGCDC( const wxMemoryDC& dc) :
105 wxDC( new wxGCDCImpl( this, dc ) )
888dde65 106{
888dde65 107}
1b89a5cd 108
6d0d8455 109#if wxUSE_PRINTING_ARCHITECTURE
b25c34aa
RR
110wxGCDC::wxGCDC( const wxPrinterDC& dc) :
111 wxDC( new wxGCDCImpl( this, dc ) )
112{
113}
6d0d8455 114#endif
b25c34aa 115
7b1a66bb
RR
116wxGCDC::wxGCDC() :
117 wxDC( new wxGCDCImpl( this ) )
1b89a5cd 118{
888dde65
RR
119}
120
9412ee9a
SC
121wxGCDC::~wxGCDC()
122{
123}
124
888dde65
RR
125wxGraphicsContext* wxGCDC::GetGraphicsContext()
126{
127 if (!m_pimpl) return NULL;
128 wxGCDCImpl *gc_impl = (wxGCDCImpl*) m_pimpl;
129 return gc_impl->GetGraphicsContext();
1b89a5cd
SC
130}
131
132void wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx )
888dde65
RR
133{
134 if (!m_pimpl) return;
135 wxGCDCImpl *gc_impl = (wxGCDCImpl*) m_pimpl;
136 gc_impl->SetGraphicsContext( ctx );
137}
138
139IMPLEMENT_ABSTRACT_CLASS(wxGCDCImpl, wxDCImpl)
140
141wxGCDCImpl::wxGCDCImpl( wxDC *owner ) :
142 wxDCImpl( owner )
143{
144 Init();
145}
146
147void wxGCDCImpl::SetGraphicsContext( wxGraphicsContext* ctx )
6c0aace2 148{
1b89a5cd
SC
149 delete m_graphicContext;
150 m_graphicContext = ctx;
914fd3f1
SC
151 if ( m_graphicContext )
152 {
153 m_matrixOriginal = m_graphicContext->GetTransform();
154 m_ok = true;
fd791571
SC
155 // apply the stored transformations to the passed in context
156 ComputeScaleAndOrigin();
ad667945
SC
157 m_graphicContext->SetFont( m_font , m_textForegroundColour );
158 m_graphicContext->SetPen( m_pen );
159 m_graphicContext->SetBrush( m_brush);
914fd3f1 160 }
1b89a5cd
SC
161}
162
888dde65
RR
163wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxWindowDC& dc ) :
164 wxDCImpl( owner )
1b89a5cd
SC
165{
166 Init();
914fd3f1 167 SetGraphicsContext( wxGraphicsContext::Create(dc) );
7b98cf02 168 m_window = dc.GetWindow();
1b89a5cd
SC
169}
170
888dde65
RR
171wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ) :
172 wxDCImpl( owner )
773ccc31
SC
173{
174 Init();
175 SetGraphicsContext( wxGraphicsContext::Create(dc) );
176}
773ccc31 177
6d0d8455 178#if wxUSE_PRINTING_ARCHITECTURE
b25c34aa
RR
179wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc ) :
180 wxDCImpl( owner )
181{
182 Init();
183 SetGraphicsContext( wxGraphicsContext::Create(dc) );
184}
6d0d8455 185#endif
b25c34aa 186
888dde65 187void wxGCDCImpl::Init()
1b89a5cd
SC
188{
189 m_ok = false;
190 m_colour = true;
191 m_mm_to_pix_x = mm2pt;
192 m_mm_to_pix_y = mm2pt;
193
194 m_pen = *wxBLACK_PEN;
195 m_font = *wxNORMAL_FONT;
196 m_brush = *wxWHITE_BRUSH;
197
198 m_graphicContext = NULL;
4280b879 199 m_logicalFunctionSupported = true;
1b89a5cd
SC
200}
201
202
888dde65 203wxGCDCImpl::~wxGCDCImpl()
1b89a5cd
SC
204{
205 delete m_graphicContext;
206}
207
08de4403
VZ
208void wxGCDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y,
209 bool useMask )
1b89a5cd 210{
888dde65
RR
211 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") );
212 wxCHECK_RET( bmp.IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") );
1b89a5cd 213
08de4403
VZ
214 int w = bmp.GetWidth();
215 int h = bmp.GetHeight();
f889bdb3
SC
216 if ( bmp.GetDepth() == 1 )
217 {
218 m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
219 m_graphicContext->SetBrush( wxBrush( m_textBackgroundColour , wxSOLID ) );
08de4403 220 m_graphicContext->DrawRectangle( x, y, w, h );
f889bdb3 221 m_graphicContext->SetBrush( wxBrush( m_textForegroundColour , wxSOLID ) );
08de4403 222 m_graphicContext->DrawBitmap( bmp, x, y, w, h );
f889bdb3
SC
223 m_graphicContext->SetBrush( m_graphicContext->CreateBrush(m_brush));
224 m_graphicContext->SetPen( m_graphicContext->CreatePen(m_pen));
225 }
08de4403
VZ
226 else // not a monochrome bitmap, handle it normally
227 {
228 // make a copy in case we need to remove its mask, if we don't modify
229 // it the copy is cheap as bitmaps are reference-counted
230 wxBitmap bmpCopy(bmp);
231 if ( !useMask && bmp.GetMask() )
232 bmpCopy.SetMask(NULL);
233
234 m_graphicContext->DrawBitmap( bmpCopy, x, y, w, h );
235 }
1b89a5cd
SC
236}
237
888dde65 238void wxGCDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
1b89a5cd 239{
888dde65
RR
240 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawIcon - invalid DC") );
241 wxCHECK_RET( icon.IsOk(), wxT("wxGCDC(cg)::DoDrawIcon - invalid icon") );
1b89a5cd 242
1b89a5cd
SC
243 wxCoord w = icon.GetWidth();
244 wxCoord h = icon.GetHeight();
1b89a5cd 245
0ebd9515 246 m_graphicContext->DrawIcon( icon , x, y, w, h );
1b89a5cd
SC
247}
248
b02d4340 249bool wxGCDCImpl::StartDoc( const wxString& WXUNUSED(message) )
fcaea2fa 250{
26dfebbd 251 return true;
fcaea2fa
SC
252}
253
b02d4340 254void wxGCDCImpl::EndDoc()
fcaea2fa
SC
255{
256}
257
888dde65 258void wxGCDCImpl::StartPage()
fcaea2fa
SC
259{
260}
261
b02d4340 262void wxGCDCImpl::EndPage()
fcaea2fa
SC
263{
264}
b02d4340 265
888dde65 266void wxGCDCImpl::Flush()
fcaea2fa 267{
0b6a49c2 268#ifdef __WXOSX_OR_COCOA__
fcaea2fa
SC
269 CGContextFlush( (CGContextRef) m_graphicContext->GetNativeContext() );
270#endif
271}
272
888dde65 273void wxGCDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
1b89a5cd 274{
888dde65 275 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoSetClippingRegion - invalid DC") );
1b89a5cd 276
0ebd9515 277 m_graphicContext->Clip( x, y, w, h );
1b89a5cd
SC
278 if ( m_clipping )
279 {
0ebd9515
SC
280 m_clipX1 = wxMax( m_clipX1, x );
281 m_clipY1 = wxMax( m_clipY1, y );
282 m_clipX2 = wxMin( m_clipX2, (x + w) );
283 m_clipY2 = wxMin( m_clipY2, (y + h) );
1b89a5cd
SC
284 }
285 else
286 {
287 m_clipping = true;
288
0ebd9515
SC
289 m_clipX1 = x;
290 m_clipY1 = y;
291 m_clipX2 = x + w;
292 m_clipY2 = y + h;
1b89a5cd
SC
293 }
294}
295
fdaad94e 296void wxGCDCImpl::DoSetDeviceClippingRegion( const wxRegion &region )
1b89a5cd 297{
4bae004c 298 // region is in device coordinates
fdaad94e 299 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoSetDeviceClippingRegion - invalid DC") );
1b89a5cd
SC
300
301 if (region.Empty())
302 {
fcaea2fa 303 //DestroyClippingRegion();
1b89a5cd
SC
304 return;
305 }
306
4bae004c 307 wxRegion logRegion( region );
1b89a5cd 308 wxCoord x, y, w, h;
0ebd9515 309
4bae004c
SC
310 logRegion.Offset( DeviceToLogicalX(0), DeviceToLogicalY(0) );
311 logRegion.GetBox( x, y, w, h );
312
313 m_graphicContext->Clip( logRegion );
0ebd9515 314 if ( m_clipping )
1b89a5cd 315 {
0ebd9515
SC
316 m_clipX1 = wxMax( m_clipX1, x );
317 m_clipY1 = wxMax( m_clipY1, y );
318 m_clipX2 = wxMin( m_clipX2, (x + w) );
319 m_clipY2 = wxMin( m_clipY2, (y + h) );
1b89a5cd
SC
320 }
321 else
322 {
0ebd9515 323 m_clipping = true;
1b89a5cd 324
0ebd9515
SC
325 m_clipX1 = x;
326 m_clipY1 = y;
327 m_clipX2 = x + w;
328 m_clipY2 = y + h;
1b89a5cd
SC
329 }
330}
331
888dde65 332void wxGCDCImpl::DestroyClippingRegion()
1b89a5cd
SC
333{
334 m_graphicContext->ResetClip();
cb6e26b8
SC
335 // currently the clip eg of a window extends to the area between the scrollbars
336 // so we must explicitely make sure it only covers the area we want it to draw
337 int width, height ;
888dde65 338 GetOwner()->GetSize( &width , &height ) ;
fcaea2fa 339 m_graphicContext->Clip( DeviceToLogicalX(0) , DeviceToLogicalY(0) , DeviceToLogicalXRel(width), DeviceToLogicalYRel(height) );
b02d4340 340
1b89a5cd
SC
341 m_graphicContext->SetPen( m_pen );
342 m_graphicContext->SetBrush( m_brush );
343
344 m_clipping = false;
345}
346
888dde65 347void wxGCDCImpl::DoGetSizeMM( int* width, int* height ) const
1b89a5cd
SC
348{
349 int w = 0, h = 0;
350
888dde65 351 GetOwner()->GetSize( &w, &h );
1b89a5cd
SC
352 if (width)
353 *width = long( double(w) / (m_scaleX * m_mm_to_pix_x) );
354 if (height)
355 *height = long( double(h) / (m_scaleY * m_mm_to_pix_y) );
356}
357
888dde65 358void wxGCDCImpl::SetTextForeground( const wxColour &col )
1b89a5cd 359{
888dde65 360 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::SetTextForeground - invalid DC") );
1b89a5cd
SC
361
362 if ( col != m_textForegroundColour )
363 {
364 m_textForegroundColour = col;
365 m_graphicContext->SetFont( m_font, m_textForegroundColour );
366 }
367}
368
888dde65 369void wxGCDCImpl::SetTextBackground( const wxColour &col )
1b89a5cd 370{
888dde65 371 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::SetTextBackground - invalid DC") );
1b89a5cd
SC
372
373 m_textBackgroundColour = col;
374}
375
89efaf2b 376void wxGCDCImpl::SetMapMode( wxMappingMode mode )
1b89a5cd
SC
377{
378 switch (mode)
379 {
380 case wxMM_TWIPS:
381 SetLogicalScale( twips2mm * m_mm_to_pix_x, twips2mm * m_mm_to_pix_y );
382 break;
383
384 case wxMM_POINTS:
385 SetLogicalScale( pt2mm * m_mm_to_pix_x, pt2mm * m_mm_to_pix_y );
386 break;
387
388 case wxMM_METRIC:
389 SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
390 break;
391
392 case wxMM_LOMETRIC:
393 SetLogicalScale( m_mm_to_pix_x / 10.0, m_mm_to_pix_y / 10.0 );
394 break;
395
396 case wxMM_TEXT:
397 default:
398 SetLogicalScale( 1.0, 1.0 );
399 break;
400 }
401
402 ComputeScaleAndOrigin();
403}
404
888dde65 405wxSize wxGCDCImpl::GetPPI() const
1b89a5cd
SC
406{
407 return wxSize(72, 72);
408}
409
888dde65 410int wxGCDCImpl::GetDepth() const
1b89a5cd
SC
411{
412 return 32;
413}
414
888dde65 415void wxGCDCImpl::ComputeScaleAndOrigin()
b02d4340 416{
2dedef25 417 wxDCImpl::ComputeScaleAndOrigin();
1b89a5cd 418
fd791571
SC
419 if ( m_graphicContext )
420 {
421 m_matrixCurrent = m_graphicContext->CreateMatrix();
08de4403 422
fd791571 423 // the logical origin sets the origin to have new coordinates
08de4403 424 m_matrixCurrent.Translate( m_deviceOriginX - m_logicalOriginX * m_signX * m_scaleX,
d225267e 425 m_deviceOriginY-m_logicalOriginY * m_signY * m_scaleY);
08de4403 426
d225267e 427 m_matrixCurrent.Scale( m_scaleX * m_signX, m_scaleY * m_signY );
08de4403 428
fd791571
SC
429 m_graphicContext->SetTransform( m_matrixOriginal );
430 m_graphicContext->ConcatTransform( m_matrixCurrent );
431 }
1b89a5cd
SC
432}
433
888dde65 434void wxGCDCImpl::SetPalette( const wxPalette& WXUNUSED(palette) )
1b89a5cd
SC
435{
436
437}
438
888dde65 439void wxGCDCImpl::SetBackgroundMode( int mode )
1b89a5cd
SC
440{
441 m_backgroundMode = mode;
442}
443
888dde65 444void wxGCDCImpl::SetFont( const wxFont &font )
1b89a5cd
SC
445{
446 m_font = font;
447 if ( m_graphicContext )
448 {
449 wxFont f = font;
888dde65 450 if ( f.IsOk() )
0ebd9515 451 f.SetPointSize( /*LogicalToDeviceYRel*/(font.GetPointSize()));
1b89a5cd
SC
452 m_graphicContext->SetFont( f, m_textForegroundColour );
453 }
454}
455
888dde65 456void wxGCDCImpl::SetPen( const wxPen &pen )
1b89a5cd
SC
457{
458 if ( m_pen == pen )
459 return;
460
461 m_pen = pen;
462 if ( m_graphicContext )
463 {
0ebd9515 464 m_graphicContext->SetPen( m_pen );
1b89a5cd
SC
465 }
466}
467
888dde65 468void wxGCDCImpl::SetBrush( const wxBrush &brush )
1b89a5cd
SC
469{
470 if (m_brush == brush)
471 return;
472
473 m_brush = brush;
474 if ( m_graphicContext )
475 {
0ebd9515 476 m_graphicContext->SetBrush( m_brush );
1b89a5cd
SC
477 }
478}
b02d4340 479
888dde65 480void wxGCDCImpl::SetBackground( const wxBrush &brush )
1b89a5cd
SC
481{
482 if (m_backgroundBrush == brush)
483 return;
484
485 m_backgroundBrush = brush;
888dde65 486 if (!m_backgroundBrush.IsOk())
1b89a5cd
SC
487 return;
488}
489
89efaf2b 490void wxGCDCImpl::SetLogicalFunction( wxRasterOperationMode function )
1b89a5cd
SC
491{
492 if (m_logicalFunction == function)
493 return;
494
495 m_logicalFunction = function;
bf02a7f9
SC
496
497 wxCompositionMode mode;
498 m_logicalFunctionSupported = TranslateRasterOp( function, &mode);
499 if (m_logicalFunctionSupported)
500 m_logicalFunctionSupported = m_graphicContext->SetCompositionMode(mode);
501
502 if (mode == wxCOMPOSITION_XOR)
503 m_graphicContext->SetAntialiasMode(wxANTIALIAS_NONE);
1b89a5cd 504 else
bf02a7f9 505 m_graphicContext->SetAntialiasMode(wxANTIALIAS_DEFAULT);
1b89a5cd
SC
506}
507
888dde65 508bool wxGCDCImpl::DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
89efaf2b
FM
509 const wxColour& WXUNUSED(col),
510 wxFloodFillStyle WXUNUSED(style))
1b89a5cd
SC
511{
512 return false;
513}
514
888dde65 515bool wxGCDCImpl::DoGetPixel( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour *WXUNUSED(col) ) const
1b89a5cd
SC
516{
517 // wxCHECK_MSG( 0 , false, wxT("wxGCDC(cg)::DoGetPixel - not implemented") );
518 return false;
519}
520
888dde65 521void wxGCDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
1b89a5cd 522{
888dde65 523 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawLine - invalid DC") );
1b89a5cd 524
4280b879 525 if ( !m_logicalFunctionSupported )
1b89a5cd 526 return;
1b89a5cd 527
0ebd9515 528 m_graphicContext->StrokeLine(x1,y1,x2,y2);
1b89a5cd
SC
529
530 CalcBoundingBox(x1, y1);
531 CalcBoundingBox(x2, y2);
532}
533
888dde65 534void wxGCDCImpl::DoCrossHair( wxCoord x, wxCoord y )
1b89a5cd 535{
888dde65 536 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoCrossHair - invalid DC") );
1b89a5cd 537
4280b879 538 if ( !m_logicalFunctionSupported )
1b89a5cd
SC
539 return;
540
541 int w = 0, h = 0;
542
888dde65 543 GetOwner()->GetSize( &w, &h );
1b89a5cd 544
0ebd9515
SC
545 m_graphicContext->StrokeLine(0,y,w,y);
546 m_graphicContext->StrokeLine(x,0,x,h);
1b89a5cd 547
0ebd9515
SC
548 CalcBoundingBox(0, 0);
549 CalcBoundingBox(0+w, 0+h);
1b89a5cd
SC
550}
551
888dde65 552void wxGCDCImpl::DoDrawArc( wxCoord x1, wxCoord y1,
1b89a5cd
SC
553 wxCoord x2, wxCoord y2,
554 wxCoord xc, wxCoord yc )
555{
888dde65 556 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawArc - invalid DC") );
1b89a5cd 557
4280b879 558 if ( !m_logicalFunctionSupported )
1b89a5cd
SC
559 return;
560
0ebd9515
SC
561 double dx = x1 - xc;
562 double dy = y1 - yc;
1b89a5cd
SC
563 double radius = sqrt((double)(dx * dx + dy * dy));
564 wxCoord rad = (wxCoord)radius;
565 double sa, ea;
0ebd9515 566 if (x1 == x2 && y1 == y2)
1b89a5cd
SC
567 {
568 sa = 0.0;
569 ea = 360.0;
570 }
571 else if (radius == 0.0)
572 {
573 sa = ea = 0.0;
574 }
575 else
576 {
0ebd9515
SC
577 sa = (x1 - xc == 0) ?
578 (y1 - yc < 0) ? 90.0 : -90.0 :
579 -atan2(double(y1 - yc), double(x1 - xc)) * RAD2DEG;
580 ea = (x2 - xc == 0) ?
581 (y2 - yc < 0) ? 90.0 : -90.0 :
582 -atan2(double(y2 - yc), double(x2 - xc)) * RAD2DEG;
1b89a5cd
SC
583 }
584
585 bool fill = m_brush.GetStyle() != wxTRANSPARENT;
586
a4e73390 587 wxGraphicsPath path = m_graphicContext->CreatePath();
1b89a5cd 588 if ( fill && ((x1!=x2)||(y1!=y2)) )
0ebd9515 589 path.MoveToPoint( xc, yc );
4bae004c
SC
590 // since these angles (ea,sa) are measured counter-clockwise, we invert them to
591 // get clockwise angles
592 path.AddArc( xc, yc , rad , DegToRad(-sa) , DegToRad(-ea), false );
1b89a5cd 593 if ( fill && ((x1!=x2)||(y1!=y2)) )
0ebd9515 594 path.AddLineToPoint( xc, yc );
1b89a5cd 595 m_graphicContext->DrawPath(path);
1b89a5cd
SC
596}
597
888dde65 598void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
1b89a5cd
SC
599 double sa, double ea )
600{
888dde65 601 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawEllipticArc - invalid DC") );
1b89a5cd 602
4280b879 603 if ( !m_logicalFunctionSupported )
1b89a5cd
SC
604 return;
605
1b89a5cd 606 m_graphicContext->PushState();
d9485f89 607 m_graphicContext->Translate(x+w/2.0,y+h/2.0);
0ebd9515 608 wxDouble factor = ((wxDouble) w) / h;
1b89a5cd 609 m_graphicContext->Scale( factor , 1.0);
d9485f89 610
1b89a5cd
SC
611 // since these angles (ea,sa) are measured counter-clockwise, we invert them to
612 // get clockwise angles
fcaea2fa
SC
613 if ( m_brush.GetStyle() != wxTRANSPARENT )
614 {
615 wxGraphicsPath path = m_graphicContext->CreatePath();
616 path.MoveToPoint( 0, 0 );
47c1bb95 617 path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea );
fcaea2fa
SC
618 path.AddLineToPoint( 0, 0 );
619 m_graphicContext->FillPath( path );
620
621 path = m_graphicContext->CreatePath();
622 path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea );
fcaea2fa
SC
623 m_graphicContext->StrokePath( path );
624 }
625 else
626 {
627 wxGraphicsPath path = m_graphicContext->CreatePath();
47c1bb95
SC
628 path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea );
629 m_graphicContext->DrawPath( path );
fcaea2fa
SC
630 }
631
1b89a5cd 632 m_graphicContext->PopState();
1b89a5cd
SC
633}
634
888dde65 635void wxGCDCImpl::DoDrawPoint( wxCoord x, wxCoord y )
1b89a5cd 636{
888dde65 637 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawPoint - invalid DC") );
1b89a5cd
SC
638
639 DoDrawLine( x , y , x + 1 , y + 1 );
640}
641
888dde65 642void wxGCDCImpl::DoDrawLines(int n, wxPoint points[],
1b89a5cd
SC
643 wxCoord xoffset, wxCoord yoffset)
644{
888dde65 645 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawLines - invalid DC") );
1b89a5cd 646
4280b879 647 if ( !m_logicalFunctionSupported )
1b89a5cd 648 return;
1b89a5cd
SC
649
650 wxPoint2DDouble* pointsD = new wxPoint2DDouble[n];
651 for( int i = 0; i < n; ++i)
652 {
0ebd9515
SC
653 pointsD[i].m_x = points[i].x + xoffset;
654 pointsD[i].m_y = points[i].y + yoffset;
1b89a5cd
SC
655 }
656
657 m_graphicContext->StrokeLines( n , pointsD);
658 delete[] pointsD;
659}
660
661#if wxUSE_SPLINES
888dde65 662void wxGCDCImpl::DoDrawSpline(const wxPointList *points)
1b89a5cd 663{
888dde65 664 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") );
1b89a5cd 665
4280b879 666 if ( !m_logicalFunctionSupported )
1b89a5cd
SC
667 return;
668
a4e73390 669 wxGraphicsPath path = m_graphicContext->CreatePath();
1b89a5cd 670
b0d7707b
RR
671 wxPointList::compatibility_iterator node = points->GetFirst();
672 if (node == wxPointList::compatibility_iterator())
1b89a5cd
SC
673 // empty list
674 return;
675
b0d7707b 676 wxPoint *p = node->GetData();
1b89a5cd
SC
677
678 wxCoord x1 = p->x;
679 wxCoord y1 = p->y;
680
681 node = node->GetNext();
b0d7707b 682 p = node->GetData();
1b89a5cd
SC
683
684 wxCoord x2 = p->x;
685 wxCoord y2 = p->y;
686 wxCoord cx1 = ( x1 + x2 ) / 2;
687 wxCoord cy1 = ( y1 + y2 ) / 2;
688
0ebd9515
SC
689 path.MoveToPoint( x1 , y1 );
690 path.AddLineToPoint( cx1 , cy1 );
1b89a5cd
SC
691#if !wxUSE_STL
692
693 while ((node = node->GetNext()) != NULL)
694#else
695
696 while ((node = node->GetNext()))
697#endif // !wxUSE_STL
698
699 {
b0d7707b 700 p = node->GetData();
1b89a5cd
SC
701 x1 = x2;
702 y1 = y2;
703 x2 = p->x;
704 y2 = p->y;
705 wxCoord cx4 = (x1 + x2) / 2;
706 wxCoord cy4 = (y1 + y2) / 2;
707
0ebd9515 708 path.AddQuadCurveToPoint(x1 , y1 ,cx4 , cy4 );
1b89a5cd
SC
709
710 cx1 = cx4;
711 cy1 = cy4;
712 }
713
0ebd9515 714 path.AddLineToPoint( x2 , y2 );
1b89a5cd
SC
715
716 m_graphicContext->StrokePath( path );
1b89a5cd
SC
717}
718#endif // wxUSE_SPLINES
719
888dde65 720void wxGCDCImpl::DoDrawPolygon( int n, wxPoint points[],
89efaf2b
FM
721 wxCoord xoffset, wxCoord yoffset,
722 wxPolygonFillMode fillStyle )
1b89a5cd 723{
888dde65 724 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawPolygon - invalid DC") );
1b89a5cd
SC
725
726 if ( n <= 0 || (m_brush.GetStyle() == wxTRANSPARENT && m_pen.GetStyle() == wxTRANSPARENT ) )
727 return;
4280b879 728 if ( !m_logicalFunctionSupported )
1b89a5cd
SC
729 return;
730
731 bool closeIt = false;
732 if (points[n-1] != points[0])
733 closeIt = true;
734
735 wxPoint2DDouble* pointsD = new wxPoint2DDouble[n+(closeIt?1:0)];
736 for( int i = 0; i < n; ++i)
737 {
0ebd9515
SC
738 pointsD[i].m_x = points[i].x + xoffset;
739 pointsD[i].m_y = points[i].y + yoffset;
1b89a5cd
SC
740 }
741 if ( closeIt )
742 pointsD[n] = pointsD[0];
743
744 m_graphicContext->DrawLines( n+(closeIt?1:0) , pointsD, fillStyle);
745 delete[] pointsD;
746}
747
888dde65 748void wxGCDCImpl::DoDrawPolyPolygon(int n,
1b89a5cd
SC
749 int count[],
750 wxPoint points[],
751 wxCoord xoffset,
752 wxCoord yoffset,
89efaf2b 753 wxPolygonFillMode fillStyle)
1b89a5cd
SC
754{
755 wxASSERT(n > 1);
a4e73390 756 wxGraphicsPath path = m_graphicContext->CreatePath();
1b89a5cd
SC
757
758 int i = 0;
759 for ( int j = 0; j < n; ++j)
760 {
761 wxPoint start = points[i];
0ebd9515 762 path.MoveToPoint( start.x+ xoffset, start.y+ yoffset);
1b89a5cd
SC
763 ++i;
764 int l = count[j];
765 for ( int k = 1; k < l; ++k)
766 {
0ebd9515 767 path.AddLineToPoint( points[i].x+ xoffset, points[i].y+ yoffset);
1b89a5cd
SC
768 ++i;
769 }
770 // close the polygon
771 if ( start != points[i-1])
0ebd9515 772 path.AddLineToPoint( start.x+ xoffset, start.y+ yoffset);
1b89a5cd
SC
773 }
774 m_graphicContext->DrawPath( path , fillStyle);
1b89a5cd
SC
775}
776
888dde65 777void wxGCDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
1b89a5cd 778{
888dde65 779 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRectangle - invalid DC") );
1b89a5cd 780
4280b879 781 if ( !m_logicalFunctionSupported )
1b89a5cd
SC
782 return;
783
1b89a5cd 784 // CMB: draw nothing if transformed w or h is 0
0ebd9515 785 if (w == 0 || h == 0)
1b89a5cd
SC
786 return;
787
5ebfdf41
SC
788 if ( m_graphicContext->ShouldOffset() )
789 {
790 // if we are offsetting the entire rectangle is moved 0.5, so the
791 // border line gets off by 1
0ebd9515
SC
792 w -= 1;
793 h -= 1;
5ebfdf41 794 }
0ebd9515 795 m_graphicContext->DrawRectangle(x,y,w,h);
1b89a5cd
SC
796}
797
888dde65 798void wxGCDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
0ebd9515 799 wxCoord w, wxCoord h,
1b89a5cd
SC
800 double radius)
801{
888dde65 802 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRoundedRectangle - invalid DC") );
1b89a5cd 803
4280b879 804 if ( !m_logicalFunctionSupported )
1b89a5cd
SC
805 return;
806
807 if (radius < 0.0)
0ebd9515 808 radius = - radius * ((w < h) ? w : h);
1b89a5cd
SC
809
810 // CMB: draw nothing if transformed w or h is 0
0ebd9515 811 if (w == 0 || h == 0)
1b89a5cd
SC
812 return;
813
d9485f89
RD
814 if ( m_graphicContext->ShouldOffset() )
815 {
816 // if we are offsetting the entire rectangle is moved 0.5, so the
817 // border line gets off by 1
818 w -= 1;
819 h -= 1;
820 }
0ebd9515 821 m_graphicContext->DrawRoundedRectangle( x,y,w,h,radius);
1b89a5cd
SC
822}
823
888dde65 824void wxGCDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
1b89a5cd 825{
888dde65 826 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawEllipse - invalid DC") );
1b89a5cd 827
4280b879 828 if ( !m_logicalFunctionSupported )
1b89a5cd
SC
829 return;
830
d9485f89
RD
831 if ( m_graphicContext->ShouldOffset() )
832 {
833 // if we are offsetting the entire rectangle is moved 0.5, so the
834 // border line gets off by 1
835 w -= 1;
836 h -= 1;
837 }
0ebd9515 838 m_graphicContext->DrawEllipse(x,y,w,h);
1b89a5cd
SC
839}
840
888dde65 841bool wxGCDCImpl::CanDrawBitmap() const
1b89a5cd
SC
842{
843 return true;
844}
845
888dde65 846bool wxGCDCImpl::DoBlit(
1b89a5cd 847 wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
89efaf2b
FM
848 wxDC *source, wxCoord xsrc, wxCoord ysrc,
849 wxRasterOperationMode logical_func , bool useMask,
1b89a5cd
SC
850 wxCoord xsrcMask, wxCoord ysrcMask )
851{
e3b81044
VZ
852 return DoStretchBlit( xdest, ydest, width, height,
853 source, xsrc, ysrc, width, height, logical_func, useMask,
854 xsrcMask,ysrcMask );
855}
856
888dde65 857bool wxGCDCImpl::DoStretchBlit(
e3b81044
VZ
858 wxCoord xdest, wxCoord ydest, wxCoord dstWidth, wxCoord dstHeight,
859 wxDC *source, wxCoord xsrc, wxCoord ysrc, wxCoord srcWidth, wxCoord srcHeight,
89efaf2b 860 wxRasterOperationMode logical_func , bool useMask,
e3b81044
VZ
861 wxCoord xsrcMask, wxCoord ysrcMask )
862{
888dde65
RR
863 wxCHECK_MSG( IsOk(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid DC") );
864 wxCHECK_MSG( source->IsOk(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid source DC") );
6c0aace2 865
1b89a5cd
SC
866 if ( logical_func == wxNO_OP )
867 return true;
bf02a7f9
SC
868
869 wxCompositionMode mode;
870 if ( !TranslateRasterOp(logical_func, &mode) )
c64c9cd3 871 {
bf02a7f9 872 wxFAIL_MSG( wxT("Blitting is not supported with this logical operation.") );
c64c9cd3
KO
873 return false;
874 }
1b89a5cd 875
bf02a7f9
SC
876 bool retval = true;
877
878 wxCompositionMode formerMode = m_graphicContext->GetCompositionMode();
879 if (m_graphicContext->SetCompositionMode(mode))
1b89a5cd 880 {
bf02a7f9
SC
881 wxAntialiasMode formerAa = m_graphicContext->GetAntialiasMode();
882 if (mode == wxCOMPOSITION_XOR)
883 {
884 m_graphicContext->SetAntialiasMode(wxANTIALIAS_NONE);
885 }
886
887 if (xsrcMask == -1 && ysrcMask == -1)
888 {
889 xsrcMask = xsrc;
890 ysrcMask = ysrc;
891 }
1b89a5cd 892
bf02a7f9
SC
893 wxRect subrect(source->LogicalToDeviceX(xsrc),
894 source->LogicalToDeviceY(ysrc),
895 source->LogicalToDeviceXRel(srcWidth),
896 source->LogicalToDeviceYRel(srcHeight));
cce4a2ce 897
bf02a7f9
SC
898 // if needed clip the subrect down to the size of the source DC
899 wxCoord sw, sh;
900 source->GetSize(&sw, &sh);
901 sw = source->LogicalToDeviceXRel(sw);
902 sh = source->LogicalToDeviceYRel(sh);
903 if (subrect.x + subrect.width > sw)
904 subrect.width = sw - subrect.x;
905 if (subrect.y + subrect.height > sh)
906 subrect.height = sh - subrect.y;
6c0aace2 907
bf02a7f9 908 wxBitmap blit = source->GetAsBitmap( &subrect );
6c0aace2 909
bf02a7f9
SC
910 if ( blit.IsOk() )
911 {
912 if ( !useMask && blit.GetMask() )
913 blit.SetMask(NULL);
08de4403 914
bf02a7f9
SC
915 m_graphicContext->DrawBitmap( blit, xdest, ydest,
916 dstWidth, dstHeight);
917 }
918 else
919 {
920 wxFAIL_MSG( wxT("Cannot Blit. Unable to get contents of DC as bitmap.") );
921 retval = false;
922 }
923
924 if (mode == wxCOMPOSITION_XOR)
925 {
926 m_graphicContext->SetAntialiasMode(formerAa);
927 }
1b89a5cd 928 }
bf02a7f9
SC
929 // reset composition
930 m_graphicContext->SetCompositionMode(formerMode);
1b89a5cd 931
bf02a7f9 932 return retval;
1b89a5cd
SC
933}
934
888dde65 935void wxGCDCImpl::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
1b89a5cd
SC
936 double angle)
937{
888dde65 938 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") );
1b89a5cd
SC
939
940 if ( str.length() == 0 )
941 return;
4280b879 942 if ( !m_logicalFunctionSupported )
1b89a5cd
SC
943 return;
944
068eb463
SC
945 if ( m_backgroundMode == wxTRANSPARENT )
946 m_graphicContext->DrawText( str, x ,y , DegToRad(angle ));
947 else
948 m_graphicContext->DrawText( str, x ,y , DegToRad(angle ), m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) );
1b89a5cd
SC
949}
950
888dde65 951void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y)
1b89a5cd 952{
08de4403 953 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawText - invalid DC") );
1b89a5cd
SC
954
955 if ( str.length() == 0 )
956 return;
4280b879
SC
957
958 if ( !m_logicalFunctionSupported )
1b89a5cd
SC
959 return;
960
068eb463
SC
961 if ( m_backgroundMode == wxTRANSPARENT )
962 m_graphicContext->DrawText( str, x ,y);
963 else
964 m_graphicContext->DrawText( str, x ,y , m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) );
1b89a5cd
SC
965}
966
888dde65 967bool wxGCDCImpl::CanGetTextExtent() const
1b89a5cd 968{
888dde65 969 wxCHECK_MSG( IsOk(), false, wxT("wxGCDC(cg)::CanGetTextExtent - invalid DC") );
1b89a5cd
SC
970
971 return true;
972}
973
888dde65 974void wxGCDCImpl::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *height,
1b89a5cd 975 wxCoord *descent, wxCoord *externalLeading ,
c94f845b 976 const wxFont *theFont ) const
1b89a5cd 977{
888dde65 978 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoGetTextExtent - invalid DC") );
1b89a5cd
SC
979
980 if ( theFont )
981 {
982 m_graphicContext->SetFont( *theFont, m_textForegroundColour );
983 }
984
985 wxDouble h , d , e , w;
986
987 m_graphicContext->GetTextExtent( str, &w, &h, &d, &e );
988
989 if ( height )
fcaea2fa 990 *height = (wxCoord)(h+0.5);
1b89a5cd 991 if ( descent )
fcaea2fa 992 *descent = (wxCoord)(d+0.5);
1b89a5cd 993 if ( externalLeading )
fcaea2fa 994 *externalLeading = (wxCoord)(e+0.5);
1b89a5cd 995 if ( width )
fcaea2fa 996 *width = (wxCoord)(w+0.5);
1b89a5cd
SC
997
998 if ( theFont )
999 {
1000 m_graphicContext->SetFont( m_font, m_textForegroundColour );
1001 }
1002}
1003
888dde65 1004bool wxGCDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
1b89a5cd 1005{
888dde65 1006 wxCHECK_MSG( IsOk(), false, wxT("wxGCDC(cg)::DoGetPartialTextExtents - invalid DC") );
1b89a5cd
SC
1007 widths.Clear();
1008 widths.Add(0,text.Length());
1009 if ( text.IsEmpty() )
1010 return true;
1011
1012 wxArrayDouble widthsD;
1013
1014 m_graphicContext->GetPartialTextExtents( text, widthsD );
1015 for ( size_t i = 0; i < widths.GetCount(); ++i )
0ebd9515 1016 widths[i] = (wxCoord)(widthsD[i] + 0.5);
1b89a5cd
SC
1017
1018 return true;
1019}
1020
888dde65 1021wxCoord wxGCDCImpl::GetCharWidth(void) const
1b89a5cd
SC
1022{
1023 wxCoord width;
1024 DoGetTextExtent( wxT("g") , &width , NULL , NULL , NULL , NULL );
1025
1026 return width;
1027}
1028
888dde65 1029wxCoord wxGCDCImpl::GetCharHeight(void) const
1b89a5cd
SC
1030{
1031 wxCoord height;
1032 DoGetTextExtent( wxT("g") , NULL , &height , NULL , NULL , NULL );
1033
1034 return height;
1035}
1036
888dde65 1037void wxGCDCImpl::Clear(void)
1b89a5cd 1038{
888dde65 1039 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::Clear - invalid DC") );
1b89a5cd
SC
1040 // TODO better implementation / incorporate size info into wxGCDC or context
1041 m_graphicContext->SetBrush( m_backgroundBrush );
1042 wxPen p = *wxTRANSPARENT_PEN;
1043 m_graphicContext->SetPen( p );
1044 DoDrawRectangle( 0, 0, 32000 , 32000 );
6c0aace2 1045 m_graphicContext->SetPen( m_pen );
1b89a5cd
SC
1046 m_graphicContext->SetBrush( m_brush );
1047}
1048
888dde65 1049void wxGCDCImpl::DoGetSize(int *width, int *height) const
1b89a5cd 1050{
1cc7d13a
SC
1051 wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoGetSize - invalid DC") );
1052 wxDouble w,h;
1053 m_graphicContext->GetSize( &w, &h );
1054 if ( height )
1055 *height = (int) (h+0.5);
1056 if ( width )
1057 *width = (int) (w+0.5);
1b89a5cd
SC
1058}
1059
888dde65 1060void wxGCDCImpl::DoGradientFillLinear(const wxRect& rect,
1b89a5cd
SC
1061 const wxColour& initialColour,
1062 const wxColour& destColour,
1063 wxDirection nDirection )
1064{
1065 wxPoint start;
1066 wxPoint end;
1067 switch( nDirection)
1068 {
1069 case wxWEST :
1070 start = rect.GetRightBottom();
1071 start.x++;
1072 end = rect.GetLeftBottom();
1073 break;
1074 case wxEAST :
1075 start = rect.GetLeftBottom();
1076 end = rect.GetRightBottom();
1077 end.x++;
1078 break;
1079 case wxNORTH :
1080 start = rect.GetLeftBottom();
1081 start.y++;
1082 end = rect.GetLeftTop();
1083 break;
1084 case wxSOUTH :
1085 start = rect.GetLeftTop();
1086 end = rect.GetLeftBottom();
1087 end.y++;
1088 break;
1089 default :
1090 break;
1091 }
1092
0ebd9515 1093 if (rect.width == 0 || rect.height == 0)
1b89a5cd
SC
1094 return;
1095
0ebd9515
SC
1096 m_graphicContext->SetBrush( m_graphicContext->CreateLinearGradientBrush(
1097 start.x,start.y,end.x,end.y, initialColour, destColour));
1b89a5cd 1098 m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
0ebd9515 1099 m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height);
1b89a5cd
SC
1100 m_graphicContext->SetPen(m_pen);
1101}
1102
888dde65 1103void wxGCDCImpl::DoGradientFillConcentric(const wxRect& rect,
1b89a5cd
SC
1104 const wxColour& initialColour,
1105 const wxColour& destColour,
1106 const wxPoint& circleCenter)
1107{
1108 //Radius
1109 wxInt32 cx = rect.GetWidth() / 2;
1110 wxInt32 cy = rect.GetHeight() / 2;
1111 wxInt32 nRadius;
1112 if (cx < cy)
1113 nRadius = cx;
1114 else
1115 nRadius = cy;
1116
0ebd9515 1117 // make sure the background is filled (todo move into specific platform implementation ?)
1b89a5cd
SC
1118 m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
1119 m_graphicContext->SetBrush( wxBrush( destColour) );
0ebd9515 1120 m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height);
1b89a5cd
SC
1121
1122 m_graphicContext->SetBrush( m_graphicContext->CreateRadialGradientBrush(
0ebd9515
SC
1123 rect.x+circleCenter.x,rect.y+circleCenter.y,
1124 rect.x+circleCenter.x,rect.y+circleCenter.y,
1125 nRadius,initialColour,destColour));
1b89a5cd 1126
0ebd9515 1127 m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height);
1b89a5cd
SC
1128 m_graphicContext->SetPen(m_pen);
1129}
1130
888dde65 1131void wxGCDCImpl::DoDrawCheckMark(wxCoord x, wxCoord y,
1b89a5cd
SC
1132 wxCoord width, wxCoord height)
1133{
888dde65 1134 wxDCImpl::DoDrawCheckMark(x,y,width,height);
1b89a5cd
SC
1135}
1136
1137#endif // wxUSE_GRAPHICS_CONTEXT