]>
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"
16 #include "wx/gdicmn.h"
18 #include "wx/mac/private.h"
20 IMPLEMENT_DYNAMIC_CLASS(wxColour
, wxObject
)
22 static void wxComposeRGBColor( WXCOLORREF
* color
, int red
, int blue
, int green
);
23 static void wxComposeRGBColor( WXCOLORREF
* color
, int red
, int blue
, int green
)
25 RGBColor
* col
= (RGBColor
*) color
;
26 col
->red
= (red
<< 8) + red
;
27 col
->blue
= (blue
<< 8) + blue
;
28 col
->green
= (green
<< 8) + green
;
38 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
);
41 wxColour::~wxColour ()
45 void wxColour::InitWith (unsigned char r
, unsigned char g
, unsigned char b
)
52 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
);
55 void wxColour::Set( const WXCOLORREF
* color
)
57 RGBColor
* col
= (RGBColor
*) color
;
58 memcpy( &m_pixel
, color
, 6 );
59 m_red
= col
->red
>> 8;
60 m_blue
= col
->blue
>> 8;
61 m_green
= col
->green
>> 8;