Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SbColor4f.h

00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) 1998-2002 by Systems in Motion. All rights reserved.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public License
00008  *  version 2.1 as published by the Free Software Foundation. See the
00009  *  file LICENSE.LGPL at the root directory of the distribution for
00010  *  more details.
00011  *
00012  *  If you want to use Coin for applications not compatible with the
00013  *  LGPL, please contact SIM to acquire a Professional Edition license.
00014  *
00015  *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
00016  *  http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097
00017  *
00018 \**************************************************************************/
00019 
00020 #ifndef COIN_SBCOLOR4F_H
00021 #define COIN_SBCOLOR4F_H
00022 
00023 #include <Inventor/system/inttypes.h>
00024 #include <Inventor/SbColor.h>
00025 
00026 class SbVec4f;
00027 
00028 class COIN_DLL_API SbColor4f {
00029 public:
00030   SbColor4f(void);
00031   SbColor4f(const SbColor &rgb, const float alpha);
00032   SbColor4f(const SbVec4f& v);
00033   SbColor4f(const float* const rgba);
00034   SbColor4f(const float r, const float g, const float b, const float a = 1.0f);
00035 
00036   void setValue(const float r, const float g, const float b,
00037                 const float a = 1.0f);
00038   void setValue(const float col[4]);
00039   const float *getValue() const;
00040   void getValue(float &r, float &g, float &b, float &a);
00041 
00042 
00043   SbColor4f& setRGB(const SbColor &col);
00044   void getRGB(SbColor &color);
00045   SbColor4f& setHSVValue(float h, float s, float v, float a = 1.0f);
00046   SbColor4f& setHSVValue(const float hsv[3], float alpha = 1.0f);
00047   void getHSVValue(float &h, float &s, float &v) const;
00048   void getHSVValue(float hsv[3]) const;
00049   SbColor4f& setPackedValue(const uint32_t rgba);
00050   uint32_t getPackedValue() const;
00051 
00052   float operator[](const int idx) const;
00053   float &operator[](const int idx);
00054 
00055   SbColor4f &operator*=(const float d);
00056   SbColor4f &operator/=(const float d);
00057   SbColor4f &operator+=(const SbColor4f &c);
00058   SbColor4f &operator-=(const SbColor4f &c);
00059 
00060   friend COIN_DLL_API SbColor4f operator *(const SbColor4f &c, const float d);
00061   friend COIN_DLL_API SbColor4f operator *(const float d, const SbColor4f &c);
00062   friend COIN_DLL_API SbColor4f operator /(const SbColor4f &c, const float d);
00063   friend COIN_DLL_API SbColor4f operator +(const SbColor4f &v1, const SbColor4f &v2);
00064   friend COIN_DLL_API SbColor4f operator -(const SbColor4f &v1, const SbColor4f &v2);
00065   friend COIN_DLL_API int operator ==(const SbColor4f &v1, const SbColor4f &v2);
00066   friend COIN_DLL_API int operator !=(const SbColor4f &v1, const SbColor4f &v2);
00067 
00068 private:
00069   float vec[4];
00070   float red() const { return this->vec[0]; }
00071   float green() const { return this->vec[1]; }
00072   float blue() const { return this->vec[2]; }
00073   float alpha() const { return this->vec[3]; }
00074 };
00075 
00076 COIN_DLL_API SbColor4f operator *(const SbColor4f &c, const float d);
00077 COIN_DLL_API SbColor4f operator *(const float d, const SbColor4f &c);
00078 COIN_DLL_API SbColor4f operator /(const SbColor4f &c, const float d);
00079 COIN_DLL_API SbColor4f operator +(const SbColor4f &v1, const SbColor4f &v2);
00080 COIN_DLL_API SbColor4f operator -(const SbColor4f &v1, const SbColor4f &v2);
00081 COIN_DLL_API int operator ==(const SbColor4f &v1, const SbColor4f &v2);
00082 COIN_DLL_API int operator !=(const SbColor4f &v1, const SbColor4f &v2);
00083 
00084 #endif // !COIN_SBCOLOR4F_H

Generated at Tue Mar 5 03:31:11 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001