]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/colour.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/colour.cpp
3 // Purpose: wxColour class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/colour.h"
17 #include "wx/gdicmn.h"
20 #include "wx/mac/private.h"
22 IMPLEMENT_DYNAMIC_CLASS(wxColour
, wxObject
)
24 wxColour::wxColour(const RGBColor
& col
)
26 FromRGBColor((WXCOLORREF
*)&col
);
29 static void wxComposeRGBColor( WXCOLORREF
* color
, int red
, int blue
, int green
)
31 RGBColor
* col
= (RGBColor
*) color
;
32 col
->red
= (red
<< 8) + red
;
33 col
->blue
= (blue
<< 8) + blue
;
34 col
->green
= (green
<< 8) + green
;
44 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
);
47 wxColour::~wxColour ()
51 void wxColour::InitRGBA (unsigned char r
, unsigned char g
, unsigned char b
, unsigned char a
)
59 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
);
62 void wxColour::FromRGBColor( WXCOLORREF
* color
)
64 RGBColor
* col
= (RGBColor
*) color
;
65 memcpy( &m_pixel
, color
, 6 );
66 m_red
= col
->red
>> 8;
67 m_blue
= col
->blue
>> 8;
68 m_green
= col
->green
>> 8;
71 wxColour
& wxColour::operator=(const RGBColor
& col
)
73 FromRGBColor((WXCOLORREF
*)&col
);
76 bool wxColour::IsOk() const