bool wxMacCoreGraphicsMatrixData::IsEqual( const wxGraphicsMatrixData* t) const
{
const CGAffineTransform* tm = (CGAffineTransform*) t->GetNativeMatrix();
- return (
- m_matrix.a == tm->a &&
- m_matrix.b == tm->b &&
- m_matrix.c == tm->c &&
- m_matrix.d == tm->d &&
- m_matrix.tx == tm->tx &&
- m_matrix.ty == tm->ty ) ;
-
- return CGAffineTransformEqualToTransform(m_matrix, *((CGAffineTransform*) t->GetNativeMatrix()));
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ if ( CGAffineTransformEqualToTransform!=NULL )
+ {
+ return CGAffineTransformEqualToTransform(m_matrix, *((CGAffineTransform*) t->GetNativeMatrix()));
+ }
+ else
+#endif
+ {
+ return (
+ m_matrix.a == tm->a &&
+ m_matrix.b == tm->b &&
+ m_matrix.c == tm->c &&
+ m_matrix.d == tm->d &&
+ m_matrix.tx == tm->tx &&
+ m_matrix.ty == tm->ty ) ;
+ }
}
// return true if this is the identity matrix
bool wxMacCoreGraphicsPathData::Contains( wxDouble x, wxDouble y, int fillStyle) const
{
- return CGPathContainsPoint( m_path, NULL, CGPointMake(x,y), fillStyle == wxODDEVEN_RULE );
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ if ( CGPathContainsPoint!=NULL )
+ {
+ return CGPathContainsPoint( m_path, NULL, CGPointMake(x,y), fillStyle == wxODDEVEN_RULE );
+ }
+ else
+#endif
+ {
+ // TODO : implementation for 10.3
+ CGRect bounds = CGPathGetBoundingBox( m_path ) ;
+ return CGRectContainsPoint( bounds, CGPointMake(x,y) ) == 1;
+ }
}
//
{
if ( m_cgContext )
{
+ // there is no way for clearing the clip, we can only revert to the stored
+ // state, but then we have to make sure everything else is NOT restored
+ CGAffineTransform transform = CGContextGetCTM( m_cgContext );
CGContextRestoreGState( m_cgContext );
CGContextSaveGState( m_cgContext );
+ CGAffineTransform transformNew = CGContextGetCTM( m_cgContext );
+ transformNew = CGAffineTransformInvert( transformNew ) ;
+ CGContextConcatCTM( m_cgContext, transformNew);
+ CGContextConcatCTM( m_cgContext, transform);
}
else
{
CGImageRef image = (CGImageRef)( bmp.CGImageCreate() );
HIRect r = CGRectMake( x , y , w , h );
- HIViewDrawCGImage( m_cgContext , &r , image );
+ if ( bmp.GetDepth() == 1 )
+ {
+ // is is a mask, the '1' in the mask tell where to draw the current brush
+ if ( !m_brush.IsNull() )
+ {
+ if ( ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->IsShading() )
+ {
+ // TODO clip to mask
+ /*
+ CGContextSaveGState( m_cgContext );
+ CGContextAddPath( m_cgContext , (CGPathRef) path.GetNativePath() );
+ CGContextClip( m_cgContext );
+ CGContextDrawShading( m_cgContext, ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->GetShading() );
+ CGContextRestoreGState( m_cgContext);
+ */
+ }
+ else
+ {
+ ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->Apply(this);
+ HIViewDrawCGImage( m_cgContext , &r , image );
+ }
+ }
+ }
+ else
+ {
+ HIViewDrawCGImage( m_cgContext , &r , image );
+ }
CGImageRelease( image );
}
virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window );
virtual wxGraphicsContext * CreateContext( wxWindow* window );
+
+ virtual wxGraphicsContext * CreateMeasuringContext();
// Path
return new wxMacCoreGraphicsContext(this, window );
}
+wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateMeasuringContext()
+{
+ return new wxMacCoreGraphicsContext(this);
+}
+
// Path
wxGraphicsPath wxMacCoreGraphicsRenderer::CreatePath()