]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/mac/carbon/colour.cpp | |
3 | // Purpose: wxColour class | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/wxprec.h" | |
13 | ||
14 | #include "wx/colour.h" | |
15 | ||
16 | #include "wx/gdicmn.h" | |
17 | ||
18 | #include "wx/mac/private.h" | |
19 | ||
20 | IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) | |
21 | ||
22 | static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green ); | |
23 | static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green ) | |
24 | { | |
25 | RGBColor* col = (RGBColor*) color; | |
26 | col->red = (red << 8) + red; | |
27 | col->blue = (blue << 8) + blue; | |
28 | col->green = (green << 8) + green; | |
29 | } | |
30 | ||
31 | void wxColour::Init() | |
32 | { | |
33 | m_isInit = false; | |
34 | m_red = | |
35 | m_blue = | |
36 | m_green = 0; | |
37 | ||
38 | wxComposeRGBColor( &m_pixel, m_red, m_blue, m_green ); | |
39 | } | |
40 | ||
41 | wxColour::~wxColour () | |
42 | { | |
43 | } | |
44 | ||
45 | void wxColour::InitWith (unsigned char r, unsigned char g, unsigned char b) | |
46 | { | |
47 | m_red = r; | |
48 | m_green = g; | |
49 | m_blue = b; | |
50 | m_isInit = true; | |
51 | ||
52 | wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ); | |
53 | } | |
54 | ||
55 | void wxColour::FromRGBColor( const WXCOLORREF* color ) | |
56 | { | |
57 | RGBColor* col = (RGBColor*) color; | |
58 | memcpy( &m_pixel, color, 6 ); | |
59 | m_red = col->red >> 8; | |
60 | m_blue = col->blue >> 8; | |
61 | m_green = col->green >> 8; | |
62 | } |