QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_color.h
Go to the documentation of this file.
1/* $NoKeywords: $ */
2/*
3//
4// Copyright (c) 1993-2007 Robert McNeel & Associates. All rights reserved.
5// Rhinoceros is a registered trademark of Robert McNeel & Assoicates.
6//
7// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9// MERCHANTABILITY ARE HEREBY DISCLAIMED.
10//
11// For complete openNURBS copyright information see <http://www.opennurbs.org>.
12//
14*/
15
16#if !defined(OPENNURBS_COLOR_INC_)
17#define OPENNURBS_COLOR_INC_
18
20//
21// Class ON_Color
22//
24{
25public:
26 // Constructors & Conversions - also default copy and assignment
27
28 static const ON_Color UnsetColor; // 0xFFFFFFFF
29
30 // Default is black
31 ON_Color();
32
34 int red, // ( 0 to 255 )
35 int green, // ( 0 to 255 )
36 int blue // ( 0 to 255 )
37 );
38
40 int red, // ( 0 to 255 )
41 int green, // ( 0 to 255 )
42 int blue, // ( 0 to 255 )
43 int alpha // ( 0 to 255 )
44 );
45
46 // Construct from COLORREF
47 ON_Color(unsigned int);
48
49 // Conversion to COLORREF
50 operator unsigned int() const;
51
52 // < 0 if this < arg, 0 ir this==arg, > 0 if this > arg
53 int Compare( const ON_Color& ) const;
54
55 int Red() const; // ( 0 to 255 )
56 int Green() const; // ( 0 to 255 )
57 int Blue() const; // ( 0 to 255 )
58 int Alpha() const; // ( 0 to 255 )
59
60 double FractionRed() const; // ( 0.0 to 1.0 )
61 double FractionGreen() const; // ( 0.0 to 1.0 )
62 double FractionBlue() const; // ( 0.0 to 1.0 )
63 double FractionAlpha() const; // ( 0.0 to 1.0 )
64
65 void SetRGB(
66 int red, // red in range 0 to 255
67 int green, // green in range 0 to 255
68 int blue // blue in range 0 to 255
69 );
70
71 void SetFractionalRGB(
72 double red, // red in range 0.0 to 1.0
73 double green, // green in range 0.0 to 1.0
74 double blue // blue in range 0.0 to 1.0
75 );
76
77 void SetAlpha(
78 int alpha // alpha in range 0 to 255
79 );
80
81 void SetFractionalAlpha(
82 double alpha // alpha in range 0.0 to 1.0
83 );
84
85 void SetRGBA(
86 int red, // red in range 0 to 255
87 int green, // green in range 0 to 255
88 int blue, // blue in range 0 to 255
89 int alpha // alpha in range 0 to 255
90 );
91
92 // input args
93 void SetFractionalRGBA(
94 double red, // red in range 0.0 to 1.0
95 double green, // green in range 0.0 to 1.0
96 double blue, // blue in range 0.0 to 1.0
97 double alpha // alpha in range 0.0 to 1.0
98 );
99
100 // Hue() returns an angle in the range 0 to 2*pi
101 //
102 // 0 = red, pi/3 = yellow, 2*pi/3 = green,
103 // pi = cyan, 4*pi/3 = blue,5*pi/3 = magenta,
104 // 2*pi = red
105 double Hue() const;
106
107 // Returns 0.0 (gray) to 1.0 (saturated)
108 double Saturation() const;
109
110 // Returns 0.0 (black) to 1.0 (white)
111 double Value() const;
112
113 void SetHSV(
114 double h, // hue in radians 0 to 2*pi
115 double s, // satuation 0.0 = gray, 1.0 = saturated
116 double v // value
117 );
118
119private:
120 // m_color is in Windows COLORREF format.
121 //
122 // 0x00bbggrr, rr= red component 0-255, etc. (little endian order)
123 unsigned int m_color;
124};
125
126#endif
Definition opennurbs_color.h:24
static const ON_Color UnsetColor
Definition opennurbs_color.h:28
unsigned int m_color
Definition opennurbs_color.h:123
#define ON_CLASS
Definition opennurbs_defines.h:91
char s
Definition opennurbs_string.cpp:32