]> git.saurik.com Git - wxWidgets.git/commitdiff
using the foreground brush to fill mono bitmaps - gradients are not yet supported
authorStefan Csomor <csomor@advancedconcepts.ch>
Thu, 2 Nov 2006 09:18:16 +0000 (09:18 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Thu, 2 Nov 2006 09:18:16 +0000 (09:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/graphics.cpp

index a79c96bfc94fc2769c867dd06d99249c680b8b22..9243a25b6f6c2bd2f3526457984764c7c4225dc9 100755 (executable)
@@ -1494,7 +1494,33 @@ void wxMacCoreGraphicsContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDo
 
     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 );
 }