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
)
783 PolyHandle polygon
= OpenPoly();
785 x1
= XLOG2DEVMAC(points
[0].x
+ xoffset
);
786 y1
= YLOG2DEVMAC(points
[0].y
+ yoffset
);
789 for (int i
= 0; i
< n
-1; i
++)
791 x2
= XLOG2DEVMAC(points
[i
+1].x
+ xoffset
);
792 y2
= YLOG2DEVMAC(points
[i
+1].y
+ yoffset
);
799 ::PaintPoly( polygon
);
804 if (m_pen
.GetStyle() != wxTRANSPARENT
)
806 PolyHandle polygon
= OpenPoly();
808 x1
= XLOG2DEVMAC(points
[0].x
+ xoffset
);
809 y1
= YLOG2DEVMAC(points
[0].y
+ yoffset
);
812 for (int i
= 0; i
< n
-1; i
++)
814 x2
= XLOG2DEVMAC(points
[i
+1].x
+ xoffset
);
815 y2
= YLOG2DEVMAC(points
[i
+1].y
+ yoffset
);
819 // return to origin to close path
825 ::FramePoly( polygon
) ;
831 void wxDC::DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
833 wxCHECK_RET(Ok(), wxT("Invalid DC"));
834 wxMacPortSetter
helper(this) ;
836 wxCoord xx
= XLOG2DEVMAC(x
);
837 wxCoord yy
= YLOG2DEVMAC(y
);
838 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
839 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
841 // CMB: draw nothing if transformed w or h is 0
842 if (ww
== 0 || hh
== 0)
845 // CMB: handle -ve width and/or height
858 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
860 if (m_brush
.GetStyle() != wxTRANSPARENT
)
863 ::PaintRect( &rect
) ;
866 if (m_pen
.GetStyle() != wxTRANSPARENT
)
869 ::FrameRect( &rect
) ;
873 void wxDC::DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
874 wxCoord width
, wxCoord height
,
877 wxCHECK_RET(Ok(), wxT("Invalid DC"));
878 wxMacPortSetter
helper(this) ;
881 radius
= - radius
* ((width
< height
) ? width
: height
);
883 wxCoord xx
= XLOG2DEVMAC(x
);
884 wxCoord yy
= YLOG2DEVMAC(y
);
885 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
886 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
888 // CMB: draw nothing if transformed w or h is 0
889 if (ww
== 0 || hh
== 0)
892 // CMB: handle -ve width and/or height
905 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
907 if (m_brush
.GetStyle() != wxTRANSPARENT
)
910 ::PaintRoundRect( &rect
, int(radius
* 2) , int(radius
* 2) ) ;
913 if (m_pen
.GetStyle() != wxTRANSPARENT
)
916 ::FrameRoundRect( &rect
, int(radius
* 2) , int(radius
* 2) ) ;
920 void wxDC::DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
922 wxCHECK_RET(Ok(), wxT("Invalid DC"));
923 wxMacPortSetter
helper(this) ;
925 wxCoord xx
= XLOG2DEVMAC(x
);
926 wxCoord yy
= YLOG2DEVMAC(y
);
927 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
928 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
930 // CMB: draw nothing if transformed w or h is 0
931 if (ww
== 0 || hh
== 0)
934 // CMB: handle -ve width and/or height
947 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
949 if (m_brush
.GetStyle() != wxTRANSPARENT
)
952 ::PaintOval( &rect
) ;
955 if (m_pen
.GetStyle() != wxTRANSPARENT
)
958 ::FrameOval( &rect
) ;
964 bool wxDC::CanDrawBitmap(void) const
970 bool wxDC::DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
971 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
, int logical_func
, bool useMask
,
972 wxCoord xsrcMask
, wxCoord ysrcMask
)
974 wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc"));
975 wxCHECK_MSG(source
->Ok(), false, wxT("wxDC::DoBlit Illegal source DC"));
976 wxMacPortSetter
helper(this) ;
978 /* TODO: use the mask origin when drawing transparently */
979 if (xsrcMask
== -1 && ysrcMask
== -1)
981 xsrcMask
= xsrc
; ysrcMask
= ysrc
;
984 CGrafPtr sourcePort
= (CGrafPtr
) source
->m_macPort
;
985 PixMapHandle bmappixels
= GetGWorldPixMap( sourcePort
) ;
986 RGBColor white
= { 0xFFFF, 0xFFFF,0xFFFF} ;
987 RGBColor black
= { 0,0,0} ;
988 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
989 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
990 RGBForeColor( &forecolor
) ;
991 RGBBackColor( &backcolor
) ;
993 if ( LockPixels(bmappixels
) )
995 Rect srcrect
, dstrect
;
996 srcrect
.top
= source
->YLOG2DEVMAC(ysrc
) ;
997 srcrect
.left
= source
->XLOG2DEVMAC(xsrc
) ;
998 srcrect
.right
= source
->XLOG2DEVMAC(xsrc
+ width
) ;
999 srcrect
.bottom
= source
->YLOG2DEVMAC(ysrc
+ height
) ;
1000 dstrect
.top
= YLOG2DEVMAC(ydest
) ;
1001 dstrect
.left
= XLOG2DEVMAC(xdest
) ;
1002 dstrect
.bottom
= YLOG2DEVMAC(ydest
+ height
) ;
1003 dstrect
.right
= XLOG2DEVMAC(xdest
+ width
) ;
1005 short mode
= (logical_func
== wxCOPY
? srcCopy
:
1006 // logical_func == wxCLEAR ? WHITENESS :
1007 // logical_func == wxSET ? BLACKNESS :
1008 logical_func
== wxINVERT
? hilite
:
1009 // logical_func == wxAND ? MERGECOPY :
1010 logical_func
== wxOR
? srcOr
:
1011 logical_func
== wxSRC_INVERT
? notSrcCopy
:
1012 logical_func
== wxXOR
? srcXor
:
1013 // logical_func == wxOR_REVERSE ? MERGEPAINT :
1014 // logical_func == wxAND_REVERSE ? SRCERASE :
1015 // logical_func == wxSRC_OR ? srcOr :
1016 // logical_func == wxSRC_AND ? SRCAND :
1019 if ( useMask
&& source
->m_macMask
)
1021 if ( mode
== srcCopy
)
1023 if ( LockPixels( GetGWorldPixMap( source
->m_macMask
) ) )
1025 CopyMask( GetPortBitMapForCopyBits( sourcePort
) ,
1026 GetPortBitMapForCopyBits( source
->m_macMask
) ,
1027 GetPortBitMapForCopyBits( m_macPort
) ,
1028 &srcrect
, &srcrect
, &dstrect
) ;
1029 UnlockPixels( GetGWorldPixMap( source
->m_macMask
) ) ;
1034 RgnHandle clipRgn
= NewRgn() ;
1036 LockPixels( GetGWorldPixMap( source
->m_macMask
) ) ;
1037 BitMapToRegion( clipRgn
, (BitMap
*) *GetGWorldPixMap( source
->m_macMask
) ) ;
1038 UnlockPixels( GetGWorldPixMap( source
->m_macMask
) ) ;
1039 //OffsetRgn( clipRgn , -source->m_macMask->portRect.left , -source->m_macMask->portRect.top ) ;
1040 OffsetRgn( clipRgn
, -srcrect
.left
+ dstrect
.left
, -srcrect
.top
+ dstrect
.top
) ;
1041 CopyBits( GetPortBitMapForCopyBits( sourcePort
) ,
1042 GetPortBitMapForCopyBits( m_macPort
) ,
1043 &srcrect
, &dstrect
, mode
, clipRgn
) ;
1044 DisposeRgn( clipRgn
) ;
1049 CopyBits( GetPortBitMapForCopyBits( sourcePort
) ,
1050 GetPortBitMapForCopyBits( m_macPort
) ,
1051 &srcrect
, &dstrect
, mode
, NULL
) ;
1053 UnlockPixels( bmappixels
) ;
1056 m_macPenInstalled
= false ;
1057 m_macBrushInstalled
= false ;
1058 m_macFontInstalled
= false ;
1063 void wxDC::DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
1066 wxCHECK_RET( Ok(), wxT("wxDC::DoDrawRotatedText Invalid window dc") );
1070 DrawText(text
, x
, y
);
1076 // the size of the text
1078 GetTextExtent(text
, &w
, &h
);
1080 // draw the string normally
1083 dc
.SelectObject(src
);
1084 dc
.SetFont(GetFont());
1085 dc
.SetBackground(*wxWHITE_BRUSH
);
1086 dc
.SetBrush(*wxBLACK_BRUSH
);
1088 dc
.DrawText(text
, 0, 0);
1089 dc
.SetFont(wxNullFont
);
1090 dc
.SelectObject(wxNullBitmap
);
1092 wxMacPortSetter
helper(this) ;
1094 // Calculate the size of the rotated bounding box.
1095 double rad
= DegToRad(angle
);
1096 double dx
= cos(rad
);
1097 double dy
= sin(rad
);
1099 // the rectngle vertices are counted clockwise with the first one being at
1100 // (0, 0) (or, rather, at (x, y))
1102 double y2
= -w
* dy
; // y axis points to the bottom, hence minus
1105 double x3
= x4
+ x2
;
1106 double y3
= y4
+ y2
;
1109 wxCoord maxX
= (wxCoord
)(dmax(x2
, dmax(x3
, x4
)) + 0.5);
1110 wxCoord maxY
= (wxCoord
)(dmax(y2
, dmax(y3
, y4
)) + 0.5);
1111 wxCoord minX
= (wxCoord
)(dmin(x2
, dmin(x3
, x4
)) - 0.5);
1112 wxCoord minY
= (wxCoord
)(dmin(y2
, dmin(y3
, y4
)) - 0.5);
1114 // prepare to blit-with-rotate the bitmap to the DC
1117 RGBColor colText
= m_textForegroundColour
.GetPixel();
1118 RGBColor colBack
= m_textBackgroundColour
.GetPixel();
1120 unsigned char *data
= image
.GetData();
1123 double r
, angleOrig
;
1126 // paint pixel by pixel
1127 for ( wxCoord srcX
= 0; srcX
< w
; srcX
++ )
1129 for ( wxCoord srcY
= 0; srcY
< h
; srcY
++ )
1131 // transform source coords to dest coords
1132 r
= sqrt( (double)(srcX
* srcX
+ srcY
* srcY
) );
1133 angleOrig
= atan2((double)srcY
, (double)srcX
) - rad
;
1134 dstX
= (wxCoord
)(r
* cos(angleOrig
) + 0.5);
1135 dstY
= (wxCoord
)(r
* sin(angleOrig
) + 0.5);
1138 textPixel
= data
[(srcY
*w
+ srcX
)*3] == 0;
1139 if ( textPixel
|| (m_backgroundMode
== wxSOLID
) )
1141 SetCPixel(XLOG2DEVMAC(x
+ dstX
), YLOG2DEVMAC(y
+ dstY
),
1142 textPixel
? &colText
: &colBack
);
1147 // it would be better to draw with non underlined font and draw the line
1148 // manually here (it would be more straight...)
1150 if ( m_font
.GetUnderlined() )
1152 ::MoveTo(XLOG2DEVMAC(x
+ x4
), YLOG2DEVMAC(y
+ y4
+ font
->descent
));
1153 ::LineTo(XLOG2DEVMAC(x
+ x3
), YLOG2DEVMAC(y
+ y3
+ font
->descent
));
1157 // update the bounding box
1158 CalcBoundingBox(x
+ minX
, y
+ minY
);
1159 CalcBoundingBox(x
+ maxX
, y
+ maxY
);
1161 void wxDC::DoDrawText(const wxString
& strtext
, wxCoord x
, wxCoord y
)
1163 wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC"));
1164 wxMacPortSetter
helper(this) ;
1166 long xx
= XLOG2DEVMAC(x
);
1167 long yy
= YLOG2DEVMAC(y
);
1169 // if (m_pen.GetStyle() != wxTRANSPARENT)
1173 Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
1175 ::ClipRect( &clip ) ;
1179 ::GetFontInfo( &fi
) ;
1182 ::MoveTo( xx
, yy
);
1183 if ( m_backgroundMode
== wxTRANSPARENT
)
1185 ::TextMode( srcOr
) ;
1189 ::TextMode( srcCopy
) ;
1192 const char *text
= NULL
;
1196 if ( wxApp::s_macDefaultEncodingIsPC
)
1198 macText
= wxMacMakeMacStringFromPC( strtext
) ;
1200 length
= macText
.Length() ;
1205 length
= strtext
.Length() ;
1214 if( text
[i
] == 13 || text
[i
] == 10)
1216 ::DrawText( text
, laststop
, i
- laststop
) ;
1218 ::MoveTo( xx
, yy
+ line
*(fi
.descent
+ fi
.ascent
+ fi
.leading
) );
1224 ::DrawText( text
, laststop
, i
- laststop
) ;
1225 ::TextMode( srcOr
) ;
1229 bool wxDC::CanGetTextExtent() const
1231 wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
1236 void wxDC::DoGetTextExtent( const wxString
&string
, wxCoord
*width
, wxCoord
*height
,
1237 wxCoord
*descent
, wxCoord
*externalLeading
,
1238 wxFont
*theFont
) const
1240 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1241 wxMacPortSetter
helper(this) ;
1243 wxFont formerFont
= m_font
;
1247 wxFontRefData
* font
= (wxFontRefData
*) m_font
.GetRefData() ;
1251 ::TextFont( font
->m_macFontNum
) ;
1252 ::TextSize( YLOG2DEVREL( font
->m_macFontSize
) ) ;
1253 ::TextFace( font
->m_macFontStyle
) ;
1262 ::GetFontInfo( &fi
) ;
1265 *height
= YDEV2LOGREL( fi
.descent
+ fi
.ascent
) ;
1267 *descent
=YDEV2LOGREL( fi
.descent
);
1268 if ( externalLeading
)
1269 *externalLeading
= YDEV2LOGREL( fi
.leading
) ;
1271 const char *text
= NULL
;
1274 if ( wxApp::s_macDefaultEncodingIsPC
)
1276 macText
= wxMacMakeMacStringFromPC( string
) ;
1278 length
= macText
.Length() ;
1283 length
= string
.Length() ;
1295 if( text
[i
] == 13 || text
[i
] == 10)
1298 *height
+= YDEV2LOGREL( fi
.descent
+ fi
.ascent
+ fi
.leading
) ;
1299 curwidth
= ::TextWidth( text
, laststop
, i
- laststop
) ;
1300 if ( curwidth
> *width
)
1301 *width
= XDEV2LOGREL( curwidth
) ;
1307 curwidth
= ::TextWidth( text
, laststop
, i
- laststop
) ;
1308 if ( curwidth
> *width
)
1309 *width
= XDEV2LOGREL( curwidth
) ;
1314 m_macFontInstalled
= false ;
1318 wxCoord
wxDC::GetCharWidth(void) const
1320 wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
1322 wxMacPortSetter
helper(this) ;
1326 int width
= ::TextWidth( "n" , 0 , 1 ) ;
1328 return YDEV2LOGREL(width
) ;
1331 wxCoord
wxDC::GetCharHeight(void) const
1333 wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
1335 wxMacPortSetter
helper(this) ;
1340 ::GetFontInfo( &fi
) ;
1342 return YDEV2LOGREL( fi
.descent
+ fi
.ascent
);
1345 void wxDC::Clear(void)
1347 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1348 wxMacPortSetter
helper(this) ;
1349 Rect rect
= { -32767 , -32767 , 32767 , 32767 } ;
1351 if (m_backgroundBrush
.GetStyle() != wxTRANSPARENT
)
1354 ::EraseRect( &rect
) ;
1358 void wxDC::MacInstallFont() const
1360 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1361 // if ( m_macFontInstalled )
1363 Pattern blackColor
;
1365 wxFontRefData
* font
= (wxFontRefData
*) m_font
.GetRefData() ;
1369 ::TextFont( font
->m_macFontNum
) ;
1370 ::TextSize( short(m_scaleY
* font
->m_macFontSize
) ) ;
1371 ::TextFace( font
->m_macFontStyle
) ;
1373 m_macFontInstalled
= true ;
1374 m_macBrushInstalled
= false ;
1375 m_macPenInstalled
= false ;
1377 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
1378 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
1379 ::RGBForeColor( &forecolor
);
1380 ::RGBBackColor( &backcolor
);
1386 GetFNum( "\pGeneva" , &fontnum
) ;
1387 ::TextFont( fontnum
) ;
1388 ::TextSize( short(m_scaleY
* 10) ) ;
1391 // todo reset after spacing changes - or store the current spacing somewhere
1393 m_macFontInstalled
= true ;
1394 m_macBrushInstalled
= false ;
1395 m_macPenInstalled
= false ;
1397 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
1398 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
1399 ::RGBForeColor( &forecolor
);
1400 ::RGBBackColor( &backcolor
);
1403 short mode
= patCopy
;
1407 switch( m_logicalFunction
)
1412 case wxINVERT
: // NOT dst
1413 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1416 case wxXOR
: // src XOR dst
1419 case wxOR_REVERSE
: // src OR (NOT dst)
1422 case wxSRC_INVERT
: // (NOT src)
1429 case wxAND_REVERSE
:// src AND (NOT dst)
1430 case wxAND
: // src AND dst
1431 case wxAND_INVERT
: // (NOT src) AND dst
1432 case wxNO_OP
: // dst
1433 case wxNOR
: // (NOT src) AND (NOT dst)
1434 case wxEQUIV
: // (NOT src) XOR dst
1435 case wxOR_INVERT
: // (NOT src) OR dst
1436 case wxNAND
: // (NOT src) OR (NOT dst)
1437 case wxOR
: // src OR dst
1439 // case wxSRC_OR: // source _bitmap_ OR destination
1440 // case wxSRC_AND: // source _bitmap_ AND destination
1446 static void wxMacGetHatchPattern(int hatchStyle
, Pattern
*pattern
)
1448 int thePatListID
= sysPatListID
;
1452 case wxBDIAGONAL_HATCH
:
1453 theIndex
= 34; // WCH: this is not good
1455 case wxFDIAGONAL_HATCH
:
1461 case wxHORIZONTAL_HATCH
:
1464 case wxVERTICAL_HATCH
:
1467 case wxCROSSDIAG_HATCH
:
1468 theIndex
= 4; // WCH: this is not good
1471 theIndex
= 1; // solid pattern
1474 GetIndPattern( pattern
, thePatListID
, theIndex
);
1477 void wxDC::MacInstallPen() const
1479 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1483 // if ( m_macPenInstalled )
1486 RGBColor forecolor
= m_pen
.GetColour().GetPixel();
1487 RGBColor backcolor
= m_backgroundBrush
.GetColour().GetPixel();
1488 ::RGBForeColor( &forecolor
);
1489 ::RGBBackColor( &backcolor
);
1492 int penWidth
= m_pen
.GetWidth() * (int) m_scaleX
;
1494 // null means only one pixel, at whatever resolution
1495 if ( penWidth
== 0 )
1497 ::PenSize(penWidth
, penWidth
);
1499 int penStyle
= m_pen
.GetStyle();
1501 if (penStyle
== wxSOLID
)
1503 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1505 else if (IS_HATCH(penStyle
))
1508 wxMacGetHatchPattern(penStyle
, &pat
);
1513 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1516 short mode
= patCopy
;
1520 switch( m_logicalFunction
)
1525 case wxINVERT
: // NOT dst
1526 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1529 case wxXOR
: // src XOR dst
1532 case wxOR_REVERSE
: // src OR (NOT dst)
1535 case wxSRC_INVERT
: // (NOT src)
1542 case wxAND_REVERSE
:// src AND (NOT dst)
1543 case wxAND
: // src AND dst
1544 case wxAND_INVERT
: // (NOT src) AND dst
1545 case wxNO_OP
: // dst
1546 case wxNOR
: // (NOT src) AND (NOT dst)
1547 case wxEQUIV
: // (NOT src) XOR dst
1548 case wxOR_INVERT
: // (NOT src) OR dst
1549 case wxNAND
: // (NOT src) OR (NOT dst)
1550 case wxOR
: // src OR dst
1552 // case wxSRC_OR: // source _bitmap_ OR destination
1553 // case wxSRC_AND: // source _bitmap_ AND destination
1557 m_macPenInstalled
= true ;
1558 m_macBrushInstalled
= false ;
1559 m_macFontInstalled
= false ;
1562 void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush
& background
)
1564 Pattern whiteColor
;
1565 switch( background
.MacGetBrushKind() )
1567 case kwxMacBrushTheme
:
1569 ::SetThemeBackground( background
.GetMacTheme() , wxDisplayDepth() , true ) ;
1572 case kwxMacBrushThemeBackground
:
1575 ThemeBackgroundKind bg
= background
.GetMacThemeBackground( &extent
) ;
1576 ::ApplyThemeBackground( bg
, &extent
,kThemeStateActive
, wxDisplayDepth() , true ) ;
1579 case kwxMacBrushColour
:
1581 ::RGBBackColor( &background
.GetColour().GetPixel() );
1582 int brushStyle
= background
.GetStyle();
1583 if (brushStyle
== wxSOLID
)
1584 ::BackPat(GetQDGlobalsWhite(&whiteColor
));
1585 else if (IS_HATCH(brushStyle
))
1588 wxMacGetHatchPattern(brushStyle
, &pat
);
1593 ::BackPat(GetQDGlobalsWhite(&whiteColor
));
1600 void wxDC::MacInstallBrush() const
1602 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1604 Pattern blackColor
;
1605 // if ( m_macBrushInstalled )
1610 ::RGBForeColor( &m_brush
.GetColour().GetPixel() );
1612 int brushStyle
= m_brush
.GetStyle();
1613 if (brushStyle
== wxSOLID
)
1614 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1615 else if (IS_HATCH(brushStyle
))
1618 wxMacGetHatchPattern(brushStyle
, &pat
);
1623 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1629 MacSetupBackgroundForCurrentPort( m_backgroundBrush
) ;
1634 short mode
= patCopy
;
1635 switch( m_logicalFunction
)
1640 case wxINVERT
: // NOT dst
1641 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1644 case wxXOR
: // src XOR dst
1647 case wxOR_REVERSE
: // src OR (NOT dst)
1650 case wxSRC_INVERT
: // (NOT src)
1657 case wxAND_REVERSE
:// src AND (NOT dst)
1658 case wxAND
: // src AND dst
1659 case wxAND_INVERT
: // (NOT src) AND dst
1660 case wxNO_OP
: // dst
1661 case wxNOR
: // (NOT src) AND (NOT dst)
1662 case wxEQUIV
: // (NOT src) XOR dst
1663 case wxOR_INVERT
: // (NOT src) OR dst
1664 case wxNAND
: // (NOT src) OR (NOT dst)
1665 case wxOR
: // src OR dst
1667 // case wxSRC_OR: // source _bitmap_ OR destination
1668 // case wxSRC_AND: // source _bitmap_ AND destination
1672 m_macBrushInstalled
= true ;
1673 m_macPenInstalled
= false ;
1674 m_macFontInstalled
= false ;
1677 // ---------------------------------------------------------------------------
1678 // coordinates transformations
1679 // ---------------------------------------------------------------------------
1682 wxCoord
wxDCBase::DeviceToLogicalX(wxCoord x
) const
1684 return ((wxDC
*)this)->XDEV2LOG(x
);
1687 wxCoord
wxDCBase::DeviceToLogicalY(wxCoord y
) const
1689 return ((wxDC
*)this)->YDEV2LOG(y
);
1692 wxCoord
wxDCBase::DeviceToLogicalXRel(wxCoord x
) const
1694 return ((wxDC
*)this)->XDEV2LOGREL(x
);
1697 wxCoord
wxDCBase::DeviceToLogicalYRel(wxCoord y
) const
1699 return ((wxDC
*)this)->YDEV2LOGREL(y
);
1702 wxCoord
wxDCBase::LogicalToDeviceX(wxCoord x
) const
1704 return ((wxDC
*)this)->XLOG2DEV(x
);
1707 wxCoord
wxDCBase::LogicalToDeviceY(wxCoord y
) const
1709 return ((wxDC
*)this)->YLOG2DEV(y
);
1712 wxCoord
wxDCBase::LogicalToDeviceXRel(wxCoord x
) const
1714 return ((wxDC
*)this)->XLOG2DEVREL(x
);
1717 wxCoord
wxDCBase::LogicalToDeviceYRel(wxCoord y
) const
1719 return ((wxDC
*)this)->YLOG2DEVREL(y
);