+// 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;
+}
+
+