]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/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
)
477 m_macFontInstalled
= false ;
480 void wxDC::SetPen( const wxPen
&pen
)
487 m_macPenInstalled
= false ;
490 void wxDC::SetBrush( const wxBrush
&brush
)
492 if (m_brush
== brush
)
496 m_macBrushInstalled
= false ;
499 void wxDC::SetBackground( const wxBrush
&brush
)
501 if (m_backgroundBrush
== brush
)
504 m_backgroundBrush
= brush
;
506 if (!m_backgroundBrush
.Ok())
508 m_macBrushInstalled
= false ;
511 void wxDC::SetLogicalFunction( int function
)
513 if (m_logicalFunction
== function
)
516 m_logicalFunction
= function
;
517 m_macFontInstalled
= false ;
518 m_macBrushInstalled
= false ;
519 m_macPenInstalled
= false ;
522 void wxDC::DoFloodFill( wxCoord x
, wxCoord y
, const wxColour
& col
,
527 bool wxDC::DoGetPixel( wxCoord x
, wxCoord y
, wxColour
*col
) const
529 wxCHECK_MSG( Ok(), false, wxT("wxDC::DoGetPixel Invalid DC") );
530 wxMacPortSetter
helper(this) ;
534 GetCPixel( XLOG2DEV(x
), YLOG2DEV(y
), &colour
);
536 // Convert from Mac colour to wx
537 col
->Set( colour
.red
>> 8,
544 void wxDC::DoDrawLine( wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
546 wxCHECK_RET(Ok(), wxT("Invalid DC"));
548 wxMacPortSetter
helper(this) ;
550 if (m_pen
.GetStyle() != wxTRANSPARENT
)
553 wxCoord offset
= ( (m_pen
.GetWidth() == 0 ? 1 :
554 m_pen
.GetWidth() ) * (wxCoord
)m_scaleX
- 1) / 2;
556 wxCoord xx1
= XLOG2DEV(x1
) - offset
;
557 wxCoord yy1
= YLOG2DEV(y1
) - offset
;
558 wxCoord xx2
= XLOG2DEV(x2
) - offset
;
559 wxCoord yy2
= YLOG2DEV(y2
) - offset
;
561 if ((m_pen
.GetCap() == wxCAP_ROUND
) &&
562 (m_pen
.GetWidth() <= 1))
564 // Implement LAST_NOT for MAC at least for
565 // orthogonal lines. RR.
587 void wxDC::DoCrossHair( wxCoord x
, wxCoord y
)
589 wxCHECK_RET( Ok(), wxT("wxDC::DoCrossHair Invalid window dc") );
591 if (m_pen
.GetStyle() != wxTRANSPARENT
)
596 wxCoord xx
= XLOG2DEV(x
);
597 wxCoord yy
= YLOG2DEV(y
);
601 ::LineTo( XLOG2DEVREL(w
), yy
);
603 ::LineTo( xx
, YLOG2DEVREL(h
) );
608 * To draw arcs properly the angles need to be converted from the WX style:
609 * Angles start on the +ve X axis and go anti-clockwise (As you would draw on
610 * a normal axis on paper).
613 * Angles start on the +ve y axis and go clockwise.
614 * To achive this I work out which quadrant the angle lies in then map this to
615 * the equivalent quadrant on the Mac. (Sin and Cos values reveal which
616 * quadrant you are in).
618 static double wxConvertWXangleToMACangle(double angle
)
622 sin_a
= sin(angle
/ RAD2DEG
);
623 cos_a
= cos(angle
/ RAD2DEG
);
625 if( (sin_a
>= 0.0) && (cos_a
>= 0.0) ) {
626 angle
= acos(sin_a
) * RAD2DEG
;
628 else if( (sin_a
>= 0.0) && (cos_a
<= 0.0) ) {
630 angle
= acos(sin_a
) * RAD2DEG
+ 180;
632 else if( (sin_a
<= 0.0) && (cos_a
>= 0.0) ) {
633 angle
= acos(sin_a
) * RAD2DEG
+ 180;
635 else if( (sin_a
< 0.0) && (cos_a
< 0.0) ) {
637 angle
= acos(sin_a
) * RAD2DEG
+ 180;
642 void wxDC::DoDrawArc( wxCoord x1
, wxCoord y1
,
643 wxCoord x2
, wxCoord y2
,
644 wxCoord xc
, wxCoord yc
)
646 wxCHECK_RET(Ok(), wxT("wxDC::DoDrawArc Invalid DC"));
648 wxCoord xx1
= XLOG2DEV(x1
);
649 wxCoord yy1
= YLOG2DEV(y1
);
650 wxCoord xx2
= XLOG2DEV(x2
);
651 wxCoord yy2
= YLOG2DEV(y2
);
652 wxCoord xxc
= XLOG2DEV(xc
);
653 wxCoord yyc
= YLOG2DEV(yc
);
654 double dx
= xx1
- xxc
;
655 double dy
= yy1
- yyc
;
656 double radius
= sqrt((double)(dx
*dx
+dy
*dy
));
657 wxCoord rad
= (wxCoord
)radius
;
658 double radius1
, radius2
;
660 if (xx1
== xx2
&& yy1
== yy2
)
665 else if (radius
== 0.0)
667 radius1
= radius2
= 0.0;
671 radius1
= (xx1
- xxc
== 0) ?
672 (yy1
- yyc
< 0) ? 90.0 : -90.0 :
673 -atan2(double(yy1
-yyc
), double(xx1
-xxc
)) * RAD2DEG
;
674 radius2
= (xx2
- xxc
== 0) ?
675 (yy2
- yyc
< 0) ? 90.0 : -90.0 :
676 -atan2(double(yy2
-yyc
), double(xx2
-xxc
)) * RAD2DEG
;
678 wxCoord alpha2
= wxCoord(radius2
- radius1
);
679 wxCoord alpha1
= wxCoord(wxConvertWXangleToMACangle(radius1
));
680 if( (xx1
> xx2
) || (yy1
> yy2
) ) {
684 Rect r
= { yyc
- rad
, xxc
- rad
, yyc
+ rad
, xxc
+ rad
};
686 if(m_brush
.GetStyle() != wxTRANSPARENT
) {
688 PaintArc(&r
, alpha1
, alpha2
);
690 if(m_pen
.GetStyle() != wxTRANSPARENT
) {
692 FrameArc(&r
, alpha1
, alpha2
);
696 void wxDC::DoDrawEllipticArc( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
697 double sa
, double ea
)
699 wxCHECK_RET(Ok(), wxT("wxDC::DoDrawEllepticArc Invalid DC"));
702 double angle
= sa
- ea
; // Order important Mac in opposite direction to wx
704 wxCoord xx
= XLOG2DEV(x
);
705 wxCoord yy
= YLOG2DEV(y
);
706 wxCoord ww
= m_signX
* XLOG2DEVREL(w
);
707 wxCoord hh
= m_signY
* YLOG2DEVREL(h
);
709 // handle -ve width and/or height
710 if (ww
< 0) { ww
= -ww
; xx
= xx
- ww
; }
711 if (hh
< 0) { hh
= -hh
; yy
= yy
- hh
; }
713 sa
= wxConvertWXangleToMACangle(sa
);
720 if(m_brush
.GetStyle() != wxTRANSPARENT
) {
722 PaintArc(&r
, (short)sa
, (short)angle
);
724 if(m_pen
.GetStyle() != wxTRANSPARENT
) {
726 FrameArc(&r
, (short)sa
, (short)angle
);
730 void wxDC::DoDrawPoint( wxCoord x
, wxCoord y
)
732 wxCHECK_RET(Ok(), wxT("Invalid DC"));
734 wxMacPortSetter
helper(this) ;
736 if (m_pen
.GetStyle() != wxTRANSPARENT
)
739 wxCoord xx1
= XLOG2DEV(x
);
740 wxCoord yy1
= YLOG2DEV(y
);
743 ::LineTo(xx1
+1, yy1
+1);
747 void wxDC::DoDrawLines(int n
, wxPoint points
[],
748 wxCoord xoffset
, wxCoord yoffset
)
750 wxCHECK_RET(Ok(), wxT("Invalid DC"));
751 wxMacPortSetter
helper(this) ;
753 if (m_pen
.GetStyle() == wxTRANSPARENT
)
758 wxCoord offset
= ( (m_pen
.GetWidth() == 0 ? 1 :
759 m_pen
.GetWidth() ) * (wxCoord
)m_scaleX
- 1) / 2 ;
761 wxCoord x1
, x2
, y1
, y2
;
762 x1
= XLOG2DEV(points
[0].x
+ xoffset
);
763 y1
= YLOG2DEV(points
[0].y
+ yoffset
);
764 ::MoveTo(x1
- offset
, y1
- offset
);
766 for (int i
= 0; i
< n
-1; i
++)
768 x2
= XLOG2DEV(points
[i
+1].x
+ xoffset
);
769 y2
= YLOG2DEV(points
[i
+1].y
+ yoffset
);
770 ::LineTo( x2
- offset
, y2
- offset
);
774 void wxDC::DoDrawPolygon(int n
, wxPoint points
[],
775 wxCoord xoffset
, wxCoord yoffset
,
778 wxCHECK_RET(Ok(), wxT("Invalid DC"));
779 wxMacPortSetter
helper(this) ;
781 wxCoord x1
, x2
, y1
, y2
;
783 if (m_brush
.GetStyle() != wxTRANSPARENT
)
785 PolyHandle polygon
= OpenPoly();
787 x1
= XLOG2DEV(points
[0].x
+ xoffset
);
788 y1
= YLOG2DEV(points
[0].y
+ yoffset
);
791 for (int i
= 0; i
< n
-1; i
++)
793 x2
= XLOG2DEV(points
[i
+1].x
+ xoffset
);
794 y2
= YLOG2DEV(points
[i
+1].y
+ yoffset
);
801 ::PaintPoly( polygon
);
806 if (m_pen
.GetStyle() != wxTRANSPARENT
)
808 PolyHandle polygon
= OpenPoly();
810 x1
= XLOG2DEV(points
[0].x
+ xoffset
);
811 y1
= YLOG2DEV(points
[0].y
+ yoffset
);
814 for (int i
= 0; i
< n
-1; i
++)
816 x2
= XLOG2DEV(points
[i
+1].x
+ xoffset
);
817 y2
= YLOG2DEV(points
[i
+1].y
+ yoffset
);
821 // return to origin to close path
827 ::FramePoly( polygon
) ;
833 void wxDC::DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
835 wxCHECK_RET(Ok(), wxT("Invalid DC"));
836 wxMacPortSetter
helper(this) ;
838 wxCoord xx
= XLOG2DEV(x
);
839 wxCoord yy
= YLOG2DEV(y
);
840 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
841 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
843 // CMB: draw nothing if transformed w or h is 0
844 if (ww
== 0 || hh
== 0)
847 // CMB: handle -ve width and/or height
860 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
862 if (m_brush
.GetStyle() != wxTRANSPARENT
)
865 ::PaintRect( &rect
) ;
868 if (m_pen
.GetStyle() != wxTRANSPARENT
)
871 ::FrameRect( &rect
) ;
875 void wxDC::DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
876 wxCoord width
, wxCoord height
,
879 wxCHECK_RET(Ok(), wxT("Invalid DC"));
880 wxMacPortSetter
helper(this) ;
883 radius
= - radius
* ((width
< height
) ? width
: height
);
885 wxCoord xx
= XLOG2DEV(x
);
886 wxCoord yy
= YLOG2DEV(y
);
887 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
888 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
890 // CMB: draw nothing if transformed w or h is 0
891 if (ww
== 0 || hh
== 0)
894 // CMB: handle -ve width and/or height
907 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
909 if (m_brush
.GetStyle() != wxTRANSPARENT
)
912 ::PaintRoundRect( &rect
, int(radius
* 2) , int(radius
* 2) ) ;
915 if (m_pen
.GetStyle() != wxTRANSPARENT
)
918 ::FrameRoundRect( &rect
, int(radius
* 2) , int(radius
* 2) ) ;
922 void wxDC::DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
924 wxCHECK_RET(Ok(), wxT("Invalid DC"));
925 wxMacPortSetter
helper(this) ;
927 wxCoord xx
= XLOG2DEV(x
);
928 wxCoord yy
= YLOG2DEV(y
);
929 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
930 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
932 // CMB: draw nothing if transformed w or h is 0
933 if (ww
== 0 || hh
== 0)
936 // CMB: handle -ve width and/or height
949 Rect rect
= { yy
, xx
, yy
+ hh
, xx
+ ww
} ;
951 if (m_brush
.GetStyle() != wxTRANSPARENT
)
954 ::PaintOval( &rect
) ;
957 if (m_pen
.GetStyle() != wxTRANSPARENT
)
960 ::FrameOval( &rect
) ;
966 bool wxDC::CanDrawBitmap(void) const
972 bool wxDC::DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
973 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
, int logical_func
, bool useMask
,
974 wxCoord xsrcMask
, wxCoord ysrcMask
)
976 wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc"));
977 wxCHECK_MSG(source
->Ok(), false, wxT("wxDC::DoBlit Illegal source DC"));
978 wxMacPortSetter
helper(this) ;
980 /* TODO: use the mask origin when drawing transparently */
981 if (xsrcMask
== -1 && ysrcMask
== -1)
983 xsrcMask
= xsrc
; ysrcMask
= ysrc
;
986 CGrafPtr sourcePort
= (CGrafPtr
) source
->m_macPort
;
987 PixMapHandle bmappixels
= GetGWorldPixMap( sourcePort
) ;
988 RGBColor white
= { 0xFFFF, 0xFFFF,0xFFFF} ;
989 RGBColor black
= { 0,0,0} ;
990 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
991 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
992 RGBForeColor( &forecolor
) ;
993 RGBBackColor( &backcolor
) ;
995 if ( LockPixels(bmappixels
) )
997 Rect srcrect
, dstrect
;
998 srcrect
.top
= source
->YLOG2DEV(ysrc
) + source
->m_macLocalOrigin
.v
;
999 srcrect
.left
= source
->XLOG2DEV(xsrc
) + source
->m_macLocalOrigin
.h
;
1000 srcrect
.right
= source
->XLOG2DEV(xsrc
+ width
) + source
->m_macLocalOrigin
.v
;
1001 srcrect
.bottom
= source
->YLOG2DEV(ysrc
+ height
) + source
->m_macLocalOrigin
.h
;
1002 dstrect
.top
= YLOG2DEV(ydest
) ;
1003 dstrect
.left
= XLOG2DEV(xdest
) ;
1004 dstrect
.bottom
= YLOG2DEV(ydest
+ height
) ;
1005 dstrect
.right
= XLOG2DEV(xdest
+ width
) ;
1007 short mode
= (logical_func
== wxCOPY
? srcCopy
:
1008 // logical_func == wxCLEAR ? WHITENESS :
1009 // logical_func == wxSET ? BLACKNESS :
1010 logical_func
== wxINVERT
? hilite
:
1011 // logical_func == wxAND ? MERGECOPY :
1012 logical_func
== wxOR
? srcOr
:
1013 logical_func
== wxSRC_INVERT
? notSrcCopy
:
1014 logical_func
== wxXOR
? srcXor
:
1015 // logical_func == wxOR_REVERSE ? MERGEPAINT :
1016 // logical_func == wxAND_REVERSE ? SRCERASE :
1017 // logical_func == wxSRC_OR ? srcOr :
1018 // logical_func == wxSRC_AND ? SRCAND :
1021 if ( useMask
&& source
->m_macMask
)
1023 if ( mode
== srcCopy
)
1025 if ( LockPixels( GetGWorldPixMap( source
->m_macMask
) ) )
1027 CopyMask( GetPortBitMapForCopyBits( sourcePort
) ,
1028 GetPortBitMapForCopyBits( source
->m_macMask
) ,
1029 GetPortBitMapForCopyBits( m_macPort
) ,
1030 &srcrect
, &srcrect
, &dstrect
) ;
1031 UnlockPixels( GetGWorldPixMap( source
->m_macMask
) ) ;
1036 RgnHandle clipRgn
= NewRgn() ;
1038 LockPixels( GetGWorldPixMap( source
->m_macMask
) ) ;
1039 BitMapToRegion( clipRgn
, (BitMap
*) *GetGWorldPixMap( source
->m_macMask
) ) ;
1040 UnlockPixels( GetGWorldPixMap( source
->m_macMask
) ) ;
1041 //OffsetRgn( clipRgn , -source->m_macMask->portRect.left , -source->m_macMask->portRect.top ) ;
1042 OffsetRgn( clipRgn
, -srcrect
.left
+ dstrect
.left
, -srcrect
.top
+ dstrect
.top
) ;
1043 CopyBits( GetPortBitMapForCopyBits( sourcePort
) ,
1044 GetPortBitMapForCopyBits( m_macPort
) ,
1045 &srcrect
, &dstrect
, mode
, clipRgn
) ;
1046 DisposeRgn( clipRgn
) ;
1051 CopyBits( GetPortBitMapForCopyBits( sourcePort
) ,
1052 GetPortBitMapForCopyBits( m_macPort
) ,
1053 &srcrect
, &dstrect
, mode
, NULL
) ;
1055 UnlockPixels( bmappixels
) ;
1058 m_macPenInstalled
= false ;
1059 m_macBrushInstalled
= false ;
1060 m_macFontInstalled
= false ;
1065 void wxDC::DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
1068 wxCHECK_RET( Ok(), wxT("wxDC::DoDrawRotatedText Invalid window dc") );
1072 DrawText(text
, x
, y
);
1078 // the size of the text
1080 GetTextExtent(text
, &w
, &h
);
1082 // draw the string normally
1085 dc
.SelectObject(src
);
1086 dc
.SetFont(GetFont());
1087 dc
.SetBackground(*wxWHITE_BRUSH
);
1088 dc
.SetBrush(*wxBLACK_BRUSH
);
1090 dc
.DrawText(text
, 0, 0);
1091 dc
.SetFont(wxNullFont
);
1092 dc
.SelectObject(wxNullBitmap
);
1094 wxMacPortSetter
helper(this) ;
1096 // Calculate the size of the rotated bounding box.
1097 double rad
= DegToRad(angle
);
1098 double dx
= cos(rad
);
1099 double dy
= sin(rad
);
1101 // the rectngle vertices are counted clockwise with the first one being at
1102 // (0, 0) (or, rather, at (x, y))
1104 double y2
= -w
* dy
; // y axis points to the bottom, hence minus
1107 double x3
= x4
+ x2
;
1108 double y3
= y4
+ y2
;
1111 wxCoord maxX
= (wxCoord
)(dmax(x2
, dmax(x3
, x4
)) + 0.5);
1112 wxCoord maxY
= (wxCoord
)(dmax(y2
, dmax(y3
, y4
)) + 0.5);
1113 wxCoord minX
= (wxCoord
)(dmin(x2
, dmin(x3
, x4
)) - 0.5);
1114 wxCoord minY
= (wxCoord
)(dmin(y2
, dmin(y3
, y4
)) - 0.5);
1116 // prepare to blit-with-rotate the bitmap to the DC
1119 RGBColor colText
= m_textForegroundColour
.GetPixel();
1120 RGBColor colBack
= m_textBackgroundColour
.GetPixel();
1122 unsigned char *data
= image
.GetData();
1125 double r
, angleOrig
;
1128 // paint pixel by pixel
1129 for ( wxCoord srcX
= 0; srcX
< w
; srcX
++ )
1131 for ( wxCoord srcY
= 0; srcY
< h
; srcY
++ )
1133 // transform source coords to dest coords
1134 r
= sqrt( (double)(srcX
* srcX
+ srcY
* srcY
) );
1135 angleOrig
= atan2((double)srcY
, (double)srcX
) - rad
;
1136 dstX
= (wxCoord
)(r
* cos(angleOrig
) + 0.5);
1137 dstY
= (wxCoord
)(r
* sin(angleOrig
) + 0.5);
1140 textPixel
= data
[(srcY
*w
+ srcX
)*3] == 0;
1141 if ( textPixel
|| (m_backgroundMode
== wxSOLID
) )
1143 SetCPixel(XLOG2DEV(x
+ dstX
), YLOG2DEV(y
+ dstY
),
1144 textPixel
? &colText
: &colBack
);
1149 // it would be better to draw with non underlined font and draw the line
1150 // manually here (it would be more straight...)
1152 if ( m_font
.GetUnderlined() )
1154 ::MoveTo(XLOG2DEV(x
+ x4
), YLOG2DEV(y
+ y4
+ font
->descent
));
1155 ::LineTo(XLOG2DEV(x
+ x3
), YLOG2DEV(y
+ y3
+ font
->descent
));
1159 // update the bounding box
1160 CalcBoundingBox(x
+ minX
, y
+ minY
);
1161 CalcBoundingBox(x
+ maxX
, y
+ maxY
);
1163 void wxDC::DoDrawText(const wxString
& strtext
, wxCoord x
, wxCoord y
)
1165 wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC"));
1166 wxMacPortSetter
helper(this) ;
1168 long xx
= XLOG2DEV(x
);
1169 long yy
= YLOG2DEV(y
);
1171 // if (m_pen.GetStyle() != wxTRANSPARENT)
1175 Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
1177 ::ClipRect( &clip ) ;
1181 ::GetFontInfo( &fi
) ;
1184 ::MoveTo( xx
, yy
);
1185 if ( m_backgroundMode
== wxTRANSPARENT
)
1187 ::TextMode( srcOr
) ;
1191 ::TextMode( srcCopy
) ;
1194 const char *text
= NULL
;
1198 if ( wxApp::s_macDefaultEncodingIsPC
)
1200 macText
= wxMacMakeMacStringFromPC( strtext
) ;
1202 length
= macText
.Length() ;
1207 length
= strtext
.Length() ;
1216 if( text
[i
] == 13 || text
[i
] == 10)
1218 ::DrawText( text
, laststop
, i
- laststop
) ;
1220 ::MoveTo( xx
, yy
+ line
*(fi
.descent
+ fi
.ascent
+ fi
.leading
) );
1226 ::DrawText( text
, laststop
, i
- laststop
) ;
1227 ::TextMode( srcOr
) ;
1231 bool wxDC::CanGetTextExtent() const
1233 wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
1238 void wxDC::DoGetTextExtent( const wxString
&string
, wxCoord
*width
, wxCoord
*height
,
1239 wxCoord
*descent
, wxCoord
*externalLeading
,
1240 wxFont
*theFont
) const
1242 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1243 wxMacPortSetter
helper(this) ;
1245 wxFont formerFont
= m_font
;
1249 wxFontRefData
* font
= (wxFontRefData
*) m_font
.GetRefData() ;
1253 ::TextFont( font
->m_macFontNum
) ;
1254 ::TextSize( YLOG2DEVREL( font
->m_macFontSize
) ) ;
1255 ::TextFace( font
->m_macFontStyle
) ;
1264 ::GetFontInfo( &fi
) ;
1267 *height
= YDEV2LOGREL( fi
.descent
+ fi
.ascent
) ;
1269 *descent
=YDEV2LOGREL( fi
.descent
);
1270 if ( externalLeading
)
1271 *externalLeading
= YDEV2LOGREL( fi
.leading
) ;
1273 const char *text
= NULL
;
1276 if ( wxApp::s_macDefaultEncodingIsPC
)
1278 macText
= wxMacMakeMacStringFromPC( string
) ;
1280 length
= macText
.Length() ;
1285 length
= string
.Length() ;
1297 if( text
[i
] == 13 || text
[i
] == 10)
1300 *height
+= YDEV2LOGREL( fi
.descent
+ fi
.ascent
+ fi
.leading
) ;
1301 curwidth
= ::TextWidth( text
, laststop
, i
- laststop
) ;
1302 if ( curwidth
> *width
)
1303 *width
= XDEV2LOGREL( curwidth
) ;
1309 curwidth
= ::TextWidth( text
, laststop
, i
- laststop
) ;
1310 if ( curwidth
> *width
)
1311 *width
= XDEV2LOGREL( curwidth
) ;
1316 m_macFontInstalled
= false ;
1320 wxCoord
wxDC::GetCharWidth(void) const
1322 wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
1324 wxMacPortSetter
helper(this) ;
1328 int width
= ::TextWidth( "n" , 0 , 1 ) ;
1330 return YDEV2LOGREL(width
) ;
1333 wxCoord
wxDC::GetCharHeight(void) const
1335 wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
1337 wxMacPortSetter
helper(this) ;
1342 ::GetFontInfo( &fi
) ;
1344 return YDEV2LOGREL( fi
.descent
+ fi
.ascent
);
1347 void wxDC::Clear(void)
1349 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1350 wxMacPortSetter
helper(this) ;
1351 Rect rect
= { -32767 , -32767 , 32767 , 32767 } ;
1353 if (m_backgroundBrush
.GetStyle() != wxTRANSPARENT
)
1356 ::EraseRect( &rect
) ;
1360 void wxDC::MacInstallFont() const
1362 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1363 // if ( m_macFontInstalled )
1365 Pattern blackColor
;
1367 wxFontRefData
* font
= (wxFontRefData
*) m_font
.GetRefData() ;
1371 ::TextFont( font
->m_macFontNum
) ;
1372 ::TextSize( short(m_scaleY
* font
->m_macFontSize
) ) ;
1373 ::TextFace( font
->m_macFontStyle
) ;
1375 m_macFontInstalled
= true ;
1376 m_macBrushInstalled
= false ;
1377 m_macPenInstalled
= false ;
1379 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
1380 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
1381 ::RGBForeColor( &forecolor
);
1382 ::RGBBackColor( &backcolor
);
1388 GetFNum( "\pGeneva" , &fontnum
) ;
1389 ::TextFont( fontnum
) ;
1390 ::TextSize( short(m_scaleY
* 10) ) ;
1393 // todo reset after spacing changes - or store the current spacing somewhere
1395 m_macFontInstalled
= true ;
1396 m_macBrushInstalled
= false ;
1397 m_macPenInstalled
= false ;
1399 RGBColor forecolor
= m_textForegroundColour
.GetPixel();
1400 RGBColor backcolor
= m_textBackgroundColour
.GetPixel();
1401 ::RGBForeColor( &forecolor
);
1402 ::RGBBackColor( &backcolor
);
1405 short mode
= patCopy
;
1409 switch( m_logicalFunction
)
1414 case wxINVERT
: // NOT dst
1415 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1418 case wxXOR
: // src XOR dst
1421 case wxOR_REVERSE
: // src OR (NOT dst)
1424 case wxSRC_INVERT
: // (NOT src)
1431 case wxAND_REVERSE
:// src AND (NOT dst)
1432 case wxAND
: // src AND dst
1433 case wxAND_INVERT
: // (NOT src) AND dst
1434 case wxNO_OP
: // dst
1435 case wxNOR
: // (NOT src) AND (NOT dst)
1436 case wxEQUIV
: // (NOT src) XOR dst
1437 case wxOR_INVERT
: // (NOT src) OR dst
1438 case wxNAND
: // (NOT src) OR (NOT dst)
1439 case wxOR
: // src OR dst
1441 // case wxSRC_OR: // source _bitmap_ OR destination
1442 // case wxSRC_AND: // source _bitmap_ AND destination
1448 static void wxMacGetHatchPattern(int hatchStyle
, Pattern
*pattern
)
1450 int thePatListID
= sysPatListID
;
1454 case wxBDIAGONAL_HATCH
:
1455 theIndex
= 34; // WCH: this is not good
1457 case wxFDIAGONAL_HATCH
:
1463 case wxHORIZONTAL_HATCH
:
1466 case wxVERTICAL_HATCH
:
1469 case wxCROSSDIAG_HATCH
:
1470 theIndex
= 4; // WCH: this is not good
1473 theIndex
= 1; // solid pattern
1476 GetIndPattern( pattern
, thePatListID
, theIndex
);
1479 void wxDC::MacInstallPen() const
1481 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1485 // if ( m_macPenInstalled )
1488 RGBColor forecolor
= m_pen
.GetColour().GetPixel();
1489 RGBColor backcolor
= m_backgroundBrush
.GetColour().GetPixel();
1490 ::RGBForeColor( &forecolor
);
1491 ::RGBBackColor( &backcolor
);
1494 int penWidth
= m_pen
.GetWidth() * (int) m_scaleX
;
1496 // null means only one pixel, at whatever resolution
1497 if ( penWidth
== 0 )
1499 ::PenSize(penWidth
, penWidth
);
1501 int penStyle
= m_pen
.GetStyle();
1503 if (penStyle
== wxSOLID
)
1505 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1507 else if (IS_HATCH(penStyle
))
1510 wxMacGetHatchPattern(penStyle
, &pat
);
1515 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1518 short mode
= patCopy
;
1522 switch( m_logicalFunction
)
1527 case wxINVERT
: // NOT dst
1528 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1531 case wxXOR
: // src XOR dst
1534 case wxOR_REVERSE
: // src OR (NOT dst)
1537 case wxSRC_INVERT
: // (NOT src)
1544 case wxAND_REVERSE
:// src AND (NOT dst)
1545 case wxAND
: // src AND dst
1546 case wxAND_INVERT
: // (NOT src) AND dst
1547 case wxNO_OP
: // dst
1548 case wxNOR
: // (NOT src) AND (NOT dst)
1549 case wxEQUIV
: // (NOT src) XOR dst
1550 case wxOR_INVERT
: // (NOT src) OR dst
1551 case wxNAND
: // (NOT src) OR (NOT dst)
1552 case wxOR
: // src OR dst
1554 // case wxSRC_OR: // source _bitmap_ OR destination
1555 // case wxSRC_AND: // source _bitmap_ AND destination
1559 m_macPenInstalled
= true ;
1560 m_macBrushInstalled
= false ;
1561 m_macFontInstalled
= false ;
1564 int wxDC::MacSetupBackgroundForCurrentPort(const wxBrush
& background
)
1566 Pattern whiteColor
;
1567 if ( background
.IsMacTheme() )
1569 SetThemeBackground( background
.GetMacTheme() , wxDisplayDepth() , true ) ;
1571 else if ( background
.IsMacThemeBackground() )
1573 Rect originBox
= { 0,0,1,1 } ;
1574 ::ApplyThemeBackground( background
.GetMacThemeBackground() , &originBox
,kThemeStateActive
,
1575 wxDisplayDepth() , true ) ;
1579 ::RGBBackColor( &background
.GetColour().GetPixel() );
1580 int brushStyle
= background
.GetStyle();
1581 if (brushStyle
== wxSOLID
)
1582 ::BackPat(GetQDGlobalsWhite(&whiteColor
));
1583 else if (IS_HATCH(brushStyle
))
1586 wxMacGetHatchPattern(brushStyle
, &pat
);
1591 ::BackPat(GetQDGlobalsWhite(&whiteColor
));
1597 void wxDC::MacInstallBrush() const
1599 wxCHECK_RET(Ok(), wxT("Invalid DC"));
1601 Pattern blackColor
;
1602 // if ( m_macBrushInstalled )
1607 ::RGBForeColor( &m_brush
.GetColour().GetPixel() );
1609 int brushStyle
= m_brush
.GetStyle();
1610 if (brushStyle
== wxSOLID
)
1611 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1612 else if (IS_HATCH(brushStyle
))
1615 wxMacGetHatchPattern(brushStyle
, &pat
);
1620 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1626 MacSetupBackgroundForCurrentPort( m_backgroundBrush
) ;
1631 short mode
= patCopy
;
1632 switch( m_logicalFunction
)
1637 case wxINVERT
: // NOT dst
1638 ::PenPat(GetQDGlobalsBlack(&blackColor
));
1641 case wxXOR
: // src XOR dst
1644 case wxOR_REVERSE
: // src OR (NOT dst)
1647 case wxSRC_INVERT
: // (NOT src)
1654 case wxAND_REVERSE
:// src AND (NOT dst)
1655 case wxAND
: // src AND dst
1656 case wxAND_INVERT
: // (NOT src) AND dst
1657 case wxNO_OP
: // dst
1658 case wxNOR
: // (NOT src) AND (NOT dst)
1659 case wxEQUIV
: // (NOT src) XOR dst
1660 case wxOR_INVERT
: // (NOT src) OR dst
1661 case wxNAND
: // (NOT src) OR (NOT dst)
1662 case wxOR
: // src OR dst
1664 // case wxSRC_OR: // source _bitmap_ OR destination
1665 // case wxSRC_AND: // source _bitmap_ AND destination
1669 m_macBrushInstalled
= true ;
1670 m_macPenInstalled
= false ;
1671 m_macFontInstalled
= false ;
1674 // ---------------------------------------------------------------------------
1675 // coordinates transformations
1676 // ---------------------------------------------------------------------------
1679 wxCoord
wxDCBase::DeviceToLogicalX(wxCoord x
) const
1681 return ((wxDC
*)this)->XDEV2LOG(x
);
1684 wxCoord
wxDCBase::DeviceToLogicalY(wxCoord y
) const
1686 return ((wxDC
*)this)->YDEV2LOG(y
);
1689 wxCoord
wxDCBase::DeviceToLogicalXRel(wxCoord x
) const
1691 return ((wxDC
*)this)->XDEV2LOGREL(x
);
1694 wxCoord
wxDCBase::DeviceToLogicalYRel(wxCoord y
) const
1696 return ((wxDC
*)this)->YDEV2LOGREL(y
);
1699 wxCoord
wxDCBase::LogicalToDeviceX(wxCoord x
) const
1701 return ((wxDC
*)this)->XLOG2DEV(x
);
1704 wxCoord
wxDCBase::LogicalToDeviceY(wxCoord y
) const
1706 return ((wxDC
*)this)->YLOG2DEV(y
);
1709 wxCoord
wxDCBase::LogicalToDeviceXRel(wxCoord x
) const
1711 return ((wxDC
*)this)->XLOG2DEVREL(x
);
1714 wxCoord
wxDCBase::LogicalToDeviceYRel(wxCoord y
) const
1716 return ((wxDC
*)this)->YLOG2DEVREL(y
);