]> git.saurik.com Git - wxWidgets.git/blob - src/osx/cocoa/colour.mm
Spell contributor name correctly.
[wxWidgets.git] / src / osx / cocoa / colour.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/cocoa/colour.mm
3 // Purpose: Cocoa additions to wxColour class
4 // Author: Kevin Ollivier
5 // Modified by:
6 // Created: 2009-10-31
7 // RCS-ID: $Id: colour.cpp 61724 2009-08-21 10:41:26Z VZ $
8 // Copyright: (c) Kevin Ollivier
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/osx/private.h"
21
22 #if wxOSX_USE_COCOA
23 wxColour::wxColour(WX_NSColor col)
24 {
25 size_t noComp = [col numberOfComponents];
26
27 CGFloat *components = NULL;
28 if ( noComp >= 1 && noComp <= 4 )
29 {
30 // TODO verify whether we really are on a RGB color space
31 m_alpha = wxALPHA_OPAQUE;
32 [col getComponents: components];
33 }
34 InitFromComponents(const_cast<const CGFloat*>(components), noComp);
35 }
36
37 WX_NSColor wxColour::OSXGetNSColor()
38 {
39 return [NSColor colorWithDeviceRed:m_red / 255.0 green:m_green / 255.0 blue:m_blue / 255.0 alpha:m_alpha / 255.0];
40 }
41 #endif