+static bool TranslateRasterOp(wxRasterOperationMode function, wxCompositionMode *op)
+{
+ switch ( function )
+ {
+ case wxCOPY: // src
+ // since we are supporting alpha, _OVER is closer to the intention than _SOURCE
+ // since the latter would overwrite even when alpha is is not set to opaque
+ *op = wxCOMPOSITION_OVER;
+ break;
+ case wxOR: // src OR dst
+ *op = wxCOMPOSITION_ADD;
+ break;
+ case wxNO_OP: // dst
+ *op = wxCOMPOSITION_DEST; // ignore the source
+ break;
+ case wxCLEAR: // 0
+ *op = wxCOMPOSITION_CLEAR;// clear dst
+ break;
+ case wxXOR: // src XOR dst
+ *op = wxCOMPOSITION_XOR;
+ 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
+ default:
+ return false;
+ }
+ return true;
+}
+