- RGBColor* col = (RGBColor*) color ;
- memcpy( &m_pixel , color , 6 ) ;
- m_red = col->red>>8 ;
- m_blue = col->blue>>8 ;
- m_green = col->green>>8 ;
+ m_cgColour.reset( col );
+ size_t noComp = CGColorGetNumberOfComponents( col );
+ if ( noComp >=3 && noComp <= 4 )
+ {
+ // TODO verify whether we really are on a RGB color space
+ const CGFloat *components = CGColorGetComponents( col );
+ m_red = (int)(components[0]*255+0.5);
+ m_green = (int)(components[1]*255+0.5);
+ m_blue = (int)(components[2]*255+0.5);
+ if ( noComp == 4 )
+ m_alpha = (int)(components[3]*255+0.5);
+ else
+ m_alpha = wxALPHA_OPAQUE;
+ }
+ else
+ {
+ m_alpha = wxALPHA_OPAQUE;
+ m_red = m_green = m_blue = 0;
+ }
+}
+
+bool wxColour::operator == (const wxColour& colour) const
+{
+ return ( (IsOk() == colour.IsOk()) && (!IsOk() ||
+ CGColorEqualToColor( m_cgColour, colour.m_cgColour ) ) );