]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/colour.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxColour class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "colour.h"
16 #include "wx/gdicmn.h"
17 #include "wx/colour.h"
19 IMPLEMENT_DYNAMIC_CLASS(wxColour
, wxObject
)
23 static void wxComposeRGBColor( RGBColor
* col
, int red
, int blue
, int green
) ;
24 static void wxComposeRGBColor( RGBColor
* col
, int red
, int blue
, int green
)
26 col
->red
= (red
<< 8) + red
;
27 col
->blue
= (blue
<< 8) + blue
;
28 col
->green
= (green
<< 8) + green
;
34 m_red
= m_blue
= m_green
= 0;
36 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
) ;
39 wxColour::wxColour (unsigned char r
, unsigned char g
, unsigned char b
)
46 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
) ;
49 wxColour::wxColour (const wxColour
& col
)
52 m_green
= col
.m_green
;
54 m_isInit
= col
.m_isInit
;
56 m_pixel
= col
.m_pixel
;
59 wxColour::wxColour (const wxColour
* col
)
62 m_green
= col
->m_green
;
64 m_isInit
= col
->m_isInit
;
66 m_pixel
= col
->m_pixel
;
69 wxColour
& wxColour::operator =(const wxColour
& col
)
72 m_green
= col
.m_green
;
74 m_isInit
= col
.m_isInit
;
76 m_pixel
= col
.m_pixel
;
81 void wxColour::InitFromName(const wxString
& col
)
83 wxColour
*the_colour
= wxTheColourDatabase
->FindColour (col
);
86 m_red
= the_colour
->Red ();
87 m_green
= the_colour
->Green ();
88 m_blue
= the_colour
->Blue ();
99 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
) ;
102 wxColour::~wxColour ()
106 void wxColour::Set (unsigned char r
, unsigned char g
, unsigned char b
)
113 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
) ;