]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/colour.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/classic/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 IMPLEMENT_DYNAMIC_CLASS(wxColour
, wxObject
)
22 #include "wx/mac/private.h"
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 (const wxColour
& col
)
47 m_green
= col
.m_green
;
49 m_isInit
= col
.m_isInit
;
51 memcpy( &m_pixel
, &col
.m_pixel
, 6 ) ;
54 wxColour::wxColour (const wxColour
* col
)
57 m_green
= col
->m_green
;
59 m_isInit
= col
->m_isInit
;
61 memcpy( &m_pixel
, &col
->m_pixel
, 6 ) ;
64 wxColour
& wxColour::operator =(const wxColour
& col
)
67 m_green
= col
.m_green
;
69 m_isInit
= col
.m_isInit
;
71 memcpy( &m_pixel
, &col
.m_pixel
, 6 ) ;
76 wxColour::~wxColour ()
80 void wxColour::InitWith (unsigned char r
, unsigned char g
, unsigned char b
)
87 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
) ;
90 void wxColour::Set( const WXCOLORREF
* color
)
92 RGBColor
* col
= (RGBColor
*) color
;
93 memcpy( &m_pixel
, color
, 6 ) ;
95 m_blue
= col
->blue
>>8 ;
96 m_green
= col
->green
>>8 ;