]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/colour.cpp
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     wxColour class 
   4 // Author:      Stefan Csomor 
   8 // Copyright:   (c) Stefan Csomor 
   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 #include "wx/mac/private.h" 
  27 static void wxComposeRGBColor( WXCOLORREF
* color 
, int red
, int blue
, int green 
) ; 
  28 static void wxComposeRGBColor( WXCOLORREF
* color 
, int red
, int blue
, int green 
) 
  30     RGBColor
* col 
= (RGBColor
*) color 
; 
  31     col
->red 
= (red 
<< 8) + red
; 
  32     col
->blue 
= (blue 
<< 8) + blue
; 
  33     col
->green 
= (green 
<< 8) + green
; 
  43     wxComposeRGBColor( &m_pixel 
, m_red 
, m_blue 
, m_green 
) ; 
  46 wxColour::wxColour (const wxColour
& col
) 
  50     m_green 
= col
.m_green
; 
  52     m_isInit 
= col
.m_isInit
; 
  54     memcpy( &m_pixel 
, &col
.m_pixel 
, 6 ) ; 
  57 wxColour::wxColour (const wxColour
* col
) 
  60     m_green 
= col
->m_green
; 
  62     m_isInit 
= col
->m_isInit
; 
  64     memcpy( &m_pixel 
, &col
->m_pixel 
, 6 ) ; 
  67 wxColour
& wxColour::operator =(const wxColour
& col
) 
  70     m_green 
= col
.m_green
; 
  72     m_isInit 
= col
.m_isInit
; 
  74     memcpy( &m_pixel 
, &col
.m_pixel 
, 6 ) ; 
  79 void wxColour::InitFromName(const wxString
& name
) 
  81     if ( wxTheColourDatabase 
) 
  83         wxColour col 
= wxTheColourDatabase
->Find(name
); 
  95 wxColour::~wxColour () 
  99 void wxColour::Set (unsigned char r
, unsigned char g
, unsigned char b
) 
 106     wxComposeRGBColor( &m_pixel 
, m_red 
, m_blue 
, m_green 
) ; 
 109 void wxColour::Set( const WXCOLORREF
* color 
) 
 111     RGBColor
* col 
= (RGBColor
*) color 
; 
 112     memcpy( &m_pixel 
, color 
, 6 ) ; 
 113     m_red 
= col
->red
>>8 ; 
 114     m_blue 
= col
->blue
>>8 ; 
 115     m_green 
= col
->green
>>8 ;