Coin Logo http://www.sim.no
http://www.coin3d.org

SbColor4f.h
1 #ifndef COIN_SBCOLOR4F_H
2 #define COIN_SBCOLOR4F_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <Inventor/system/inttypes.h>
28 #include <Inventor/SbColor.h>
29 
30 class SbVec4f;
31 
32 class COIN_DLL_API SbColor4f {
33 public:
34  SbColor4f(void);
35  SbColor4f(const SbColor &rgb, const float alpha);
36  SbColor4f(const SbVec4f& v);
37  SbColor4f(const float* const rgba);
38  SbColor4f(const float r, const float g, const float b, const float a = 1.0f);
39 
40  void setValue(const float r, const float g, const float b,
41  const float a = 1.0f);
42  void setValue(const float col[4]);
43  const float *getValue() const;
44  void getValue(float &r, float &g, float &b, float &a);
45 
46 
47  SbColor4f& setRGB(const SbColor &col);
48  void getRGB(SbColor &color);
49  SbColor4f& setHSVValue(float h, float s, float v, float a = 1.0f);
50  SbColor4f& setHSVValue(const float hsv[3], float alpha = 1.0f);
51  void getHSVValue(float &h, float &s, float &v) const;
52  void getHSVValue(float hsv[3]) const;
53  SbColor4f& setPackedValue(const uint32_t rgba);
54  uint32_t getPackedValue() const;
55 
56  float operator[](const int idx) const;
57  float &operator[](const int idx);
58 
59  SbColor4f &operator*=(const float d);
60  SbColor4f &operator/=(const float d);
61  SbColor4f &operator+=(const SbColor4f &c);
62  SbColor4f &operator-=(const SbColor4f &c);
63 
64  friend COIN_DLL_API SbColor4f operator *(const SbColor4f &c, const float d);
65  friend COIN_DLL_API SbColor4f operator *(const float d, const SbColor4f &c);
66  friend COIN_DLL_API SbColor4f operator /(const SbColor4f &c, const float d);
67  friend COIN_DLL_API SbColor4f operator +(const SbColor4f &v1, const SbColor4f &v2);
68  friend COIN_DLL_API SbColor4f operator -(const SbColor4f &v1, const SbColor4f &v2);
69  friend COIN_DLL_API int operator ==(const SbColor4f &v1, const SbColor4f &v2);
70  friend COIN_DLL_API int operator !=(const SbColor4f &v1, const SbColor4f &v2);
71 
72 private:
73  float vec[4];
74  float red() const { return this->vec[0]; }
75  float green() const { return this->vec[1]; }
76  float blue() const { return this->vec[2]; }
77  float alpha() const { return this->vec[3]; }
78 };
79 
80 COIN_DLL_API SbColor4f operator *(const SbColor4f &c, const float d);
81 COIN_DLL_API SbColor4f operator *(const float d, const SbColor4f &c);
82 COIN_DLL_API SbColor4f operator /(const SbColor4f &c, const float d);
83 COIN_DLL_API SbColor4f operator +(const SbColor4f &v1, const SbColor4f &v2);
84 COIN_DLL_API SbColor4f operator -(const SbColor4f &v1, const SbColor4f &v2);
85 COIN_DLL_API int operator ==(const SbColor4f &v1, const SbColor4f &v2);
86 COIN_DLL_API int operator !=(const SbColor4f &v1, const SbColor4f &v2);
87 
88 #endif // !COIN_SBCOLOR4F_H
SbColor::getHSVValue
void getHSVValue(float &h, float &s, float &v) const
Definition: SbColor.cpp:181
SbColor::setHSVValue
SbColor & setHSVValue(float h, float s, float v)
Definition: SbColor.cpp:129
SbColor4f::setRGB
SbColor4f & setRGB(const SbColor &col)
Definition: SbColor4f.cpp:198
SbTime::operator+
SbTime operator+(const SbTime &t0, const SbTime &t1)
Definition: SbTime.cpp:762
SbColor4f::getRGB
void getRGB(SbColor &color)
Definition: SbColor4f.cpp:210
SbColor4f
The SbColor4f class contains the red, green, blue and alpha components which make up a color value.
Definition: SbColor4f.h:32
SbTime::operator/
SbTime operator/(const SbTime &tm, const double s)
Definition: SbTime.cpp:841
SoDebugError::postWarning
static void postWarning(const char *const source, const char *const format,...)
Definition: SoDebugError.cpp:324
SbColor4f::setHSVValue
SbColor4f & setHSVValue(float h, float s, float v, float a=1.0f)
Definition: SbColor4f.cpp:225
SbBox2s::operator!=
int operator!=(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.cpp:443
SbColor4f::setPackedValue
SbColor4f & setPackedValue(const uint32_t rgba)
Definition: SbColor4f.cpp:171
SbColor4f::operator-=
SbColor4f & operator-=(const SbColor4f &c)
Definition: SbColor4f.cpp:375
SbColor
The SbColor class contains the red, green and blue components which make up a color value.
Definition: SbColor.h:30
SbColor4f::getPackedValue
uint32_t getPackedValue() const
Definition: SbColor4f.cpp:185
SbColor4f::setValue
void setValue(const float r, const float g, const float b, const float a=1.0f)
Definition: SbColor4f.cpp:118
SbBox2s::operator==
int operator==(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.cpp:432
SbColor4f::getHSVValue
void getHSVValue(float &h, float &s, float &v) const
Definition: SbColor4f.cpp:277
SbColor4f::getValue
const float * getValue() const
Definition: SbColor4f.cpp:145
SbColor4f::operator+=
SbColor4f & operator+=(const SbColor4f &c)
Definition: SbColor4f.cpp:363
SbColor4f::operator/=
SbColor4f & operator/=(const float d)
Definition: SbColor4f.cpp:351
SbColor4f::operator*=
SbColor4f & operator*=(const float d)
Definition: SbColor4f.cpp:338
SbColor4f::SbColor4f
SbColor4f(void)
Definition: SbColor4f.cpp:59
SbMatrix::operator*
SbMatrix operator*(const SbMatrix &m1, const SbMatrix &m2)
Definition: SbMatrix.cpp:690
SbColor4f::operator[]
float operator[](const int idx) const
Definition: SbColor4f.cpp:317
SbVec4f
The SbVec4f class is a 4 dimensional vector with floating point coordinates.
Definition: SbVec4f.h:34
SbTime::operator-
SbTime operator-(const SbTime &t0, const SbTime &t1)
Definition: SbTime.cpp:775

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Mon Jul 27 2020 for Coin by Doxygen. 1.8.18