Open Inventor Release 2023.2.2
 
Loading...
Searching...
No Matches
SbColorRGBA.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2018 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25#ifndef _SB_COLORRGBA_H_
26#define _SB_COLORRGBA_H_
27
28#include <Inventor/SbLinear.h>
29
30
32//
33// Class: SbColorRGBA
34//
35// 4D vector used to represent an RGBA color. Each component of the vector is
36// a floating-point number between 0.0 and 1.0 .
37//
39
40class SbColorRGBA;
41
61class SbColorRGBA : public SbVec4f {
62 public:
67
71 SbColorRGBA(const SbVec4f vec4f)
72 { setValue(vec4f.getValue()); }
73
77 SbColorRGBA(const float rgba[4])
78 { setValue(rgba); }
79
83 SbColorRGBA(float r, float g, float b, float a)
84 { setValue(r, g, b, a); }
85
89 SbColorRGBA (uint32_t orderedRGBA);
90
106 SbColorRGBA &setPackedValue(uint32_t orderedRGBA);
107
112 uint32_t getPackedValue() const;
113
120 SbColorRGBA & setHSVAValue(float h, float s, float v, float a);
121
126 SbColorRGBA & setHSVAValue(const float hsva[4])
127 { return setHSVAValue(hsva[0], hsva[1], hsva[2], hsva[3]); }
128
133 void getHSVAValue(float &h, float &s, float &v, float& a) const;
134
139 void getHSVAValue(float hsva[4]) const
140 { getHSVAValue(hsva[0], hsva[1], hsva[2], hsva[3]); }
141
142private:
143
145 static void initClass();
146
148 static void exitClass();
149
165 SbColorRGBA &setLEPackedValue(uint32_t littleEndianRGBA);
166
167};
168
169#endif /* _SB_COLORRGBA_H_ */
170
171
ColorRGBA vector class.
Definition SbColorRGBA.h:61
SbColorRGBA & setPackedValue(uint32_t orderedRGBA)
Sets value of color vector from an RGBA packed color value.
SbColorRGBA(float r, float g, float b, float a)
Constructor that takes an RGBA value as 4 floats.
Definition SbColorRGBA.h:83
SbColorRGBA & setHSVAValue(float h, float s, float v, float a)
Sets value of color vector from an HSV (Hue, Saturation, and Value) plus Alpha color value.
SbColorRGBA & setHSVAValue(const float hsva[4])
Sets value of color vector from an HSV (Hue, Saturation, and Value) plus Alpha color value.
void getHSVAValue(float hsva[4]) const
Returns color value in the HSV (hue, saturation and value) plus Alpha color space.
SbColorRGBA(const SbVec4f vec4f)
Constructor that takes an RGBA vector value.
Definition SbColorRGBA.h:71
SbColorRGBA()
Default constructor.
uint32_t getPackedValue() const
Returns an RGBA packed color value, derived from the color vector.
SbColorRGBA(const float rgba[4])
Constructor that takes an RGBA value as an array of 4 floats.
Definition SbColorRGBA.h:77
void getHSVAValue(float &h, float &s, float &v, float &a) const
Returns color value in the HSV (hue, saturation and value) plus Alpha color space.
SbColorRGBA(uint32_t orderedRGBA)
Constructor that takes an RGBA value as a packed color.
4D vector class.
Definition SbVec.h:2214
SbVec4f & setValue(const float v[4])
Sets the vector components.
const float * getValue() const
Returns vector components.
Definition SbVec.h:2246