]>
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 static void wxComposeRGBColor( WXCOLORREF
* color
, int red
, int blue
, int green
);
25 static void wxComposeRGBColor( WXCOLORREF
* color
, int red
, int blue
, int green
)
27 RGBColor
* col
= (RGBColor
*) color
;
28 col
->red
= (red
<< 8) + red
;
29 col
->blue
= (blue
<< 8) + blue
;
30 col
->green
= (green
<< 8) + green
;
40 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
);
43 wxColour::~wxColour ()
47 void wxColour::InitRGBA (unsigned char r
, unsigned char g
, unsigned char b
, unsigned char a
)
55 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
);
58 void wxColour::FromRGBColor( WXCOLORREF
* color
)
60 RGBColor
* col
= (RGBColor
*) color
;
61 memcpy( &m_pixel
, color
, 6 );
62 m_red
= col
->red
>> 8;
63 m_blue
= col
->blue
>> 8;
64 m_green
= col
->green
>> 8;