]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/carbon/colour.cpp
we're always compositing
[wxWidgets.git] / src / mac / carbon / colour.cpp
... / ...
CommitLineData
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#ifndef WX_PRECOMP
17 #include "wx/gdicmn.h"
18#endif
19
20#include "wx/mac/private.h"
21
22IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
23
24static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green );
25static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green )
26{
27 RGBColor* col = (RGBColor*) color;
28 col->red = (red << 8) + red;
29 col->blue = (blue << 8) + blue;
30 col->green = (green << 8) + green;
31}
32
33void wxColour::Init()
34{
35 m_isInit = false;
36 m_red =
37 m_blue =
38 m_green = 0;
39
40 wxComposeRGBColor( &m_pixel, m_red, m_blue, m_green );
41}
42
43wxColour::~wxColour ()
44{
45}
46
47void wxColour::InitWith (unsigned char r, unsigned char g, unsigned char b)
48{
49 m_red = r;
50 m_green = g;
51 m_blue = b;
52 m_isInit = true;
53
54 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green );
55}
56
57void wxColour::FromRGBColor( const WXCOLORREF* color )
58{
59 RGBColor* col = (RGBColor*) color;
60 memcpy( &m_pixel, color, 6 );
61 m_red = col->red >> 8;
62 m_blue = col->blue >> 8;
63 m_green = col->green >> 8;
64}