]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/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 #if !USE_SHARED_LIBRARY
20 IMPLEMENT_DYNAMIC_CLASS(wxColour
, wxObject
)
25 static void wxComposeRGBColor( RGBColor
* col
, int red
, int blue
, int green
) ;
26 static void wxComposeRGBColor( RGBColor
* col
, int red
, int blue
, int green
)
28 col
->red
= (red
<< 8) + red
;
29 col
->blue
= (blue
<< 8) + blue
;
30 col
->green
= (green
<< 8) + green
;
36 m_red
= m_blue
= m_green
= 0;
38 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
) ;
41 wxColour::wxColour (unsigned char r
, unsigned char g
, unsigned char b
)
48 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
) ;
51 wxColour::wxColour (const wxColour
& col
)
54 m_green
= col
.m_green
;
56 m_isInit
= col
.m_isInit
;
58 m_pixel
= col
.m_pixel
;
61 wxColour::wxColour (const wxColour
* col
)
64 m_green
= col
->m_green
;
66 m_isInit
= col
->m_isInit
;
68 m_pixel
= col
->m_pixel
;
71 wxColour
& wxColour::operator =(const wxColour
& col
)
74 m_green
= col
.m_green
;
76 m_isInit
= col
.m_isInit
;
78 m_pixel
= col
.m_pixel
;
83 void wxColour::InitFromName(const wxString
& col
)
85 wxColour
*the_colour
= wxTheColourDatabase
->FindColour (col
);
88 m_red
= the_colour
->Red ();
89 m_green
= the_colour
->Green ();
90 m_blue
= the_colour
->Blue ();
101 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
) ;
104 wxColour::~wxColour ()
108 void wxColour::Set (unsigned char r
, unsigned char g
, unsigned char b
)
115 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
) ;