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