]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/colour.cpp
use WX_DEFINE_ARRAY_INT for an array of ints (bug 1536482)
[wxWidgets.git] / src / mac / carbon / colour.cpp
CommitLineData
e9576ca5 1/////////////////////////////////////////////////////////////////////////////
edc536d3 2// Name: src/mac/carbon/colour.cpp
e9576ca5 3// Purpose: wxColour class
a31a5f85 4// Author: Stefan Csomor
e9576ca5 5// Modified by:
a31a5f85 6// Created: 1998-01-01
e9576ca5 7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
edc536d3 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
a8e9860d
SC
12#include "wx/wxprec.h"
13
e9576ca5
SC
14#include "wx/colour.h"
15
dd05139a
WS
16#ifndef WX_PRECOMP
17 #include "wx/gdicmn.h"
18#endif
40989e46 19
76a5e5d2
SC
20#include "wx/mac/private.h"
21
172da31f
DS
22IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
23
24static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green );
aad6765c 25static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green )
519cb848 26{
172da31f 27 RGBColor* col = (RGBColor*) color;
e40298d5
JS
28 col->red = (red << 8) + red;
29 col->blue = (blue << 8) + blue;
30 col->green = (green << 8) + green;
519cb848
SC
31}
32
564a150b 33void wxColour::Init()
e9576ca5 34{
aad6765c 35 m_isInit = false;
564a150b
VZ
36 m_red =
37 m_blue =
38 m_green = 0;
aad6765c 39
172da31f 40 wxComposeRGBColor( &m_pixel, m_red, m_blue, m_green );
e9576ca5
SC
41}
42
e9576ca5
SC
43wxColour::~wxColour ()
44{
45}
46
aea95b1c 47void wxColour::InitRGBA (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
e9576ca5
SC
48{
49 m_red = r;
50 m_green = g;
51 m_blue = b;
fa8bc37b 52 m_alpha = a ;
aad6765c 53 m_isInit = true;
519cb848 54
172da31f 55 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green );
e9576ca5 56}
76a5e5d2 57
f61ed7ee 58void wxColour::FromRGBColor( const WXCOLORREF* color )
aad6765c 59{
172da31f
DS
60 RGBColor* col = (RGBColor*) color;
61 memcpy( &m_pixel, color, 6 );
62 m_red = col->red >> 8;
63 m_blue = col->blue >> 8;
64 m_green = col->green >> 8;
d84afea9 65}