From 01b5ab3367bc503021b7b39e4162f2e8fd8022f1 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 4 Jan 2006 11:43:45 +0000 Subject: [PATCH] starting blend modes for Core Graphics git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36675 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/dccg.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/mac/carbon/dccg.cpp b/src/mac/carbon/dccg.cpp index 2a4f178ef9..24a5331756 100755 --- a/src/mac/carbon/dccg.cpp +++ b/src/mac/carbon/dccg.cpp @@ -37,6 +37,10 @@ IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) +#ifndef wxMAC_USE_CORE_GRAPHICS_BLEND_MODES +#define wxMAC_USE_CORE_GRAPHICS_BLEND_MODES 0 +#endif + //----------------------------------------------------------------------------- // constants //----------------------------------------------------------------------------- @@ -1194,6 +1198,15 @@ void wxDC::SetLogicalFunction( int function ) return; m_logicalFunction = function ; +#if wxMAC_USE_CORE_GRAPHICS_BLEND_MODES + CGContextRef cgContext = ((wxMacCGContext*)(m_graphicContext))->GetNativeContext() ; + if ( m_logicalFunction == wxCOPY ) + CGContextSetBlendMode( cgContext, kCGBlendModeNormal ) ; + else if ( m_logicalFunction == wxINVERT ) + CGContextSetBlendMode( cgContext, kCGBlendModeExclusion ) ; + else + CGContextSetBlendMode( cgContext, kCGBlendModeNormal ) ; +#endif } extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y, @@ -1227,8 +1240,10 @@ void wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) { wxCHECK_RET( Ok(), wxT("wxDC(cg)::DoDrawLine - invalid DC") ); +#if !wxMAC_USE_CORE_GRAPHICS_BLEND_MODES if ( m_logicalFunction != wxCOPY ) return ; +#endif wxCoord xx1 = XLOG2DEVMAC(x1) ; wxCoord yy1 = YLOG2DEVMAC(y1) ; @@ -1382,8 +1397,10 @@ void wxDC::DoDrawLines(int n, wxPoint points[], { wxCHECK_RET( Ok(), wxT("wxDC(cg)::DoDrawLines - invalid DC") ); +#if !wxMAC_USE_CORE_GRAPHICS_BLEND_MODES if ( m_logicalFunction != wxCOPY ) return ; +#endif wxCoord x1, x2 , y1 , y2 ; x1 = XLOG2DEVMAC(points[0].x + xoffset);