]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/dc.cpp
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "dc.h"
18 #include "wx/mac/uma.h"
19 #include "wx/dcmemory.h"
20 #include "wx/region.h"
27 #if !USE_SHARED_LIBRARY
28 IMPLEMENT_ABSTRACT_CLASS(wxDC
, wxObject
)
31 //-----------------------------------------------------------------------------
33 //-----------------------------------------------------------------------------
35 #define mm2inches 0.0393700787402
36 #define inches2mm 25.4
37 #define mm2twips 56.6929133859
38 #define twips2mm 0.0176388888889
39 #define mm2pt 2.83464566929
40 #define pt2mm 0.352777777778
42 const double M_PI
= 3.14159265358979 ;
44 const double RAD2DEG
= 180.0 / M_PI
;
46 //-----------------------------------------------------------------------------
48 //-----------------------------------------------------------------------------
50 static inline double dmin(double a
, double b
) { return a
< b
? a
: b
; }
51 static inline double dmax(double a
, double b
) { return a
> b
? a
: b
; }
52 static inline double DegToRad(double deg
) { return (deg
* M_PI
) / 180.0; }
54 //-----------------------------------------------------------------------------
56 //-----------------------------------------------------------------------------
63 m_mm_to_pix_x
= mm2pt
;
64 m_mm_to_pix_y
= mm2pt
;
66 m_internalDeviceOriginX
= 0;
67 m_internalDeviceOriginY
= 0;
68 m_externalDeviceOriginX
= 0;
69 m_externalDeviceOriginY
= 0;
71 m_logicalScaleX
= 1.0;
72 m_logicalScaleY
= 1.0;
78 m_needComputeScaleX
= FALSE
;
79 m_needComputeScaleY
= FALSE
;
81 m_maxX
= m_maxY
= -100000;
82 m_minY
= m_minY
= 100000;
88 m_macFontInstalled
= false ;
89 m_macBrushInstalled
= false ;
90 m_macPenInstalled
= false ;
92 m_macLocalOrigin
.h
= m_macLocalOrigin
.v
= 0 ;
93 m_macBoundaryClipRgn
= NewRgn() ;
94 m_macCurrentClipRgn
= NewRgn() ;
96 SetRectRgn( m_macBoundaryClipRgn
, -32000 , -32000 , 32000 , 32000 ) ;
97 SetRectRgn( m_macCurrentClipRgn
, -32000 , -32000 , 32000 , 32000 ) ;
100 m_font
= *wxNORMAL_FONT
;
101 m_brush
= *wxWHITE_BRUSH
;
103 wxMacPortSetter::wxMacPortSetter( const wxDC
* dc
) :
104 m_ph( dc
->m_macPort
)
106 wxASSERT( dc
->Ok() ) ;
108 dc
->MacSetupPort(&m_ph
) ;
111 wxMacPortSetter::~wxMacPortSetter()
117 DisposeRgn( m_macBoundaryClipRgn
) ;
118 DisposeRgn( m_macCurrentClipRgn
) ;
120 void wxDC::MacSetupPort(AGAPortHelper
* help
) const
122 // help->Setup( m_macPort ) ;
123 ::SetOrigin(-m_macLocalOrigin
.h
, -m_macLocalOrigin
.v
);
124 SetClip( m_macCurrentClipRgn
);
126 m_macFontInstalled
= false ;
127 m_macBrushInstalled
= false ;
128 m_macPenInstalled
= false ;
131 void wxDC::DoDrawBitmap( const wxBitmap
&bmp
, wxCoord x
, wxCoord y
, bool useMask
)
133 wxCHECK_RET( Ok(), wxT("invalid window dc") );
135 wxCHECK_RET( bmp
.Ok(), wxT("invalid bitmap") );
137 wxMacPortSetter
helper(this) ;
139 wxCoord xx
= XLOG2DEV(x
);
140 wxCoord yy
= YLOG2DEV(y
);
141 wxCoord w
= bmp
.GetWidth();
142 wxCoord h
= bmp
.GetHeight();
143 wxCoord ww
= XLOG2DEVREL(w
);
144 wxCoord hh
= YLOG2DEVREL(h
);
146 // Set up drawing mode
147 short mode
= (m_logicalFunction
== wxCOPY
? srcCopy
:
148 //m_logicalFunction == wxCLEAR ? WHITENESS :
149 //m_logicalFunction == wxSET ? BLACKNESS :
150 m_logicalFunction
== wxINVERT
? hilite
:
151 //m_logicalFunction == wxAND ? MERGECOPY :
152 m_logicalFunction
== wxOR
? srcOr
:
153 m_logicalFunction
== wxSRC_INVERT
? notSrcCopy
:
154 m_logicalFunction
== wxXOR
? srcXor
:
155 m_logicalFunction
== wxOR_REVERSE
? notSrcOr
:
156 //m_logicalFunction == wxAND_REVERSE ? SRCERASE :
157 //m_logicalFunction == wxSRC_OR ? srcOr :
158 //m_logicalFunction == wxSRC_AND ? SRCAND :
161 if ( bmp
.GetBitmapType() == kMacBitmapTypePict
) {
162 Rect bitmaprect
= { 0 , 0 , hh
, ww
};
163 ::OffsetRect( &bitmaprect
, xx
, yy
) ;
164 ::DrawPicture( bmp
.GetPict(), &bitmaprect
) ;
166 else if ( bmp
.GetBitmapType() == kMacBitmapTypeGrafWorld
)
168 GWorldPtr bmapworld
= bmp
.GetHBITMAP();
169 PixMapHandle bmappixels
;
171 // Set foreground and background colours (for bitmaps depth = 1)
172 if(bmp
.GetDepth() == 1)
174 RGBColor fore
= m_textForegroundColour
.GetPixel();
175 RGBColor back
= m_textBackgroundColour
.GetPixel();
181 RGBColor white
= { 0xFFFF, 0xFFFF,0xFFFF} ;
182 RGBColor black
= { 0,0,0} ;
183 RGBForeColor( &black
) ;
184 RGBBackColor( &white
) ;
187 bmappixels
= GetGWorldPixMap( bmapworld
) ;
189 wxCHECK_RET(LockPixels(bmappixels
),
190 wxT("DoDrawBitmap: Unable to lock pixels"));
192 Rect source
= { 0, 0, h
, w
};
193 Rect dest
= { yy
, xx
, yy
+ hh
, xx
+ ww
};
195 if ( useMask
&& bmp
.GetMask() )
197 if( LockPixels(GetGWorldPixMap(bmp
.GetMask()->GetMaskBitmap())))
201 GetPortBitMapForCopyBits(bmapworld
),
202 GetPortBitMapForCopyBits(bmp
.GetMask()->GetMaskBitmap()),
203 GetPortBitMapForCopyBits( m_macPort
),
204 &source
, &source
, &dest
, mode
, NULL
206 UnlockPixels(GetGWorldPixMap(bmp
.GetMask()->GetMaskBitmap()));
210 CopyBits( GetPortBitMapForCopyBits( bmapworld
),
211 GetPortBitMapForCopyBits( m_macPort
),
212 &source
, &dest
, mode
, NULL
) ;
214 UnlockPixels( bmappixels
) ;
216 else if ( bmp
.GetBitmapType() == kMacBitmapTypeIcon
)
218 Rect bitmaprect
= { 0 , 0 , bmp
.GetHeight(), bmp
.GetWidth() } ;
219 OffsetRect( &bitmaprect
, xx
, yy
) ;
220 PlotCIconHandle( &bitmaprect
, atNone
, ttNone
, bmp
.GetHICON() ) ;
222 m_macPenInstalled
= false ;
223 m_macBrushInstalled
= false ;
224 m_macFontInstalled
= false ;
228 void wxDC::DoDrawIcon( const wxIcon
&icon
, wxCoord x
, wxCoord y
)
230 wxCHECK_RET(Ok(), wxT("Invalid dc wxDC::DoDrawIcon"));
232 wxCHECK_RET(icon
.Ok(), wxT("Invalid icon wxDC::DoDrawIcon"));
234 DoDrawBitmap( icon
, x
, y
, icon
.GetMask() != NULL
) ;
236 void wxDC::DoSetClippingRegion( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
238 wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion Invalid DC"));
239 wxCoord xx
, yy
, ww
, hh
;
243 ww
= XLOG2DEVREL(width
);
244 hh
= YLOG2DEVREL(height
);
246 SetRectRgn( m_macCurrentClipRgn
, xx
, yy
, xx
+ ww
, yy
+ hh
) ;
247 SectRgn( m_macCurrentClipRgn
, m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
251 m_clipX1
= wxMax( m_clipX1
, xx
);
252 m_clipY1
= wxMax( m_clipY1
, yy
);
253 m_clipX2
= wxMin( m_clipX2
, (xx
+ ww
));
254 m_clipY2
= wxMin( m_clipY2
, (yy
+ hh
));
266 void wxDC::DoSetClippingRegionAsRegion( const wxRegion
®ion
)
268 wxCHECK_RET( Ok(), wxT("invalid window dc") ) ;
270 wxMacPortSetter
helper(this) ;
273 DestroyClippingRegion();
278 region
.GetBox( x
, y
, w
, h
);
279 wxCoord xx
, yy
, ww
, hh
;
286 // if we have a scaling that we cannot map onto native regions
287 // we must use the box
289 if ( ww
!= w
|| hh
!= h
)
291 wxDC::DoSetClippingRegion( x
, y
, w
, h
);
295 CopyRgn( region
.GetWXHRGN() , m_macCurrentClipRgn
) ;
296 if ( xx
!= x
|| yy
!= y
)
298 OffsetRgn( m_macCurrentClipRgn
, xx
- x
, yy
- y
) ;
300 SectRgn( m_macCurrentClipRgn
, m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
303 m_clipX1
= wxMax( m_clipX1
, xx
);
304 m_clipY1
= wxMax( m_clipY1
, yy
);
305 m_clipX2
= wxMin( m_clipX2
, (xx
+ ww
));
306 m_clipY2
= wxMin( m_clipY2
, (yy
+ hh
));
320 void wxDC::DestroyClippingRegion()
322 wxMacPortSetter
helper(this) ;
323 CopyRgn( m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
326 void wxDC::DoGetSize( int* width
, int* height
) const
328 *width
= m_maxX
-m_minX
;
329 *height
= m_maxY
-m_minY
;
331 void wxDC::DoGetSizeMM( int* width
, int* height
) const
336 *width
= long( double(w
) / (m_scaleX
*m_mm_to_pix_x
) );
337 *height
= long( double(h
) / (m_scaleY
*m_mm_to_pix_y
) );
339 void wxDC::SetTextForeground( const wxColour
&col
)
341 wxCHECK_RET(Ok(), wxT("Invalid DC"));
342 m_textForegroundColour
= col
;
343 m_macFontInstalled
= false ;
345 void wxDC::SetTextBackground( const wxColour
&col
)
347 wxCHECK_RET(Ok(), wxT("Invalid DC"));
348 m_textBackgroundColour
= col
;
349 m_macFontInstalled
= false ;
351 void wxDC::SetMapMode( int mode
)
356 SetLogicalScale( twips2mm
*m_mm_to_pix_x
, twips2mm
*m_mm_to_pix_y
);
359 SetLogicalScale( pt2mm
*m_mm_to_pix_x
, pt2mm
*m_mm_to_pix_y
);
362 SetLogicalScale( m_mm_to_pix_x
, m_mm_to_pix_y
);
365 SetLogicalScale( m_mm_to_pix_x
/10.0, m_mm_to_pix_y
/10.0 );
369 SetLogicalScale( 1.0, 1.0 );
372 if (mode
!= wxMM_TEXT
)
374 m_needComputeScaleX
= TRUE
;
375 m_needComputeScaleY
= TRUE
;
378 void wxDC::SetUserScale( double x
, double y
)
380 // allow negative ? -> no
383 ComputeScaleAndOrigin();
385 void wxDC::SetLogicalScale( double x
, double y
)
390 ComputeScaleAndOrigin();
392 void wxDC::SetLogicalOrigin( wxCoord x
, wxCoord y
)
394 m_logicalOriginX
= x
* m_signX
; // is this still correct ?
395 m_logicalOriginY
= y
* m_signY
;
396 ComputeScaleAndOrigin();
398 void wxDC::SetDeviceOrigin( wxCoord x
, wxCoord y
)
400 m_externalDeviceOriginX
= x
;
401 m_externalDeviceOriginY
= y
;
402 ComputeScaleAndOrigin();
406 void wxDC::SetInternalDeviceOrigin( long x
, long y
)
408 m_internalDeviceOriginX
= x
;
409 m_internalDeviceOriginY
= y
;
410 ComputeScaleAndOrigin();
412 void wxDC::GetInternalDeviceOrigin( long *x
, long *y
)
414 if (x
) *x
= m_internalDeviceOriginX
;
415 if (y
) *y
= m_internalDeviceOriginY
;
418 void wxDC::SetAxisOrientation( bool xLeftRight
, bool yBottomUp
)
420 m_signX
= (xLeftRight
? 1 : -1);
421 m_signY
= (yBottomUp
? -1 : 1);
422 ComputeScaleAndOrigin();
425 void wxDC::CalcBoundingBox( long x, long y )
427 if (x < m_minX) m_minX = x;
428 if (y < m_minY) m_minY = y;
429 if (x > m_maxX) m_maxX = x;
430 if (y > m_maxY) m_maxY = y;
432 wxSize
wxDC::GetPPI() const
434 return wxSize(72, 72);
437 int wxDC::GetDepth() const
439 return wxDisplayDepth() ;
442 void wxDC::ComputeScaleAndOrigin()
444 // CMB: copy scale to see if it changes
445 double origScaleX
= m_scaleX
;
446 double origScaleY
= m_scaleY
;
448 m_scaleX
= m_logicalScaleX
* m_userScaleX
;
449 m_scaleY
= m_logicalScaleY
* m_userScaleY
;
451 m_deviceOriginX
= m_internalDeviceOriginX
+ m_externalDeviceOriginX
;
452 m_deviceOriginY
= m_internalDeviceOriginY
+ m_externalDeviceOriginY
;
454 // CMB: if scale has changed call SetPen to recalulate the line width
455 if (m_scaleX
!= origScaleX
|| m_scaleY
!= origScaleY
)
457 // this is a bit artificial, but we need to force wxDC to think
458 // the pen has changed
459 wxPen
* pen
= & GetPen();
465 void wxDC::SetPalette( const wxPalette
& palette
)
469 void wxDC::SetBackgroundMode( int mode
)
471 m_backgroundMode
= mode
;
474 void wxDC::SetFont( const wxFont
&font
)
476 wxCHECK_RET(Ok(), wxT("Invalid DC"));
479 m_macFontInstalled
= false ;
482 void wxDC::SetPen( const wxPen
&pen
)
484 wxCHECK_RET(Ok(), wxT("Invalid DC"));
491 m_macPenInstalled
= false ;
494 void wxDC::SetBrush( const wxBrush
&brush
)
496 wxCHECK_RET(Ok(), wxT("Invalid DC"));
498 if (m_brush
== brush
)
502 m_macBrushInstalled
= false ;
505 void wxDC::SetBackground( const wxBrush
&brush
)
507 wxCHECK_RET(Ok(), wxT("Invalid DC"));
509 if (m_backgroundBrush
== brush
)
512 m_backgroundBrush
= brush
;
514 if (!m_backgroundBrush
.Ok())
516 m_macBrushInstalled
= false ;
519 void wxDC::SetLogicalFunction( int function
)
521 if (m_logicalFunction
== function
)
524 m_logicalFunction
= function
;
525 m_macFontInstalled
= false ;
526 m_macBrushInstalled
= false ;
527 m_macPenInstalled
= false ;
530 void wxDC::DoFloodFill( wxCoord x
, wxCoord y
, const wxColour
& col
,
535 bool wxDC::DoGetPixel( wxCoord x
, wxCoord y
, wxColour
*col
) const
537 wxCHECK_MSG( Ok(), false, wxT("wxDC::DoGetPixel Invalid DC") );
538 wxMacPortSetter
helper(this) ;
542 GetCPixel( XLOG2DEV(x
), YLOG2DEV(y
), &colour
);
544 // Convert from Mac colour to wx
545 col
->Set( colour
.red
>> 8,
552 void wxDC::DoDrawLine( wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
554 wxCHECK_RET(Ok(), wxT("Invalid DC"));
556 wxMacPortSetter
helper(this) ;
558 if (m_pen
.GetStyle() != wxTRANSPARENT
)
561 wxCoord offset
= ( (m_pen
.GetWidth() == 0 ? 1 :
562 m_pen
.GetWidth() ) * (wxCoord
)m_scaleX
- 1) / 2;
564 wxCoord xx1
= XLOG2DEV(x1
) - offset
;
565 wxCoord yy1
= YLOG2DEV(y1
) - offset
;
566 wxCoord xx2
= XLOG2DEV(x2
) - offset
;
567 wxCoord yy2
= YLOG2DEV(y2
) - offset
;
569 if ((m_pen
.GetCap() == wxCAP_ROUND
) &&
570 (m_pen
.GetWidth() <= 1))
572 // Implement LAST_NOT for MAC at least for
573 // orthogonal lines. RR.
595 void wxDC::DoCrossHair( wxCoord x
, wxCoord y
)
597 wxCHECK_RET( Ok(), wxT("wxDC::DoCrossHair Invalid window dc") );
599 if (m_pen
.GetStyle() != wxTRANSPARENT
)
604 wxCoord xx
= XLOG2DEV(x
);
605 wxCoord yy
= YLOG2DEV(y
);
609 ::LineTo( XLOG2DEVREL(w
), yy
);
611 ::LineTo( xx
, YLOG2DEVREL(h
) );
616 * To draw arcs properly the angles need to be converted from the WX style:
617 * Angles start on the +ve X axis and go anti-clockwise (As you would draw on
618 * a normal axis on paper).
621 * Angles start on the +ve y axis and go clockwise.
622 * To achive this I work out which quadrant the angle lies in then map this to
623 * the equivalent quadrant on the Mac. (Sin and Cos values reveal which
624 * quadrant you are in).
626 static double wxConvertWXangleToMACangle(double angle
)
630 sin_a
= sin(angle
/ RAD2DEG
);
631 cos_a
= cos(angle
/ RAD2DEG
);
633 if( (sin_a
>= 0.0) && (cos_a
>= 0.0) ) {
634 angle
= acos(sin_a
) * RAD2DEG
;
636 else if( (sin_a
>= 0.0) && (cos_a
<= 0.0) ) {
638 angle
= acos(sin_a
) * RAD2DEG
+ 180;
640 else if( (sin_a
<= 0.0) && (cos_a
>= 0.0) ) {
641 angle
= acos(sin_a
) * RAD2DEG
+ 180;
643 else if( (sin_a
< 0.0) && (cos_a
< 0.0) ) {
645 angle
= acos(sin_a
) * RAD2DEG
+ 180;
650 void wxDC::DoDrawArc( wxCoord x1
, wxCoord y1
,
651 wxCoord x2
, wxCoord y2
,
652 wxCoord xc
, wxCoord yc
)
654 wxCHECK_RET(Ok(), wxT("wxDC::DoDrawArc Invalid DC"));
656 wxCoord xx1
= XLOG2DEV(x1
);
657 wxCoord yy1
= YLOG2DEV(y1
);
658 wxCoord xx2
= XLOG2DEV(x2
);
659 wxCoord yy2
= YLOG2DEV(y2
);
660 wxCoord xxc
= XLOG2DEV(xc
);
661 wxCoord yyc
= YLOG2DEV(yc
);
662 double dx
= xx1
- xxc
;
663 double dy
= yy1
- yyc
;
664 double radius
= sqrt((double)(dx
*dx
+dy
*dy
));
665 wxCoord rad
= (wxCoord
)radius
;
666 double radius1
, radius2
;
668 if (xx1
== xx2
&& yy1
== yy2
)
673 else if (radius
== 0.0)
675 radius1
= radius2
= 0.0;
679 radius1
= (xx1
- xxc
== 0) ?
680 (yy1
- yyc
< 0) ? 90.0 : -90.0 :
681 -atan2(double(yy1
-yyc
), double(xx1
-xxc
)) * RAD2DEG
;
682 radius2
= (xx2
- xxc
== 0) ?
683 (yy2
- yyc
< 0) ? 90.0 : -90.0 :
684 -atan2(double(yy2
-yyc
), double(xx2
-xxc
)) * RAD2DEG
;
686 wxCoord alpha2
= wxCoord(radius2
- radius1
);
687 wxCoord alpha1
= wxCoord(wxConvertWXangleToMACangle(radius1
));
688 if( (xx1
> xx2
) || (yy1
> yy2
) ) {
692 Rect r
= { yyc
- rad
, xxc
- rad
, yyc
+ rad
, xxc
+ rad
};
694 if(m_brush
.GetStyle() != wxTRANSPARENT
) {
696 PaintArc(&r
, alpha1
, alpha2
);
698 if(m_pen
.GetStyle() != wxTRANSPARENT
) {
700 FrameArc(&r
, alpha1
, alpha2
);
704 void wxDC::DoDrawEllipticArc( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
705 double sa
, double ea
)
707 wxCHECK_RET(Ok(), wxT("wxDC::DoDrawEllepticArc Invalid DC"));
710 double angle
= sa
- ea
; // Order important Mac in opposite direction to wx
712 wxCoord xx
= XLOG2DEV(x
);
713 wxCoord yy
= YLOG2DEV(y
);
714 wxCoord ww
= m_signX
* XLOG2DEVREL(w
);
715 wxCoord hh
= m_signY
* YLOG2DEVREL(h
);
717 // handle -ve width and/or height
718 if (ww
< 0) { ww
= -ww
; xx
= xx
- ww
; }
719 if (hh
< 0) { hh
= -hh
; yy
= yy
- hh
; }
721 sa
= wxConvertWXangleToMACangle(sa
);
728 if(m_brush
.GetStyle() != wxTRANSPARENT
) {
730 PaintArc(&r
, (short)sa
, (short)angle
);
732 if(m_pen
.GetStyle() != wxTRANSPARENT
) {
734 FrameArc(&r
, (short)sa
, (short)angle
);
738 void wxDC::DoDrawPoint( wxCoord x
, wxCoord y
)
740 wxCHECK_RET(Ok(), wxT("Invalid DC"));
742 wxMacPortSetter
helper(this) ;
744 if (m_pen
.GetStyle() != wxTRANSPARENT
)
747 wxCoord xx1
= XLOG2DEV(x
);
748 wxCoord yy1
= YLOG2DEV(y
);
751 ::LineTo(xx1
+1, yy1
+1);
755 void wxDC::DoDrawLines(int n
, wxPoint points
[],
756 wxCoord xoffset
, wxCoord yoffset
)
758 wxCHECK_RET(Ok(), wxT("Invalid DC"));
759 wxMacPortSetter
helper(this) ;
761 if (m_pen
.GetStyle() == wxTRANSPARENT
)
766 wxCoord offset
= ( (m_pen
.GetWidth() == 0 ? 1 :
767 m_pen
.GetWidth() ) * (wxCoord
)m_scaleX
- 1) / 2 ;
769 wxCoord x1
, x2
, y1
, y2
;
770 x1
= XLOG2DEV(points
[0].x
+ xoffset
);
771 y1
= YLOG2DEV(points
[0].y
+ yoffset
);
772 ::MoveTo(x1
- offset
, y1
- offset
);
774 for (int i
= 0; i
< n
-1; i
++)
776 x2
= XLOG2DEV(points
[i
+1].x
+ xoffset
);
777 y2
= YLOG2DEV(points
[i
+1].y
+ yoffset
);
778 ::LineTo( x2
- offset
, y2
- offset
);
782 void wxDC::DoDrawPolygon(int n
, wxPoint points
[],
783 wxCoord xoffset
, wxCoord yoffset
,
786 wxCHECK_RET(Ok(), wxT("Invalid DC"));
787 wxMacPortSetter
helper(this) ;
789 wxCoord x1
, x2
, y1
, y2
;
791 if (m_brush
.GetStyle() != wxTRANSPARENT
)
793 PolyHandle polygon
= OpenPoly();
795 x1
= XLOG2DEV(points
[0].x
+ xoffset
);
796 y1
= YLOG2DEV(points
[0].y
+ yoffset
);
799 for (int i
= 0; i
< n
-1; i
++)
801 x2
= XLOG2DEV(points
[i
+1].x
+ xoffset
);
802 y2
= YLOG2DEV(points
[i
+1].y
+ yoffset
);
809 ::PaintPoly( polygon
);
814 if (m_pen
.GetStyle() != wxTRANSPARENT
)
816 PolyHandle polygon
= OpenPoly();
818 x1
= XLOG2DEV(points
[0].x
+ xoffset
);
819 y1
= YLOG2DEV(points
[0].y
+ yoffset
);
822 for (int i
= 0; i
< n
-1; i
++)
824 x2
= XLOG2DEV(points
[i
+1].x
+ xoffset
);
825 y2
= YLOG2DEV(points
[i
+1].y
+ yoffset
);
829 // return to origin to close path
835 ::FramePoly( polygon
) ;
841 void wxDC::DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
843 wxCHECK_RET(Ok(), wxT("Invalid DC"));
844 wxMacPortSetter
helper(this) ;
846 wxCoord xx
= XLOG2DEV(x
);
847 wxCoord yy
= YLOG2DEV(y
);
848 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
849 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
851 // CMB: draw nothing if transformed w or h is 0
852 if (ww
== 0 || hh
== 0)
855 // CMB: handle -ve width and/or height
868 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
870 if (m_brush
.GetStyle() != wxTRANSPARENT
)
873 ::PaintRect( &rect
) ;
876 if (m_pen
.GetStyle() != wxTRANSPARENT
)
879 ::FrameRect( &rect
) ;
883 void wxDC::DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
884 wxCoord width
, wxCoord height
,
887 wxCHECK_RET(Ok(), wxT("Invalid DC"));
888 wxMacPortSetter
helper(this) ;
891 radius
= - radius
* ((width
< height
) ? width
: height
);
893 wxCoord xx
= XLOG2DEV(x
);
894 wxCoord yy
= YLOG2DEV(y
);
895 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
896 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
898 // CMB: draw nothing if transformed w or h is 0
899 if (ww
== 0 || hh
== 0)
902 // CMB: handle -ve width and/or height
915 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
917 if (m_brush
.GetStyle() != wxTRANSPARENT
)
920 ::PaintRoundRect( &rect
, int(radius
* 2) , int(radius
* 2) ) ;
923 if (m_pen
.GetStyle() != wxTRANSPARENT
)
926 ::FrameRoundRect( &rect
, int(radius
* 2) , int(radius
* 2) ) ;
930 void wxDC::DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
932 wxCHECK_RET(Ok(), wxT("Invalid DC"));
933 wxMacPortSetter
helper(this) ;
935 wxCoord xx
= XLOG2DEV(x
);
936 wxCoord yy
= YLOG2DEV(y
);
937 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
938 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
940 // CMB: draw nothing if transformed w or h is 0
941 if (ww
== 0 || hh
== 0)
944 // CMB: handle -ve width and/or height
957 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
959 if (m_brush
.GetStyle() != wxTRANSPARENT
)
962 ::PaintOval( &rect
) ;
965 if (m_pen
.GetStyle() != wxTRANSPARENT
)
968 ::FrameOval( &rect
) ;
974 bool wxDC::CanDrawBitmap(void) const
980 bool wxDC::DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
981 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
, int logical_func
, bool useMask
,
982 wxCoord xsrcMask
, wxCoord ysrcMask
)
984 wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc"));
985 wxCHECK_MSG(source
->Ok(), false, wxT("wxDC::DoBlit Illegal source DC"));
986 wxMacPortSetter
helper(this) ;
988 /* TODO: use the mask origin when drawing transparently */
989 if (xsrcMask
== -1 && ysrcMask
== -1)
991 xsrcMask
= xsrc
; ysrcMask
= ysrc
;
994 CGrafPtr sourcePort
= (CGrafPtr
) source
->m_macPort
;
995 PixMapHandle bmappixels
= GetGWorldPixMap( sourcePort
) ;
996 RGBColor white
= { 0xFFFF, 0xFFFF,0xFFFF} ;
997 RGBColor black
= { 0,0,0} ;
998 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
999 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
1000 RGBForeColor( &forecolor
) ;
1001 RGBBackColor( &backcolor
) ;
1003 if ( LockPixels(bmappixels
) )
1005 Rect srcrect
, dstrect
;
1006 srcrect
.top
= source
->YLOG2DEV(ysrc
) ;
1007 srcrect
.left
= source
->XLOG2DEV(xsrc
) ;
1008 srcrect
.right
= source
->XLOG2DEV(xsrc
+ width
) ;
1009 srcrect
.bottom
= source
->YLOG2DEV(ysrc
+ height
) ;
1010 dstrect
.top
= YLOG2DEV(ydest
) ;
1011 dstrect
.left
= XLOG2DEV(xdest
) ;
1012 dstrect
.bottom
= YLOG2DEV(ydest
+ height
) ;
1013 dstrect
.right
= XLOG2DEV(xdest
+ width
) ;
1015 short mode
= (logical_func
== wxCOPY
? srcCopy
:
1016 // logical_func == wxCLEAR ? WHITENESS :
1017 // logical_func == wxSET ? BLACKNESS :
1018 logical_func
== wxINVERT
? hilite
:
1019 // logical_func == wxAND ? MERGECOPY :
1020 logical_func
== wxOR
? srcOr
:
1021 logical_func
== wxSRC_INVERT
? notSrcCopy
:
1022 logical_func
== wxXOR
? srcXor
:
1023 // logical_func == wxOR_REVERSE ? MERGEPAINT :
1024 // logical_func == wxAND_REVERSE ? SRCERASE :
1025 // logical_func == wxSRC_OR ? srcOr :
1026 // logical_func == wxSRC_AND ? SRCAND :
1029 if ( useMask
&& source
->m_macMask
)
1031 wxASSERT( mode
== srcCopy
) ;
1032 if ( LockPixels( GetGWorldPixMap( source
->m_macMask
) ) )
1034 CopyMask( GetPortBitMapForCopyBits( sourcePort
) ,
1035 GetPortBitMapForCopyBits( source
->m_macMask
) ,
1036 GetPortBitMapForCopyBits( m_macPort
) ,
1037 &srcrect
, &srcrect
, &dstrect
) ;
1038 UnlockPixels( GetGWorldPixMap( source
->m_macMask
) ) ;
1043 CopyBits( GetPortBitMapForCopyBits( sourcePort
) ,
1044 GetPortBitMapForCopyBits( m_macPort
) ,
1045 &srcrect
, &dstrect
, mode
, NULL
) ;
1047 UnlockPixels( bmappixels
) ;
1050 m_macPenInstalled
= false ;
1051 m_macBrushInstalled
= false ;
1052 m_macFontInstalled
= false ;
1057 void wxDC::DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
1060 wxCHECK_RET( Ok(), wxT("wxDC::DoDrawRotatedText Invalid window dc") );
1064 DrawText(text
, x
, y
);
1070 // the size of the text
1072 GetTextExtent(text
, &w
, &h
);
1074 // draw the string normally
1077 dc
.SelectObject(src
);
1078 dc
.SetFont(GetFont());
1079 dc
.SetBackground(*wxWHITE_BRUSH
);
1080 dc
.SetBrush(*wxBLACK_BRUSH
);
1082 dc
.DrawText(text
, 0, 0);
1083 dc
.SetFont(wxNullFont
);
1084 dc
.SelectObject(wxNullBitmap
);
1086 wxMacPortSetter
helper(this) ;
1088 // Calculate the size of the rotated bounding box.
1089 double rad
= DegToRad(angle
);
1090 double dx
= cos(rad
);
1091 double dy
= sin(rad
);
1093 // the rectngle vertices are counted clockwise with the first one being at
1094 // (0, 0) (or, rather, at (x, y))
1096 double y2
= -w
* dy
; // y axis points to the bottom, hence minus
1099 double x3
= x4
+ x2
;
1100 double y3
= y4
+ y2
;
1103 wxCoord maxX
= (wxCoord
)(dmax(x2
, dmax(x3
, x4
)) + 0.5);
1104 wxCoord maxY
= (wxCoord
)(dmax(y2
, dmax(y3
, y4
)) + 0.5);
1105 wxCoord minX
= (wxCoord
)(dmin(x2
, dmin(x3
, x4
)) - 0.5);
1106 wxCoord minY
= (wxCoord
)(dmin(y2
, dmin(y3
, y4
)) - 0.5);
1108 // prepare to blit-with-rotate the bitmap to the DC
1111 RGBColor colText
= m_textForegroundColour
.GetPixel();
1112 RGBColor colBack
= m_textBackgroundColour
.GetPixel();
1114 unsigned char *data
= image
.GetData();
1117 double r
, angleOrig
;
1120 // paint pixel by pixel
1121 for ( wxCoord srcX
= 0; srcX
< w
; srcX
++ )
1123 for ( wxCoord srcY
= 0; srcY
< h
; srcY
++ )
1125 // transform source coords to dest coords
1126 r
= sqrt( (double)(srcX
* srcX
+ srcY
* srcY
) );
1127 angleOrig
= atan2((double)srcY
, (double)srcX
) - rad
;
1128 dstX
= (wxCoord
)(r
* cos(angleOrig
) + 0.5);
1129 dstY
= (wxCoord
)(r
* sin(angleOrig
) + 0.5);
1132 textPixel
= data
[(srcY
*w
+ srcX
)*3] == 0;
1133 if ( textPixel
|| (m_backgroundMode
== wxSOLID
) )
1135 SetCPixel(XLOG2DEV(x
+ dstX
), YLOG2DEV(y
+ dstY
),
1136 textPixel
? &colText
: &colBack
);
1141 // it would be better to draw with non underlined font and draw the line
1142 // manually here (it would be more straight...)
1144 if ( m_font
.GetUnderlined() )
1146 ::MoveTo(XLOG2DEV(x
+ x4
), YLOG2DEV(y
+ y4
+ font
->descent
));
1147 ::LineTo(XLOG2DEV(x
+ x3
), YLOG2DEV(y
+ y3
+ font
->descent
));
1151 // update the bounding box
1152 CalcBoundingBox(x
+ minX
, y
+ minY
);
1153 CalcBoundingBox(x
+ maxX
, y
+ maxY
);
1155 void wxDC::DoDrawText(const wxString
& strtext
, wxCoord x
, wxCoord y
)
1157 wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC"));
1158 wxMacPortSetter
helper(this) ;
1160 long xx
= XLOG2DEV(x
);
1161 long yy
= YLOG2DEV(y
);
1163 // if (m_pen.GetStyle() != wxTRANSPARENT)
1167 Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
1169 ::ClipRect( &clip ) ;
1173 ::GetFontInfo( &fi
) ;
1176 ::MoveTo( xx
, yy
);
1177 if ( m_backgroundMode
== wxTRANSPARENT
)
1179 ::TextMode( srcOr
) ;
1183 ::TextMode( srcCopy
) ;
1186 const char *text
= NULL
;
1190 if ( wxApp::s_macDefaultEncodingIsPC
)
1192 macText
= wxMacMakeMacStringFromPC( strtext
) ;
1194 length
= macText
.Length() ;
1199 length
= strtext
.Length() ;
1208 if( text
[i
] == 13 || text
[i
] == 10)
1210 ::DrawText( text
, laststop
, i
- laststop
) ;
1212 ::MoveTo( xx
, yy
+ line
*(fi
.descent
+ fi
.ascent
+ fi
.leading
) );
1218 ::DrawText( text
, laststop
, i
- laststop
) ;
1219 ::TextMode( srcOr
) ;
1223 bool wxDC::CanGetTextExtent() const
1225 wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
1230 void wxDC::DoGetTextExtent( const wxString
&string
, wxCoord
*width
, wxCoord
*height
,
1231 wxCoord
*descent
, wxCoord
*externalLeading
,
1232 wxFont
*theFont
) const
1234 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1235 wxMacPortSetter
helper(this) ;
1237 wxFont formerFont
= m_font
;
1241 wxFontRefData
* font
= (wxFontRefData
*) m_font
.GetRefData() ;
1245 ::TextFont( font
->m_macFontNum
) ;
1246 ::TextSize( YLOG2DEVREL( font
->m_macFontSize
) ) ;
1247 ::TextFace( font
->m_macFontStyle
) ;
1256 ::GetFontInfo( &fi
) ;
1259 *height
= YDEV2LOGREL( fi
.descent
+ fi
.ascent
) ;
1261 *descent
=YDEV2LOGREL( fi
.descent
);
1262 if ( externalLeading
)
1263 *externalLeading
= YDEV2LOGREL( fi
.leading
) ;
1265 const char *text
= NULL
;
1268 if ( wxApp::s_macDefaultEncodingIsPC
)
1270 macText
= wxMacMakeMacStringFromPC( string
) ;
1272 length
= macText
.Length() ;
1277 length
= string
.Length() ;
1289 if( text
[i
] == 13 || text
[i
] == 10)
1292 *height
+= YDEV2LOGREL( fi
.descent
+ fi
.ascent
+ fi
.leading
) ;
1293 curwidth
= ::TextWidth( text
, laststop
, i
- laststop
) ;
1294 if ( curwidth
> *width
)
1295 *width
= XDEV2LOGREL( curwidth
) ;
1301 curwidth
= ::TextWidth( text
, laststop
, i
- laststop
) ;
1302 if ( curwidth
> *width
)
1303 *width
= XDEV2LOGREL( curwidth
) ;
1308 m_macFontInstalled
= false ;
1312 wxCoord
wxDC::GetCharWidth(void) const
1314 wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
1316 wxMacPortSetter
helper(this) ;
1320 int width
= ::TextWidth( "n" , 0 , 1 ) ;
1322 return YDEV2LOGREL(width
) ;
1325 wxCoord
wxDC::GetCharHeight(void) const
1327 wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
1329 wxMacPortSetter
helper(this) ;
1334 ::GetFontInfo( &fi
) ;
1336 return YDEV2LOGREL( fi
.descent
+ fi
.ascent
);
1339 void wxDC::Clear(void)
1341 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1342 wxMacPortSetter
helper(this) ;
1343 Rect rect
= { -32767 , -32767 , 32767 , 32767 } ;
1345 if (m_backgroundBrush
.GetStyle() != wxTRANSPARENT
)
1348 ::EraseRect( &rect
) ;
1352 void wxDC::MacInstallFont() const
1354 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1355 // if ( m_macFontInstalled )
1357 Pattern blackColor
;
1359 wxFontRefData
* font
= (wxFontRefData
*) m_font
.GetRefData() ;
1363 ::TextFont( font
->m_macFontNum
) ;
1364 ::TextSize( short(m_scaleY
* font
->m_macFontSize
) ) ;
1365 ::TextFace( font
->m_macFontStyle
) ;
1367 m_macFontInstalled
= true ;
1368 m_macBrushInstalled
= false ;
1369 m_macPenInstalled
= false ;
1371 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
1372 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
1373 ::RGBForeColor( &forecolor
);
1374 ::RGBBackColor( &backcolor
);
1380 GetFNum( "\pGeneva" , &fontnum
) ;
1381 ::TextFont( fontnum
) ;
1382 ::TextSize( short(m_scaleY
* 10) ) ;
1385 // todo reset after spacing changes - or store the current spacing somewhere
1387 m_macFontInstalled
= true ;
1388 m_macBrushInstalled
= false ;
1389 m_macPenInstalled
= false ;
1391 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
1392 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
1393 ::RGBForeColor( &forecolor
);
1394 ::RGBBackColor( &backcolor
);
1397 short mode
= patCopy
;
1401 switch( m_logicalFunction
)
1406 case wxINVERT
: // NOT dst
1407 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1410 case wxXOR
: // src XOR dst
1413 case wxOR_REVERSE
: // src OR (NOT dst)
1416 case wxSRC_INVERT
: // (NOT src)
1423 case wxAND_REVERSE
:// src AND (NOT dst)
1424 case wxAND
: // src AND dst
1425 case wxAND_INVERT
: // (NOT src) AND dst
1426 case wxNO_OP
: // dst
1427 case wxNOR
: // (NOT src) AND (NOT dst)
1428 case wxEQUIV
: // (NOT src) XOR dst
1429 case wxOR_INVERT
: // (NOT src) OR dst
1430 case wxNAND
: // (NOT src) OR (NOT dst)
1431 case wxOR
: // src OR dst
1433 // case wxSRC_OR: // source _bitmap_ OR destination
1434 // case wxSRC_AND: // source _bitmap_ AND destination
1440 static void wxMacGetHatchPattern(int hatchStyle
, Pattern
*pattern
)
1442 int thePatListID
= sysPatListID
;
1446 case wxBDIAGONAL_HATCH
:
1447 theIndex
= 34; // WCH: this is not good
1449 case wxFDIAGONAL_HATCH
:
1455 case wxHORIZONTAL_HATCH
:
1458 case wxVERTICAL_HATCH
:
1461 case wxCROSSDIAG_HATCH
:
1462 theIndex
= 4; // WCH: this is not good
1465 theIndex
= 1; // solid pattern
1468 GetIndPattern( pattern
, thePatListID
, theIndex
);
1471 void wxDC::MacInstallPen() const
1473 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1477 // if ( m_macPenInstalled )
1480 RGBColor forecolor
= m_pen
.GetColour().GetPixel();
1481 RGBColor backcolor
= m_backgroundBrush
.GetColour().GetPixel();
1482 ::RGBForeColor( &forecolor
);
1483 ::RGBBackColor( &backcolor
);
1486 int penWidth
= m_pen
.GetWidth() * (int) m_scaleX
;
1488 // null means only one pixel, at whatever resolution
1489 if ( penWidth
== 0 )
1491 ::PenSize(penWidth
, penWidth
);
1493 int penStyle
= m_pen
.GetStyle();
1495 if (penStyle
== wxSOLID
)
1497 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1499 else if (IS_HATCH(penStyle
))
1502 wxMacGetHatchPattern(penStyle
, &pat
);
1507 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1510 short mode
= patCopy
;
1514 switch( m_logicalFunction
)
1519 case wxINVERT
: // NOT dst
1520 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1523 case wxXOR
: // src XOR dst
1526 case wxOR_REVERSE
: // src OR (NOT dst)
1529 case wxSRC_INVERT
: // (NOT src)
1536 case wxAND_REVERSE
:// src AND (NOT dst)
1537 case wxAND
: // src AND dst
1538 case wxAND_INVERT
: // (NOT src) AND dst
1539 case wxNO_OP
: // dst
1540 case wxNOR
: // (NOT src) AND (NOT dst)
1541 case wxEQUIV
: // (NOT src) XOR dst
1542 case wxOR_INVERT
: // (NOT src) OR dst
1543 case wxNAND
: // (NOT src) OR (NOT dst)
1544 case wxOR
: // src OR dst
1546 // case wxSRC_OR: // source _bitmap_ OR destination
1547 // case wxSRC_AND: // source _bitmap_ AND destination
1551 m_macPenInstalled
= true ;
1552 m_macBrushInstalled
= false ;
1553 m_macFontInstalled
= false ;
1556 void wxDC::MacInstallBrush() const
1558 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1560 Pattern blackColor
, whiteColor
;
1561 // if ( m_macBrushInstalled )
1566 RGBColor forecolor
= m_brush
.GetColour().GetPixel();
1567 RGBColor backcolor
= m_backgroundBrush
.GetColour().GetPixel();
1568 ::RGBForeColor( &forecolor
);
1569 ::RGBBackColor( &backcolor
);
1571 int brushStyle
= m_brush
.GetStyle();
1572 if (brushStyle
== wxSOLID
)
1573 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1574 else if (IS_HATCH(brushStyle
))
1577 wxMacGetHatchPattern(brushStyle
, &pat
);
1582 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1588 brushStyle
= m_backgroundBrush
.GetStyle();
1589 if (brushStyle
== wxSOLID
)
1590 ::BackPat(GetQDGlobalsWhite(&whiteColor
));
1591 else if (IS_HATCH(brushStyle
))
1594 wxMacGetHatchPattern(brushStyle
, &pat
);
1599 ::BackPat(GetQDGlobalsWhite(&whiteColor
));
1602 short mode
= patCopy
;
1606 switch( m_logicalFunction
)
1611 case wxINVERT
: // NOT dst
1612 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1615 case wxXOR
: // src XOR dst
1618 case wxOR_REVERSE
: // src OR (NOT dst)
1621 case wxSRC_INVERT
: // (NOT src)
1628 case wxAND_REVERSE
:// src AND (NOT dst)
1629 case wxAND
: // src AND dst
1630 case wxAND_INVERT
: // (NOT src) AND dst
1631 case wxNO_OP
: // dst
1632 case wxNOR
: // (NOT src) AND (NOT dst)
1633 case wxEQUIV
: // (NOT src) XOR dst
1634 case wxOR_INVERT
: // (NOT src) OR dst
1635 case wxNAND
: // (NOT src) OR (NOT dst)
1636 case wxOR
: // src OR dst
1638 // case wxSRC_OR: // source _bitmap_ OR destination
1639 // case wxSRC_AND: // source _bitmap_ AND destination
1643 m_macBrushInstalled
= true ;
1644 m_macPenInstalled
= false ;
1645 m_macFontInstalled
= false ;
1648 // ---------------------------------------------------------------------------
1649 // coordinates transformations
1650 // ---------------------------------------------------------------------------
1653 wxCoord
wxDCBase::DeviceToLogicalX(wxCoord x
) const
1655 return ((wxDC
*)this)->XDEV2LOG(x
);
1658 wxCoord
wxDCBase::DeviceToLogicalY(wxCoord y
) const
1660 return ((wxDC
*)this)->YDEV2LOG(y
);
1663 wxCoord
wxDCBase::DeviceToLogicalXRel(wxCoord x
) const
1665 return ((wxDC
*)this)->XDEV2LOGREL(x
);
1668 wxCoord
wxDCBase::DeviceToLogicalYRel(wxCoord y
) const
1670 return ((wxDC
*)this)->YDEV2LOGREL(y
);
1673 wxCoord
wxDCBase::LogicalToDeviceX(wxCoord x
) const
1675 return ((wxDC
*)this)->XLOG2DEV(x
);
1678 wxCoord
wxDCBase::LogicalToDeviceY(wxCoord y
) const
1680 return ((wxDC
*)this)->YLOG2DEV(y
);
1683 wxCoord
wxDCBase::LogicalToDeviceXRel(wxCoord x
) const
1685 return ((wxDC
*)this)->XLOG2DEVREL(x
);
1688 wxCoord
wxDCBase::LogicalToDeviceYRel(wxCoord y
) const
1690 return ((wxDC
*)this)->YLOG2DEVREL(y
);