]>
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"
17 #include "wx/gdicmn.h"
20 IMPLEMENT_DYNAMIC_CLASS(wxColour
, wxObject
)
24 #include "wx/mac/private.h"
26 static void wxComposeRGBColor( WXCOLORREF
* color
, int red
, int blue
, int green
) ;
27 static void wxComposeRGBColor( WXCOLORREF
* color
, int red
, int blue
, int green
)
29 RGBColor
* col
= (RGBColor
*) color
;
30 col
->red
= (red
<< 8) + red
;
31 col
->blue
= (blue
<< 8) + blue
;
32 col
->green
= (green
<< 8) + green
;
42 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
) ;
45 wxColour::wxColour (const wxColour
& col
)
49 m_green
= col
.m_green
;
51 m_isInit
= col
.m_isInit
;
53 memcpy( &m_pixel
, &col
.m_pixel
, 6 ) ;
56 wxColour::wxColour (const wxColour
* col
)
59 m_green
= col
->m_green
;
61 m_isInit
= col
->m_isInit
;
63 memcpy( &m_pixel
, &col
->m_pixel
, 6 ) ;
66 wxColour
& wxColour::operator =(const wxColour
& col
)
69 m_green
= col
.m_green
;
71 m_isInit
= col
.m_isInit
;
73 memcpy( &m_pixel
, &col
.m_pixel
, 6 ) ;
78 wxColour::~wxColour ()
82 void wxColour::InitWith (unsigned char r
, unsigned char g
, unsigned char b
)
89 wxComposeRGBColor( &m_pixel
, m_red
, m_blue
, m_green
) ;
92 void wxColour::Set( const WXCOLORREF
* color
)
94 RGBColor
* col
= (RGBColor
*) color
;
95 memcpy( &m_pixel
, color
, 6 ) ;
97 m_blue
= col
->blue
>>8 ;
98 m_green
= col
->green
>>8 ;