+// this function emulates all wx colour manipulations, used to verify the implementation
+// by setting the mode in the blitting functions to kEmulatedMode
+
+void wxMacCalculateColour( int logical_func , const RGBColor &srcColor , RGBColor &dstColor ) ;
+void wxMacCalculateColour( int logical_func , const RGBColor &srcColor , RGBColor &dstColor )
+{
+ switch ( logical_func )
+ {
+ case wxAND: // src AND dst
+ dstColor.red = dstColor.red & srcColor.red ;
+ dstColor.green = dstColor.green & srcColor.green ;
+ dstColor.blue = dstColor.blue & srcColor.blue ;
+ break ;
+ case wxAND_INVERT: // (NOT src) AND dst
+ dstColor.red = dstColor.red & ~srcColor.red ;
+ dstColor.green = dstColor.green & ~srcColor.green ;
+ dstColor.blue = dstColor.blue & ~srcColor.blue ;
+ break ;
+ case wxAND_REVERSE:// src AND (NOT dst)
+ dstColor.red = ~dstColor.red & srcColor.red ;
+ dstColor.green = ~dstColor.green & srcColor.green ;
+ dstColor.blue = ~dstColor.blue & srcColor.blue ;
+ break ;
+ case wxCLEAR: // 0
+ dstColor.red = 0 ;
+ dstColor.green = 0 ;
+ dstColor.blue = 0 ;
+ break ;
+ case wxCOPY: // src
+ dstColor.red = srcColor.red ;
+ dstColor.green = srcColor.green ;
+ dstColor.blue = srcColor.blue ;
+ break ;
+ case wxEQUIV: // (NOT src) XOR dst
+ dstColor.red = dstColor.red ^ ~srcColor.red ;
+ dstColor.green = dstColor.green ^ ~srcColor.green ;
+ dstColor.blue = dstColor.blue ^ ~srcColor.blue ;
+ break ;
+ case wxINVERT: // NOT dst
+ dstColor.red = ~dstColor.red ;
+ dstColor.green = ~dstColor.green ;
+ dstColor.blue = ~dstColor.blue ;
+ break ;
+ case wxNAND: // (NOT src) OR (NOT dst)
+ dstColor.red = ~dstColor.red | ~srcColor.red ;
+ dstColor.green = ~dstColor.green | ~srcColor.green ;
+ dstColor.blue = ~dstColor.blue | ~srcColor.blue ;
+ break ;
+ case wxNOR: // (NOT src) AND (NOT dst)
+ dstColor.red = ~dstColor.red & ~srcColor.red ;
+ dstColor.green = ~dstColor.green & ~srcColor.green ;
+ dstColor.blue = ~dstColor.blue & ~srcColor.blue ;
+ break ;
+ case wxNO_OP: // dst
+ break ;
+ case wxOR: // src OR dst
+ dstColor.red = dstColor.red | srcColor.red ;
+ dstColor.green = dstColor.green | srcColor.green ;
+ dstColor.blue = dstColor.blue | srcColor.blue ;
+ break ;
+ case wxOR_INVERT: // (NOT src) OR dst
+ dstColor.red = dstColor.red | ~srcColor.red ;
+ dstColor.green = dstColor.green | ~srcColor.green ;
+ dstColor.blue = dstColor.blue | ~srcColor.blue ;
+ break ;
+ case wxOR_REVERSE: // src OR (NOT dst)
+ dstColor.red = ~dstColor.red | srcColor.red ;
+ dstColor.green = ~dstColor.green | srcColor.green ;
+ dstColor.blue = ~dstColor.blue | srcColor.blue ;
+ break ;
+ case wxSET: // 1
+ dstColor.red = 0xFFFF ;
+ dstColor.green = 0xFFFF ;
+ dstColor.blue = 0xFFFF ;
+ break ;
+ case wxSRC_INVERT: // (NOT src)
+ dstColor.red = ~srcColor.red ;
+ dstColor.green = ~srcColor.green ;
+ dstColor.blue = ~srcColor.blue ;
+ break ;
+ case wxXOR: // src XOR dst
+ dstColor.red = dstColor.red ^ srcColor.red ;
+ dstColor.green = dstColor.green ^ srcColor.green ;
+ dstColor.blue = dstColor.blue ^ srcColor.blue ;
+ break ;
+ }
+
+}
+