]>
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/gdicmn.h"
15 #include "wx/colour.h"
17 #include "wx/mac/private.h"
19 IMPLEMENT_DYNAMIC_CLASS(wxColour
, wxObject
)
21 static void wxComposeRGBColor( WXCOLORREF
* color
, int red
, int blue
, int green
);
22 static void wxComposeRGBColor( WXCOLORREF
* color
, int red
, int blue
, int green
)
24 RGBColor
* col
= (RGBColor
*) color
;
25 col
->red
= (red
<< 8) + red
;
26 col
->blue
= (blue
<< 8) + blue
;
27 col
->green
= (green
<< 8) + green
;
37 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
);
40 void wxColour::InitFromName(const wxString
& name
)
42 if ( wxTheColourDatabase
)
44 wxColour col
= wxTheColourDatabase
->Find( name
);
56 wxColour::~wxColour ()
60 void wxColour::Set (unsigned char r
, unsigned char g
, unsigned char b
)
67 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
);
70 void wxColour::Set( const WXCOLORREF
* color
)
72 RGBColor
* col
= (RGBColor
*) color
;
73 memcpy( &m_pixel
, color
, 6 );
74 m_red
= col
->red
>> 8;
75 m_blue
= col
->blue
>> 8;
76 m_green
= col
->green
>> 8;