+static wxCompositionMode TranslateRasterOp(wxRasterOperationMode function)
+{
+ 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 not set to opaque
+ return wxCOMPOSITION_OVER;
+
+ case wxOR: // src OR dst
+ return wxCOMPOSITION_ADD;
+
+ case wxNO_OP: // dst
+ return wxCOMPOSITION_DEST; // ignore the source
+
+ case wxCLEAR: // 0
+ return wxCOMPOSITION_CLEAR;// clear dst
+
+ case wxXOR: // src XOR dst
+ return wxCOMPOSITION_XOR;
+
+ 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
+ break;
+ }
+
+ return wxCOMPOSITION_INVALID;
+}
+