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 SetClip( m_macCurrentClipRgn
);
124 m_macFontInstalled
= false ;
125 m_macBrushInstalled
= false ;
126 m_macPenInstalled
= false ;
129 void wxDC::DoDrawBitmap( const wxBitmap
&bmp
, wxCoord x
, wxCoord y
, bool useMask
)
131 wxCHECK_RET( Ok(), wxT("invalid window dc") );
133 wxCHECK_RET( bmp
.Ok(), wxT("invalid bitmap") );
135 wxMacPortSetter
helper(this) ;
137 wxCoord xx
= XLOG2DEVMAC(x
);
138 wxCoord yy
= YLOG2DEVMAC(y
);
139 wxCoord w
= bmp
.GetWidth();
140 wxCoord h
= bmp
.GetHeight();
141 wxCoord ww
= XLOG2DEVREL(w
);
142 wxCoord hh
= YLOG2DEVREL(h
);
144 // Set up drawing mode
145 short mode
= (m_logicalFunction
== wxCOPY
? srcCopy
:
146 //m_logicalFunction == wxCLEAR ? WHITENESS :
147 //m_logicalFunction == wxSET ? BLACKNESS :
148 m_logicalFunction
== wxINVERT
? hilite
:
149 //m_logicalFunction == wxAND ? MERGECOPY :
150 m_logicalFunction
== wxOR
? srcOr
:
151 m_logicalFunction
== wxSRC_INVERT
? notSrcCopy
:
152 m_logicalFunction
== wxXOR
? srcXor
:
153 m_logicalFunction
== wxOR_REVERSE
? notSrcOr
:
154 //m_logicalFunction == wxAND_REVERSE ? SRCERASE :
155 //m_logicalFunction == wxSRC_OR ? srcOr :
156 //m_logicalFunction == wxSRC_AND ? SRCAND :
159 if ( bmp
.GetBitmapType() == kMacBitmapTypePict
) {
160 Rect bitmaprect
= { 0 , 0 , hh
, ww
};
161 ::OffsetRect( &bitmaprect
, xx
, yy
) ;
162 ::DrawPicture( bmp
.GetPict(), &bitmaprect
) ;
164 else if ( bmp
.GetBitmapType() == kMacBitmapTypeGrafWorld
)
166 GWorldPtr bmapworld
= bmp
.GetHBITMAP();
167 PixMapHandle bmappixels
;
169 // Set foreground and background colours (for bitmaps depth = 1)
170 if(bmp
.GetDepth() == 1)
172 RGBColor fore
= m_textForegroundColour
.GetPixel();
173 RGBColor back
= m_textBackgroundColour
.GetPixel();
179 RGBColor white
= { 0xFFFF, 0xFFFF,0xFFFF} ;
180 RGBColor black
= { 0,0,0} ;
181 RGBForeColor( &black
) ;
182 RGBBackColor( &white
) ;
185 bmappixels
= GetGWorldPixMap( bmapworld
) ;
187 wxCHECK_RET(LockPixels(bmappixels
),
188 wxT("DoDrawBitmap: Unable to lock pixels"));
190 Rect source
= { 0, 0, h
, w
};
191 Rect dest
= { yy
, xx
, yy
+ hh
, xx
+ ww
};
193 if ( useMask
&& bmp
.GetMask() )
195 if( LockPixels(GetGWorldPixMap(bmp
.GetMask()->GetMaskBitmap())))
199 GetPortBitMapForCopyBits(bmapworld
),
200 GetPortBitMapForCopyBits(bmp
.GetMask()->GetMaskBitmap()),
201 GetPortBitMapForCopyBits( m_macPort
),
202 &source
, &source
, &dest
, mode
, NULL
204 UnlockPixels(GetGWorldPixMap(bmp
.GetMask()->GetMaskBitmap()));
208 CopyBits( GetPortBitMapForCopyBits( bmapworld
),
209 GetPortBitMapForCopyBits( m_macPort
),
210 &source
, &dest
, mode
, NULL
) ;
212 UnlockPixels( bmappixels
) ;
214 else if ( bmp
.GetBitmapType() == kMacBitmapTypeIcon
)
216 Rect bitmaprect
= { 0 , 0 , bmp
.GetHeight(), bmp
.GetWidth() } ;
217 OffsetRect( &bitmaprect
, xx
, yy
) ;
218 PlotCIconHandle( &bitmaprect
, atNone
, ttNone
, bmp
.GetHICON() ) ;
220 m_macPenInstalled
= false ;
221 m_macBrushInstalled
= false ;
222 m_macFontInstalled
= false ;
226 void wxDC::DoDrawIcon( const wxIcon
&icon
, wxCoord x
, wxCoord y
)
228 wxCHECK_RET(Ok(), wxT("Invalid dc wxDC::DoDrawIcon"));
230 wxCHECK_RET(icon
.Ok(), wxT("Invalid icon wxDC::DoDrawIcon"));
232 DoDrawBitmap( icon
, x
, y
, icon
.GetMask() != NULL
) ;
234 void wxDC::DoSetClippingRegion( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
236 wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion Invalid DC"));
237 wxCoord xx
, yy
, ww
, hh
;
241 ww
= XLOG2DEVREL(width
);
242 hh
= YLOG2DEVREL(height
);
244 SetRectRgn( m_macCurrentClipRgn
, xx
, yy
, xx
+ ww
, yy
+ hh
) ;
245 SectRgn( m_macCurrentClipRgn
, m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
249 m_clipX1
= wxMax( m_clipX1
, xx
);
250 m_clipY1
= wxMax( m_clipY1
, yy
);
251 m_clipX2
= wxMin( m_clipX2
, (xx
+ ww
));
252 m_clipY2
= wxMin( m_clipY2
, (yy
+ hh
));
264 void wxDC::DoSetClippingRegionAsRegion( const wxRegion
®ion
)
266 wxCHECK_RET( Ok(), wxT("invalid window dc") ) ;
268 wxMacPortSetter
helper(this) ;
271 DestroyClippingRegion();
276 region
.GetBox( x
, y
, w
, h
);
277 wxCoord xx
, yy
, ww
, hh
;
284 // if we have a scaling that we cannot map onto native regions
285 // we must use the box
287 if ( ww
!= w
|| hh
!= h
)
289 wxDC::DoSetClippingRegion( x
, y
, w
, h
);
293 CopyRgn( region
.GetWXHRGN() , m_macCurrentClipRgn
) ;
294 if ( xx
!= x
|| yy
!= y
)
296 OffsetRgn( m_macCurrentClipRgn
, xx
- x
, yy
- y
) ;
298 SectRgn( m_macCurrentClipRgn
, m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
301 m_clipX1
= wxMax( m_clipX1
, xx
);
302 m_clipY1
= wxMax( m_clipY1
, yy
);
303 m_clipX2
= wxMin( m_clipX2
, (xx
+ ww
));
304 m_clipY2
= wxMin( m_clipY2
, (yy
+ hh
));
318 void wxDC::DestroyClippingRegion()
320 wxMacPortSetter
helper(this) ;
321 CopyRgn( m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
324 void wxDC::DoGetSize( int* width
, int* height
) const
326 *width
= m_maxX
-m_minX
;
327 *height
= m_maxY
-m_minY
;
329 void wxDC::DoGetSizeMM( int* width
, int* height
) const
334 *width
= long( double(w
) / (m_scaleX
*m_mm_to_pix_x
) );
335 *height
= long( double(h
) / (m_scaleY
*m_mm_to_pix_y
) );
337 void wxDC::SetTextForeground( const wxColour
&col
)
339 wxCHECK_RET(Ok(), wxT("Invalid DC"));
340 m_textForegroundColour
= col
;
341 m_macFontInstalled
= false ;
343 void wxDC::SetTextBackground( const wxColour
&col
)
345 wxCHECK_RET(Ok(), wxT("Invalid DC"));
346 m_textBackgroundColour
= col
;
347 m_macFontInstalled
= false ;
349 void wxDC::SetMapMode( int mode
)
354 SetLogicalScale( twips2mm
*m_mm_to_pix_x
, twips2mm
*m_mm_to_pix_y
);
357 SetLogicalScale( pt2mm
*m_mm_to_pix_x
, pt2mm
*m_mm_to_pix_y
);
360 SetLogicalScale( m_mm_to_pix_x
, m_mm_to_pix_y
);
363 SetLogicalScale( m_mm_to_pix_x
/10.0, m_mm_to_pix_y
/10.0 );
367 SetLogicalScale( 1.0, 1.0 );
370 if (mode
!= wxMM_TEXT
)
372 m_needComputeScaleX
= TRUE
;
373 m_needComputeScaleY
= TRUE
;
376 void wxDC::SetUserScale( double x
, double y
)
378 // allow negative ? -> no
381 ComputeScaleAndOrigin();
383 void wxDC::SetLogicalScale( double x
, double y
)
388 ComputeScaleAndOrigin();
390 void wxDC::SetLogicalOrigin( wxCoord x
, wxCoord y
)
392 m_logicalOriginX
= x
* m_signX
; // is this still correct ?
393 m_logicalOriginY
= y
* m_signY
;
394 ComputeScaleAndOrigin();
396 void wxDC::SetDeviceOrigin( wxCoord x
, wxCoord y
)
398 m_externalDeviceOriginX
= x
;
399 m_externalDeviceOriginY
= y
;
400 ComputeScaleAndOrigin();
404 void wxDC::SetInternalDeviceOrigin( long x
, long y
)
406 m_internalDeviceOriginX
= x
;
407 m_internalDeviceOriginY
= y
;
408 ComputeScaleAndOrigin();
410 void wxDC::GetInternalDeviceOrigin( long *x
, long *y
)
412 if (x
) *x
= m_internalDeviceOriginX
;
413 if (y
) *y
= m_internalDeviceOriginY
;
416 void wxDC::SetAxisOrientation( bool xLeftRight
, bool yBottomUp
)
418 m_signX
= (xLeftRight
? 1 : -1);
419 m_signY
= (yBottomUp
? -1 : 1);
420 ComputeScaleAndOrigin();
423 void wxDC::CalcBoundingBox( long x, long y )
425 if (x < m_minX) m_minX = x;
426 if (y < m_minY) m_minY = y;
427 if (x > m_maxX) m_maxX = x;
428 if (y > m_maxY) m_maxY = y;
430 wxSize
wxDC::GetPPI() const
432 return wxSize(72, 72);
435 int wxDC::GetDepth() const
437 return wxDisplayDepth() ;
440 void wxDC::ComputeScaleAndOrigin()
442 // CMB: copy scale to see if it changes
443 double origScaleX
= m_scaleX
;
444 double origScaleY
= m_scaleY
;
446 m_scaleX
= m_logicalScaleX
* m_userScaleX
;
447 m_scaleY
= m_logicalScaleY
* m_userScaleY
;
449 m_deviceOriginX
= m_internalDeviceOriginX
+ m_externalDeviceOriginX
;
450 m_deviceOriginY
= m_internalDeviceOriginY
+ m_externalDeviceOriginY
;
452 // CMB: if scale has changed call SetPen to recalulate the line width
453 if (m_scaleX
!= origScaleX
|| m_scaleY
!= origScaleY
)
455 // this is a bit artificial, but we need to force wxDC to think
456 // the pen has changed
457 wxPen
* pen
= & GetPen();
463 void wxDC::SetPalette( const wxPalette
& palette
)
467 void wxDC::SetBackgroundMode( int mode
)
469 m_backgroundMode
= mode
;
472 void wxDC::SetFont( const wxFont
&font
)
475 m_macFontInstalled
= false ;
478 void wxDC::SetPen( const wxPen
&pen
)
485 m_macPenInstalled
= false ;
488 void wxDC::SetBrush( const wxBrush
&brush
)
490 if (m_brush
== brush
)
494 m_macBrushInstalled
= false ;
497 void wxDC::SetBackground( const wxBrush
&brush
)
499 if (m_backgroundBrush
== brush
)
502 m_backgroundBrush
= brush
;
504 if (!m_backgroundBrush
.Ok())
506 m_macBrushInstalled
= false ;
509 void wxDC::SetLogicalFunction( int function
)
511 if (m_logicalFunction
== function
)
514 m_logicalFunction
= function
;
515 m_macFontInstalled
= false ;
516 m_macBrushInstalled
= false ;
517 m_macPenInstalled
= false ;
520 void wxDC::DoFloodFill( wxCoord x
, wxCoord y
, const wxColour
& col
,
525 bool wxDC::DoGetPixel( wxCoord x
, wxCoord y
, wxColour
*col
) const
527 wxCHECK_MSG( Ok(), false, wxT("wxDC::DoGetPixel Invalid DC") );
528 wxMacPortSetter
helper(this) ;
532 GetCPixel( XLOG2DEVMAC(x
), YLOG2DEVMAC(y
), &colour
);
534 // Convert from Mac colour to wx
535 col
->Set( colour
.red
>> 8,
542 void wxDC::DoDrawLine( wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
544 wxCHECK_RET(Ok(), wxT("Invalid DC"));
546 wxMacPortSetter
helper(this) ;
548 if (m_pen
.GetStyle() != wxTRANSPARENT
)
551 wxCoord offset
= ( (m_pen
.GetWidth() == 0 ? 1 :
552 m_pen
.GetWidth() ) * (wxCoord
)m_scaleX
- 1) / 2;
554 wxCoord xx1
= XLOG2DEVMAC(x1
) - offset
;
555 wxCoord yy1
= YLOG2DEVMAC(y1
) - offset
;
556 wxCoord xx2
= XLOG2DEVMAC(x2
) - offset
;
557 wxCoord yy2
= YLOG2DEVMAC(y2
) - offset
;
559 if ((m_pen
.GetCap() == wxCAP_ROUND
) &&
560 (m_pen
.GetWidth() <= 1))
562 // Implement LAST_NOT for MAC at least for
563 // orthogonal lines. RR.
585 void wxDC::DoCrossHair( wxCoord x
, wxCoord y
)
587 wxCHECK_RET( Ok(), wxT("wxDC::DoCrossHair Invalid window dc") );
589 if (m_pen
.GetStyle() != wxTRANSPARENT
)
594 wxCoord xx
= XLOG2DEVMAC(x
);
595 wxCoord yy
= YLOG2DEVMAC(y
);
598 ::MoveTo( XLOG2DEVMAC(0), yy
);
599 ::LineTo( XLOG2DEVMAC(w
), yy
);
600 ::MoveTo( xx
, YLOG2DEVMAC(0) );
601 ::LineTo( xx
, YLOG2DEVMAC(h
) );
606 * To draw arcs properly the angles need to be converted from the WX style:
607 * Angles start on the +ve X axis and go anti-clockwise (As you would draw on
608 * a normal axis on paper).
611 * Angles start on the +ve y axis and go clockwise.
612 * To achive this I work out which quadrant the angle lies in then map this to
613 * the equivalent quadrant on the Mac. (Sin and Cos values reveal which
614 * quadrant you are in).
616 static double wxConvertWXangleToMACangle(double angle
)
620 sin_a
= sin(angle
/ RAD2DEG
);
621 cos_a
= cos(angle
/ RAD2DEG
);
623 if( (sin_a
>= 0.0) && (cos_a
>= 0.0) ) {
624 angle
= acos(sin_a
) * RAD2DEG
;
626 else if( (sin_a
>= 0.0) && (cos_a
<= 0.0) ) {
628 angle
= acos(sin_a
) * RAD2DEG
+ 180;
630 else if( (sin_a
<= 0.0) && (cos_a
>= 0.0) ) {
631 angle
= acos(sin_a
) * RAD2DEG
+ 180;
633 else if( (sin_a
< 0.0) && (cos_a
< 0.0) ) {
635 angle
= acos(sin_a
) * RAD2DEG
+ 180;
640 void wxDC::DoDrawArc( wxCoord x1
, wxCoord y1
,
641 wxCoord x2
, wxCoord y2
,
642 wxCoord xc
, wxCoord yc
)
644 wxCHECK_RET(Ok(), wxT("wxDC::DoDrawArc Invalid DC"));
646 wxCoord xx1
= XLOG2DEVMAC(x1
);
647 wxCoord yy1
= YLOG2DEVMAC(y1
);
648 wxCoord xx2
= XLOG2DEVMAC(x2
);
649 wxCoord yy2
= YLOG2DEVMAC(y2
);
650 wxCoord xxc
= XLOG2DEVMAC(xc
);
651 wxCoord yyc
= YLOG2DEVMAC(yc
);
652 double dx
= xx1
- xxc
;
653 double dy
= yy1
- yyc
;
654 double radius
= sqrt((double)(dx
*dx
+dy
*dy
));
655 wxCoord rad
= (wxCoord
)radius
;
656 double radius1
, radius2
;
658 if (xx1
== xx2
&& yy1
== yy2
)
663 else if (radius
== 0.0)
665 radius1
= radius2
= 0.0;
669 radius1
= (xx1
- xxc
== 0) ?
670 (yy1
- yyc
< 0) ? 90.0 : -90.0 :
671 -atan2(double(yy1
-yyc
), double(xx1
-xxc
)) * RAD2DEG
;
672 radius2
= (xx2
- xxc
== 0) ?
673 (yy2
- yyc
< 0) ? 90.0 : -90.0 :
674 -atan2(double(yy2
-yyc
), double(xx2
-xxc
)) * RAD2DEG
;
676 wxCoord alpha2
= wxCoord(radius2
- radius1
);
677 wxCoord alpha1
= wxCoord(wxConvertWXangleToMACangle(radius1
));
678 if( (xx1
> xx2
) || (yy1
> yy2
) ) {
682 Rect r
= { yyc
- rad
, xxc
- rad
, yyc
+ rad
, xxc
+ rad
};
684 if(m_brush
.GetStyle() != wxTRANSPARENT
) {
686 PaintArc(&r
, alpha1
, alpha2
);
688 if(m_pen
.GetStyle() != wxTRANSPARENT
) {
690 FrameArc(&r
, alpha1
, alpha2
);
694 void wxDC::DoDrawEllipticArc( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
695 double sa
, double ea
)
697 wxCHECK_RET(Ok(), wxT("wxDC::DoDrawEllepticArc Invalid DC"));
700 double angle
= sa
- ea
; // Order important Mac in opposite direction to wx
702 wxCoord xx
= XLOG2DEVMAC(x
);
703 wxCoord yy
= YLOG2DEVMAC(y
);
704 wxCoord ww
= m_signX
* XLOG2DEVREL(w
);
705 wxCoord hh
= m_signY
* YLOG2DEVREL(h
);
707 // handle -ve width and/or height
708 if (ww
< 0) { ww
= -ww
; xx
= xx
- ww
; }
709 if (hh
< 0) { hh
= -hh
; yy
= yy
- hh
; }
711 sa
= wxConvertWXangleToMACangle(sa
);
718 if(m_brush
.GetStyle() != wxTRANSPARENT
) {
720 PaintArc(&r
, (short)sa
, (short)angle
);
722 if(m_pen
.GetStyle() != wxTRANSPARENT
) {
724 FrameArc(&r
, (short)sa
, (short)angle
);
728 void wxDC::DoDrawPoint( wxCoord x
, wxCoord y
)
730 wxCHECK_RET(Ok(), wxT("Invalid DC"));
732 wxMacPortSetter
helper(this) ;
734 if (m_pen
.GetStyle() != wxTRANSPARENT
)
737 wxCoord xx1
= XLOG2DEVMAC(x
);
738 wxCoord yy1
= YLOG2DEVMAC(y
);
741 ::LineTo(xx1
+1, yy1
+1);
745 void wxDC::DoDrawLines(int n
, wxPoint points
[],
746 wxCoord xoffset
, wxCoord yoffset
)
748 wxCHECK_RET(Ok(), wxT("Invalid DC"));
749 wxMacPortSetter
helper(this) ;
751 if (m_pen
.GetStyle() == wxTRANSPARENT
)
756 wxCoord offset
= ( (m_pen
.GetWidth() == 0 ? 1 :
757 m_pen
.GetWidth() ) * (wxCoord
)m_scaleX
- 1) / 2 ;
759 wxCoord x1
, x2
, y1
, y2
;
760 x1
= XLOG2DEVMAC(points
[0].x
+ xoffset
);
761 y1
= YLOG2DEVMAC(points
[0].y
+ yoffset
);
762 ::MoveTo(x1
- offset
, y1
- offset
);
764 for (int i
= 0; i
< n
-1; i
++)
766 x2
= XLOG2DEVMAC(points
[i
+1].x
+ xoffset
);
767 y2
= YLOG2DEVMAC(points
[i
+1].y
+ yoffset
);
768 ::LineTo( x2
- offset
, y2
- offset
);
772 void wxDC::DoDrawPolygon(int n
, wxPoint points
[],
773 wxCoord xoffset
, wxCoord yoffset
,
776 wxCHECK_RET(Ok(), wxT("Invalid DC"));
777 wxMacPortSetter
helper(this) ;
779 wxCoord x1
, x2
, y1
, y2
;
781 if ( m_brush
.GetStyle() == wxTRANSPARENT
&& m_pen
.GetStyle() == wxTRANSPARENT
)
784 PolyHandle polygon
= OpenPoly();
786 x1
= XLOG2DEVMAC(points
[0].x
+ xoffset
);
787 y1
= YLOG2DEVMAC(points
[0].y
+ yoffset
);
790 for (int i
= 0; i
< n
-1; i
++)
792 x2
= XLOG2DEVMAC(points
[i
+1].x
+ xoffset
);
793 y2
= YLOG2DEVMAC(points
[i
+1].y
+ yoffset
);
799 if (m_brush
.GetStyle() != wxTRANSPARENT
)
803 ::PaintPoly( polygon
);
807 if (m_pen
.GetStyle() != wxTRANSPARENT
)
811 ::FramePoly( polygon
) ;
817 void wxDC::DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
819 wxCHECK_RET(Ok(), wxT("Invalid DC"));
820 wxMacPortSetter
helper(this) ;
822 wxCoord xx
= XLOG2DEVMAC(x
);
823 wxCoord yy
= YLOG2DEVMAC(y
);
824 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
825 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
827 // CMB: draw nothing if transformed w or h is 0
828 if (ww
== 0 || hh
== 0)
831 // CMB: handle -ve width and/or height
844 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
846 if (m_brush
.GetStyle() != wxTRANSPARENT
)
849 ::PaintRect( &rect
) ;
852 if (m_pen
.GetStyle() != wxTRANSPARENT
)
855 ::FrameRect( &rect
) ;
859 void wxDC::DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
860 wxCoord width
, wxCoord height
,
863 wxCHECK_RET(Ok(), wxT("Invalid DC"));
864 wxMacPortSetter
helper(this) ;
867 radius
= - radius
* ((width
< height
) ? width
: height
);
869 wxCoord xx
= XLOG2DEVMAC(x
);
870 wxCoord yy
= YLOG2DEVMAC(y
);
871 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
872 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
874 // CMB: draw nothing if transformed w or h is 0
875 if (ww
== 0 || hh
== 0)
878 // CMB: handle -ve width and/or height
891 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
893 if (m_brush
.GetStyle() != wxTRANSPARENT
)
896 ::PaintRoundRect( &rect
, int(radius
* 2) , int(radius
* 2) ) ;
899 if (m_pen
.GetStyle() != wxTRANSPARENT
)
902 ::FrameRoundRect( &rect
, int(radius
* 2) , int(radius
* 2) ) ;
906 void wxDC::DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
908 wxCHECK_RET(Ok(), wxT("Invalid DC"));
909 wxMacPortSetter
helper(this) ;
911 wxCoord xx
= XLOG2DEVMAC(x
);
912 wxCoord yy
= YLOG2DEVMAC(y
);
913 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
914 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
916 // CMB: draw nothing if transformed w or h is 0
917 if (ww
== 0 || hh
== 0)
920 // CMB: handle -ve width and/or height
933 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
935 if (m_brush
.GetStyle() != wxTRANSPARENT
)
938 ::PaintOval( &rect
) ;
941 if (m_pen
.GetStyle() != wxTRANSPARENT
)
944 ::FrameOval( &rect
) ;
950 bool wxDC::CanDrawBitmap(void) const
956 bool wxDC::DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
957 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
, int logical_func
, bool useMask
,
958 wxCoord xsrcMask
, wxCoord ysrcMask
)
960 wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc"));
961 wxCHECK_MSG(source
->Ok(), false, wxT("wxDC::DoBlit Illegal source DC"));
962 wxMacPortSetter
helper(this) ;
964 /* TODO: use the mask origin when drawing transparently */
965 if (xsrcMask
== -1 && ysrcMask
== -1)
967 xsrcMask
= xsrc
; ysrcMask
= ysrc
;
970 CGrafPtr sourcePort
= (CGrafPtr
) source
->m_macPort
;
971 PixMapHandle bmappixels
= GetGWorldPixMap( sourcePort
) ;
972 RGBColor white
= { 0xFFFF, 0xFFFF,0xFFFF} ;
973 RGBColor black
= { 0,0,0} ;
974 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
975 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
976 RGBForeColor( &forecolor
) ;
977 RGBBackColor( &backcolor
) ;
979 if ( LockPixels(bmappixels
) )
981 Rect srcrect
, dstrect
;
982 srcrect
.top
= source
->YLOG2DEVMAC(ysrc
) ;
983 srcrect
.left
= source
->XLOG2DEVMAC(xsrc
) ;
984 srcrect
.right
= source
->XLOG2DEVMAC(xsrc
+ width
) ;
985 srcrect
.bottom
= source
->YLOG2DEVMAC(ysrc
+ height
) ;
986 dstrect
.top
= YLOG2DEVMAC(ydest
) ;
987 dstrect
.left
= XLOG2DEVMAC(xdest
) ;
988 dstrect
.bottom
= YLOG2DEVMAC(ydest
+ height
) ;
989 dstrect
.right
= XLOG2DEVMAC(xdest
+ width
) ;
991 short mode
= (logical_func
== wxCOPY
? srcCopy
:
992 // logical_func == wxCLEAR ? WHITENESS :
993 // logical_func == wxSET ? BLACKNESS :
994 logical_func
== wxINVERT
? hilite
:
995 // logical_func == wxAND ? MERGECOPY :
996 logical_func
== wxOR
? srcOr
:
997 logical_func
== wxSRC_INVERT
? notSrcCopy
:
998 logical_func
== wxXOR
? srcXor
:
999 // logical_func == wxOR_REVERSE ? MERGEPAINT :
1000 // logical_func == wxAND_REVERSE ? SRCERASE :
1001 // logical_func == wxSRC_OR ? srcOr :
1002 // logical_func == wxSRC_AND ? SRCAND :
1005 if ( useMask
&& source
->m_macMask
)
1007 if ( mode
== srcCopy
)
1009 if ( LockPixels( GetGWorldPixMap( source
->m_macMask
) ) )
1011 CopyMask( GetPortBitMapForCopyBits( sourcePort
) ,
1012 GetPortBitMapForCopyBits( source
->m_macMask
) ,
1013 GetPortBitMapForCopyBits( m_macPort
) ,
1014 &srcrect
, &srcrect
, &dstrect
) ;
1015 UnlockPixels( GetGWorldPixMap( source
->m_macMask
) ) ;
1020 RgnHandle clipRgn
= NewRgn() ;
1022 LockPixels( GetGWorldPixMap( source
->m_macMask
) ) ;
1023 BitMapToRegion( clipRgn
, (BitMap
*) *GetGWorldPixMap( source
->m_macMask
) ) ;
1024 UnlockPixels( GetGWorldPixMap( source
->m_macMask
) ) ;
1025 //OffsetRgn( clipRgn , -source->m_macMask->portRect.left , -source->m_macMask->portRect.top ) ;
1026 OffsetRgn( clipRgn
, -srcrect
.left
+ dstrect
.left
, -srcrect
.top
+ dstrect
.top
) ;
1027 CopyBits( GetPortBitMapForCopyBits( sourcePort
) ,
1028 GetPortBitMapForCopyBits( m_macPort
) ,
1029 &srcrect
, &dstrect
, mode
, clipRgn
) ;
1030 DisposeRgn( clipRgn
) ;
1035 CopyBits( GetPortBitMapForCopyBits( sourcePort
) ,
1036 GetPortBitMapForCopyBits( m_macPort
) ,
1037 &srcrect
, &dstrect
, mode
, NULL
) ;
1039 UnlockPixels( bmappixels
) ;
1042 m_macPenInstalled
= false ;
1043 m_macBrushInstalled
= false ;
1044 m_macFontInstalled
= false ;
1049 void wxDC::DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
1052 wxCHECK_RET( Ok(), wxT("wxDC::DoDrawRotatedText Invalid window dc") );
1056 DrawText(text
, x
, y
);
1062 // the size of the text
1064 GetTextExtent(text
, &w
, &h
);
1066 // draw the string normally
1069 dc
.SelectObject(src
);
1070 dc
.SetFont(GetFont());
1071 dc
.SetBackground(*wxWHITE_BRUSH
);
1072 dc
.SetBrush(*wxBLACK_BRUSH
);
1074 dc
.DrawText(text
, 0, 0);
1075 dc
.SetFont(wxNullFont
);
1076 dc
.SelectObject(wxNullBitmap
);
1078 wxMacPortSetter
helper(this) ;
1080 // Calculate the size of the rotated bounding box.
1081 double rad
= DegToRad(angle
);
1082 double dx
= cos(rad
);
1083 double dy
= sin(rad
);
1085 // the rectngle vertices are counted clockwise with the first one being at
1086 // (0, 0) (or, rather, at (x, y))
1088 double y2
= -w
* dy
; // y axis points to the bottom, hence minus
1091 double x3
= x4
+ x2
;
1092 double y3
= y4
+ y2
;
1095 wxCoord maxX
= (wxCoord
)(dmax(x2
, dmax(x3
, x4
)) + 0.5);
1096 wxCoord maxY
= (wxCoord
)(dmax(y2
, dmax(y3
, y4
)) + 0.5);
1097 wxCoord minX
= (wxCoord
)(dmin(x2
, dmin(x3
, x4
)) - 0.5);
1098 wxCoord minY
= (wxCoord
)(dmin(y2
, dmin(y3
, y4
)) - 0.5);
1100 // prepare to blit-with-rotate the bitmap to the DC
1103 RGBColor colText
= m_textForegroundColour
.GetPixel();
1104 RGBColor colBack
= m_textBackgroundColour
.GetPixel();
1106 unsigned char *data
= image
.GetData();
1109 double r
, angleOrig
;
1112 // paint pixel by pixel
1113 for ( wxCoord srcX
= 0; srcX
< w
; srcX
++ )
1115 for ( wxCoord srcY
= 0; srcY
< h
; srcY
++ )
1117 // transform source coords to dest coords
1118 r
= sqrt( (double)(srcX
* srcX
+ srcY
* srcY
) );
1119 angleOrig
= atan2((double)srcY
, (double)srcX
) - rad
;
1120 dstX
= (wxCoord
)(r
* cos(angleOrig
) + 0.5);
1121 dstY
= (wxCoord
)(r
* sin(angleOrig
) + 0.5);
1124 textPixel
= data
[(srcY
*w
+ srcX
)*3] == 0;
1125 if ( textPixel
|| (m_backgroundMode
== wxSOLID
) )
1127 SetCPixel(XLOG2DEVMAC(x
+ dstX
), YLOG2DEVMAC(y
+ dstY
),
1128 textPixel
? &colText
: &colBack
);
1133 // it would be better to draw with non underlined font and draw the line
1134 // manually here (it would be more straight...)
1136 if ( m_font
.GetUnderlined() )
1138 ::MoveTo(XLOG2DEVMAC(x
+ x4
), YLOG2DEVMAC(y
+ y4
+ font
->descent
));
1139 ::LineTo(XLOG2DEVMAC(x
+ x3
), YLOG2DEVMAC(y
+ y3
+ font
->descent
));
1143 // update the bounding box
1144 CalcBoundingBox(x
+ minX
, y
+ minY
);
1145 CalcBoundingBox(x
+ maxX
, y
+ maxY
);
1147 void wxDC::DoDrawText(const wxString
& strtext
, wxCoord x
, wxCoord y
)
1149 wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC"));
1150 wxMacPortSetter
helper(this) ;
1152 long xx
= XLOG2DEVMAC(x
);
1153 long yy
= YLOG2DEVMAC(y
);
1155 // if (m_pen.GetStyle() != wxTRANSPARENT)
1159 Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
1161 ::ClipRect( &clip ) ;
1165 ::GetFontInfo( &fi
) ;
1168 ::MoveTo( xx
, yy
);
1169 if ( m_backgroundMode
== wxTRANSPARENT
)
1171 ::TextMode( srcOr
) ;
1175 ::TextMode( srcCopy
) ;
1178 const char *text
= NULL
;
1182 if ( wxApp::s_macDefaultEncodingIsPC
)
1184 macText
= wxMacMakeMacStringFromPC( strtext
) ;
1186 length
= macText
.Length() ;
1191 length
= strtext
.Length() ;
1200 if( text
[i
] == 13 || text
[i
] == 10)
1202 ::DrawText( text
, laststop
, i
- laststop
) ;
1204 ::MoveTo( xx
, yy
+ line
*(fi
.descent
+ fi
.ascent
+ fi
.leading
) );
1210 ::DrawText( text
, laststop
, i
- laststop
) ;
1211 ::TextMode( srcOr
) ;
1215 bool wxDC::CanGetTextExtent() const
1217 wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
1222 void wxDC::DoGetTextExtent( const wxString
&string
, wxCoord
*width
, wxCoord
*height
,
1223 wxCoord
*descent
, wxCoord
*externalLeading
,
1224 wxFont
*theFont
) const
1226 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1227 wxMacPortSetter
helper(this) ;
1229 wxFont formerFont
= m_font
;
1233 wxFontRefData
* font
= (wxFontRefData
*) m_font
.GetRefData() ;
1237 ::TextFont( font
->m_macFontNum
) ;
1238 ::TextSize( YLOG2DEVREL( font
->m_macFontSize
) ) ;
1239 ::TextFace( font
->m_macFontStyle
) ;
1248 ::GetFontInfo( &fi
) ;
1251 *height
= YDEV2LOGREL( fi
.descent
+ fi
.ascent
) ;
1253 *descent
=YDEV2LOGREL( fi
.descent
);
1254 if ( externalLeading
)
1255 *externalLeading
= YDEV2LOGREL( fi
.leading
) ;
1257 const char *text
= NULL
;
1260 if ( wxApp::s_macDefaultEncodingIsPC
)
1262 macText
= wxMacMakeMacStringFromPC( string
) ;
1264 length
= macText
.Length() ;
1269 length
= string
.Length() ;
1281 if( text
[i
] == 13 || text
[i
] == 10)
1284 *height
+= YDEV2LOGREL( fi
.descent
+ fi
.ascent
+ fi
.leading
) ;
1285 curwidth
= ::TextWidth( text
, laststop
, i
- laststop
) ;
1286 if ( curwidth
> *width
)
1287 *width
= XDEV2LOGREL( curwidth
) ;
1293 curwidth
= ::TextWidth( text
, laststop
, i
- laststop
) ;
1294 if ( curwidth
> *width
)
1295 *width
= XDEV2LOGREL( curwidth
) ;
1300 m_macFontInstalled
= false ;
1304 wxCoord
wxDC::GetCharWidth(void) const
1306 wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
1308 wxMacPortSetter
helper(this) ;
1312 int width
= ::TextWidth( "n" , 0 , 1 ) ;
1314 return YDEV2LOGREL(width
) ;
1317 wxCoord
wxDC::GetCharHeight(void) const
1319 wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
1321 wxMacPortSetter
helper(this) ;
1326 ::GetFontInfo( &fi
) ;
1328 return YDEV2LOGREL( fi
.descent
+ fi
.ascent
);
1331 void wxDC::Clear(void)
1333 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1334 wxMacPortSetter
helper(this) ;
1335 Rect rect
= { -32767 , -32767 , 32767 , 32767 } ;
1337 if (m_backgroundBrush
.GetStyle() != wxTRANSPARENT
)
1340 ::EraseRect( &rect
) ;
1344 void wxDC::MacInstallFont() const
1346 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1347 // if ( m_macFontInstalled )
1349 Pattern blackColor
;
1351 wxFontRefData
* font
= (wxFontRefData
*) m_font
.GetRefData() ;
1355 ::TextFont( font
->m_macFontNum
) ;
1356 ::TextSize( short(m_scaleY
* font
->m_macFontSize
) ) ;
1357 ::TextFace( font
->m_macFontStyle
) ;
1359 m_macFontInstalled
= true ;
1360 m_macBrushInstalled
= false ;
1361 m_macPenInstalled
= false ;
1363 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
1364 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
1365 ::RGBForeColor( &forecolor
);
1366 ::RGBBackColor( &backcolor
);
1372 GetFNum( "\pGeneva" , &fontnum
) ;
1373 ::TextFont( fontnum
) ;
1374 ::TextSize( short(m_scaleY
* 10) ) ;
1377 // todo reset after spacing changes - or store the current spacing somewhere
1379 m_macFontInstalled
= true ;
1380 m_macBrushInstalled
= false ;
1381 m_macPenInstalled
= false ;
1383 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
1384 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
1385 ::RGBForeColor( &forecolor
);
1386 ::RGBBackColor( &backcolor
);
1389 short mode
= patCopy
;
1393 switch( m_logicalFunction
)
1398 case wxINVERT
: // NOT dst
1399 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1402 case wxXOR
: // src XOR dst
1405 case wxOR_REVERSE
: // src OR (NOT dst)
1408 case wxSRC_INVERT
: // (NOT src)
1415 case wxAND_REVERSE
:// src AND (NOT dst)
1416 case wxAND
: // src AND dst
1417 case wxAND_INVERT
: // (NOT src) AND dst
1418 case wxNO_OP
: // dst
1419 case wxNOR
: // (NOT src) AND (NOT dst)
1420 case wxEQUIV
: // (NOT src) XOR dst
1421 case wxOR_INVERT
: // (NOT src) OR dst
1422 case wxNAND
: // (NOT src) OR (NOT dst)
1423 case wxOR
: // src OR dst
1425 // case wxSRC_OR: // source _bitmap_ OR destination
1426 // case wxSRC_AND: // source _bitmap_ AND destination
1432 static void wxMacGetHatchPattern(int hatchStyle
, Pattern
*pattern
)
1434 // we have our own pattern list now
1435 int thePatListID
= 128;
1439 case wxBDIAGONAL_HATCH
:
1442 case wxFDIAGONAL_HATCH
:
1448 case wxHORIZONTAL_HATCH
:
1451 case wxVERTICAL_HATCH
:
1454 case wxCROSSDIAG_HATCH
:
1458 theIndex
= 1; // solid pattern
1461 GetIndPattern( pattern
, thePatListID
, theIndex
);
1464 void wxDC::MacInstallPen() const
1466 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1470 // if ( m_macPenInstalled )
1473 RGBColor forecolor
= m_pen
.GetColour().GetPixel();
1474 RGBColor backcolor
= m_backgroundBrush
.GetColour().GetPixel();
1475 ::RGBForeColor( &forecolor
);
1476 ::RGBBackColor( &backcolor
);
1479 int penWidth
= m_pen
.GetWidth() * (int) m_scaleX
;
1481 // null means only one pixel, at whatever resolution
1482 if ( penWidth
== 0 )
1484 ::PenSize(penWidth
, penWidth
);
1486 int penStyle
= m_pen
.GetStyle();
1488 if (penStyle
== wxSOLID
)
1490 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1492 else if (IS_HATCH(penStyle
))
1495 wxMacGetHatchPattern(penStyle
, &pat
);
1500 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1503 short mode
= patCopy
;
1507 switch( m_logicalFunction
)
1512 case wxINVERT
: // NOT dst
1513 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1516 case wxXOR
: // src XOR dst
1519 case wxOR_REVERSE
: // src OR (NOT dst)
1522 case wxSRC_INVERT
: // (NOT src)
1529 case wxAND_REVERSE
:// src AND (NOT dst)
1530 case wxAND
: // src AND dst
1531 case wxAND_INVERT
: // (NOT src) AND dst
1532 case wxNO_OP
: // dst
1533 case wxNOR
: // (NOT src) AND (NOT dst)
1534 case wxEQUIV
: // (NOT src) XOR dst
1535 case wxOR_INVERT
: // (NOT src) OR dst
1536 case wxNAND
: // (NOT src) OR (NOT dst)
1537 case wxOR
: // src OR dst
1539 // case wxSRC_OR: // source _bitmap_ OR destination
1540 // case wxSRC_AND: // source _bitmap_ AND destination
1544 m_macPenInstalled
= true ;
1545 m_macBrushInstalled
= false ;
1546 m_macFontInstalled
= false ;
1549 void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush
& background
)
1551 Pattern whiteColor
;
1552 switch( background
.MacGetBrushKind() )
1554 case kwxMacBrushTheme
:
1556 ::SetThemeBackground( background
.GetMacTheme() , wxDisplayDepth() , true ) ;
1559 case kwxMacBrushThemeBackground
:
1562 ThemeBackgroundKind bg
= background
.GetMacThemeBackground( &extent
) ;
1563 ::ApplyThemeBackground( bg
, &extent
,kThemeStateActive
, wxDisplayDepth() , true ) ;
1566 case kwxMacBrushColour
:
1568 ::RGBBackColor( &background
.GetColour().GetPixel() );
1569 int brushStyle
= background
.GetStyle();
1570 if (brushStyle
== wxSOLID
)
1571 ::BackPat(GetQDGlobalsWhite(&whiteColor
));
1572 else if (IS_HATCH(brushStyle
))
1575 wxMacGetHatchPattern(brushStyle
, &pat
);
1580 ::BackPat(GetQDGlobalsWhite(&whiteColor
));
1587 void wxDC::MacInstallBrush() const
1589 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1591 Pattern blackColor
;
1592 // if ( m_macBrushInstalled )
1597 ::RGBForeColor( &m_brush
.GetColour().GetPixel() );
1599 int brushStyle
= m_brush
.GetStyle();
1600 if (brushStyle
== wxSOLID
)
1601 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1602 else if (IS_HATCH(brushStyle
))
1605 wxMacGetHatchPattern(brushStyle
, &pat
);
1610 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1616 MacSetupBackgroundForCurrentPort( m_backgroundBrush
) ;
1621 short mode
= patCopy
;
1622 switch( m_logicalFunction
)
1627 case wxINVERT
: // NOT dst
1628 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1631 case wxXOR
: // src XOR dst
1634 case wxOR_REVERSE
: // src OR (NOT dst)
1637 case wxSRC_INVERT
: // (NOT src)
1644 case wxAND_REVERSE
:// src AND (NOT dst)
1645 case wxAND
: // src AND dst
1646 case wxAND_INVERT
: // (NOT src) AND dst
1647 case wxNO_OP
: // dst
1648 case wxNOR
: // (NOT src) AND (NOT dst)
1649 case wxEQUIV
: // (NOT src) XOR dst
1650 case wxOR_INVERT
: // (NOT src) OR dst
1651 case wxNAND
: // (NOT src) OR (NOT dst)
1652 case wxOR
: // src OR dst
1654 // case wxSRC_OR: // source _bitmap_ OR destination
1655 // case wxSRC_AND: // source _bitmap_ AND destination
1659 m_macBrushInstalled
= true ;
1660 m_macPenInstalled
= false ;
1661 m_macFontInstalled
= false ;
1664 // ---------------------------------------------------------------------------
1665 // coordinates transformations
1666 // ---------------------------------------------------------------------------
1669 wxCoord
wxDCBase::DeviceToLogicalX(wxCoord x
) const
1671 return ((wxDC
*)this)->XDEV2LOG(x
);
1674 wxCoord
wxDCBase::DeviceToLogicalY(wxCoord y
) const
1676 return ((wxDC
*)this)->YDEV2LOG(y
);
1679 wxCoord
wxDCBase::DeviceToLogicalXRel(wxCoord x
) const
1681 return ((wxDC
*)this)->XDEV2LOGREL(x
);
1684 wxCoord
wxDCBase::DeviceToLogicalYRel(wxCoord y
) const
1686 return ((wxDC
*)this)->YDEV2LOGREL(y
);
1689 wxCoord
wxDCBase::LogicalToDeviceX(wxCoord x
) const
1691 return ((wxDC
*)this)->XLOG2DEV(x
);
1694 wxCoord
wxDCBase::LogicalToDeviceY(wxCoord y
) const
1696 return ((wxDC
*)this)->YLOG2DEV(y
);
1699 wxCoord
wxDCBase::LogicalToDeviceXRel(wxCoord x
) const
1701 return ((wxDC
*)this)->XLOG2DEVREL(x
);
1704 wxCoord
wxDCBase::LogicalToDeviceYRel(wxCoord y
) const
1706 return ((wxDC
*)this)->YLOG2DEVREL(y
);