implement support for wxOR and wxCLEAR in wxCairoContext::SetLogicalFunction() (#9808)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
4c7b2d367e
commit
49ad157e30
@ -356,6 +356,8 @@ public:
|
||||
|
||||
virtual void * GetNativeContext();
|
||||
|
||||
virtual bool SetLogicalFunction( int function );
|
||||
|
||||
virtual void StrokePath( const wxGraphicsPath& p );
|
||||
virtual void FillPath( const wxGraphicsPath& p , int fillStyle = wxWINDING_RULE );
|
||||
|
||||
@ -1520,6 +1522,54 @@ void * wxCairoContext::GetNativeContext()
|
||||
return m_context;
|
||||
}
|
||||
|
||||
// Cairo doesn't support bitwise logical function (a.k.a. ROP, raster output
|
||||
// mode). Cairo supports Porter-Duff compositing operators, but they are quite
|
||||
// different, although in some cases have similar names.
|
||||
bool wxCairoContext::SetLogicalFunction( int function )
|
||||
{
|
||||
if (m_logicalFunction == function)
|
||||
return true;
|
||||
|
||||
cairo_operator_t op;
|
||||
|
||||
switch ( function )
|
||||
{
|
||||
case wxCOPY: // (default) src
|
||||
op = CAIRO_OPERATOR_OVER; // (also default)
|
||||
break;
|
||||
case wxOR: // src OR dst
|
||||
op = CAIRO_OPERATOR_ADD;
|
||||
break;
|
||||
case wxNO_OP: // dst
|
||||
op = CAIRO_OPERATOR_DEST; // ignore the source
|
||||
break;
|
||||
case wxCLEAR: // 0
|
||||
op = CAIRO_OPERATOR_CLEAR;// clear dst
|
||||
break;
|
||||
|
||||
case wxAND: // src AND dst
|
||||
case wxAND_INVERT: // (NOT src) AND dst
|
||||
case wxAND_REVERSE:// src AND (NOT dst)
|
||||
case wxEQUIV: // (NOT src) XOR dst
|
||||
case wxINVERT: // NOT dst
|
||||
case wxNAND: // (NOT src) OR (NOT dst)
|
||||
case wxNOR: // (NOT src) AND (NOT dst)
|
||||
case wxOR_INVERT: // (NOT src) OR dst
|
||||
case wxOR_REVERSE: // src OR (NOT dst)
|
||||
case wxSET: // 1
|
||||
case wxSRC_INVERT: // NOT src
|
||||
//wxXOR does _not_ correspond to CAIRO_OPERATOR_XOR
|
||||
case wxXOR: // src XOR dst
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
m_logicalFunction = function;
|
||||
cairo_set_operator(m_context, op);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxCairoRenderer declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user