#if wxMAC_USE_CORE_GRAPHICS
// CoreGraphics
wxGraphicContext * m_graphicContext ;
+ wxPoint m_macLocalOriginInPort ;
#else
- mutable bool m_macFontInstalled ;
- mutable bool m_macPenInstalled ;
- mutable bool m_macBrushInstalled ;
-
- WXHRGN m_macBoundaryClipRgn ;
- WXHRGN m_macCurrentClipRgn ;
- void MacSetupPort( wxMacPortStateHelper* ph ) const ;
- void MacCleanupPort( wxMacPortStateHelper* ph ) const ;
+ mutable bool m_macFontInstalled ;
+ mutable bool m_macPenInstalled ;
+ mutable bool m_macBrushInstalled ;
+
+ WXHRGN m_macBoundaryClipRgn ;
+ WXHRGN m_macCurrentClipRgn ;
+ void MacSetupPort( wxMacPortStateHelper* ph ) const ;
+ void MacCleanupPort( wxMacPortStateHelper* ph ) const ;
mutable wxMacPortStateHelper* m_macCurrentPortStateHelper ;
mutable bool m_macFormerAliasState ;
mutable short m_macFormerAliasSize ;
bool wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
{
wxCHECK_MSG( Ok(), false, wxT("wxDC::DoGetPixel Invalid DC") );
- wxFAIL_MSG( wxT("GetPixel not implemented on Core Graphics") ) ;
- return false ;
+ wxCHECK_MSG( Ok(), false, wxT("wxDC::DoGetPixel Invalid DC") );
+ wxMacPortSaver helper((CGrafPtr)m_macPort) ;
+ RGBColor colour;
+ GetCPixel(
+ XLOG2DEVMAC(x) + m_macLocalOriginInPort.x - m_macLocalOrigin.x,
+ YLOG2DEVMAC(y) + m_macLocalOriginInPort.y - m_macLocalOrigin.y, &colour );
+ // Convert from Mac colour to wx
+ col->Set( colour.red >> 8,
+ colour.green >> 8,
+ colour.blue >> 8);
+ return true ;
}
void wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )