]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/colour.cpp
Suppress assertion when the array is sorted
[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
40989e46
WS
16#include "wx/gdicmn.h"
17
76a5e5d2
SC
18#include "wx/mac/private.h"
19
172da31f
DS
20IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
21
22static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green );
aad6765c 23static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green )
519cb848 24{
172da31f 25 RGBColor* col = (RGBColor*) color;
e40298d5
JS
26 col->red = (red << 8) + red;
27 col->blue = (blue << 8) + blue;
28 col->green = (green << 8) + green;
519cb848
SC
29}
30
564a150b 31void wxColour::Init()
e9576ca5 32{
aad6765c 33 m_isInit = false;
564a150b
VZ
34 m_red =
35 m_blue =
36 m_green = 0;
aad6765c 37
172da31f 38 wxComposeRGBColor( &m_pixel, m_red, m_blue, m_green );
e9576ca5
SC
39}
40
e9576ca5
SC
41wxColour::~wxColour ()
42{
43}
44
40989e46 45void wxColour::InitWith (unsigned char r, unsigned char g, unsigned char b)
e9576ca5
SC
46{
47 m_red = r;
48 m_green = g;
49 m_blue = b;
aad6765c 50 m_isInit = true;
519cb848 51
172da31f 52 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green );
e9576ca5 53}
76a5e5d2 54
f61ed7ee 55void wxColour::FromRGBColor( const WXCOLORREF* color )
aad6765c 56{
172da31f
DS
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;
d84afea9 62}