+bool wxMacCoreGraphicsContext::SetLogicalFunction( int function )
+{
+ if (m_logicalFunction == function)
+ return true;
+
+ EnsureIsValid();
+
+ bool retval = false;
+
+ if ( function == wxCOPY )
+ {
+ retval = true;
+#if wxMAC_USE_CORE_GRAPHICS_BLEND_MODES
+ if ( CGContextSetBlendMode != NULL )
+ {
+ CGContextSetBlendMode( m_cgContext, kCGBlendModeNormal );
+ }
+#endif
+ }
+ else if ( function == wxINVERT || function == wxXOR )
+ {
+#if wxMAC_USE_CORE_GRAPHICS_BLEND_MODES
+ if ( CGContextSetBlendMode != NULL )
+ {
+ // change color to white
+ CGContextSetBlendMode( m_cgContext, kCGBlendModeExclusion );
+ retval = true;
+ }
+#endif
+ }
+
+ if (retval)
+ m_logicalFunction = function;
+ return retval ;
+}