]>
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::InitWith (unsigned char r
, unsigned char g
, unsigned char b
)
54 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
);
57 void wxColour::FromRGBColor( const WXCOLORREF
* color
)
59 RGBColor
* col
= (RGBColor
*) color
;
60 memcpy( &m_pixel
, color
, 6 );
61 m_red
= col
->red
>> 8;
62 m_blue
= col
->blue
>> 8;
63 m_green
= col
->green
>> 8;