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

SbColor4f.h
00001 #ifndef COIN_SBCOLOR4F_H
00002 #define COIN_SBCOLOR4F_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) by Kongsberg Oil & Gas Technologies.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Kongsberg Oil & Gas Technologies
00018  *  about acquiring a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/system/inttypes.h>
00028 #include <Inventor/SbVec4f.h>
00029 #include <Inventor/SbColor.h>
00030 
00031 class SbVec4f;
00032 
00033 class COIN_DLL_API SbColor4f : public SbVec4f {
00034 public:
00035   SbColor4f(void);
00036   SbColor4f(const SbColor &rgb, const float alpha);
00037   SbColor4f(const SbVec4f& v);
00038   SbColor4f(const float* const rgba);
00039   SbColor4f(const float r, const float g, const float b, const float a = 1.0f);
00040 
00041   void setValue(const float r, const float g, const float b,
00042                 const float a = 1.0f);
00043   void setValue(const float col[4]);
00044   const float *getValue() const;
00045   void getValue(float &r, float &g, float &b, float &a);
00046 
00047   SbColor4f& setRGB(const SbColor &col);
00048   void getRGB(SbColor &color);
00049   SbColor4f& setHSVValue(float h, float s, float v, float a = 1.0f);
00050   SbColor4f& setHSVValue(const float hsv[3], float alpha = 1.0f);
00051   void getHSVValue(float &h, float &s, float &v) const;
00052   void getHSVValue(float hsv[3]) const;
00053   SbColor4f& setPackedValue(const uint32_t rgba);
00054   uint32_t getPackedValue() const;
00055 
00056   float operator[](const int idx) const;
00057   float &operator[](const int idx);
00058 
00059   SbColor4f &operator*=(const float d);
00060   SbColor4f &operator/=(const float d);
00061   SbColor4f &operator+=(const SbColor4f &c);
00062   SbColor4f &operator-=(const SbColor4f &c);
00063 
00064   friend COIN_DLL_API SbColor4f operator *(const SbColor4f &c, const float d);
00065   friend COIN_DLL_API SbColor4f operator *(const float d, const SbColor4f &c);
00066   friend COIN_DLL_API SbColor4f operator /(const SbColor4f &c, const float d);
00067   friend COIN_DLL_API SbColor4f operator +(const SbColor4f &v1, const SbColor4f &v2);
00068   friend COIN_DLL_API SbColor4f operator -(const SbColor4f &v1, const SbColor4f &v2);
00069   friend COIN_DLL_API int operator ==(const SbColor4f &v1, const SbColor4f &v2);
00070   friend COIN_DLL_API int operator !=(const SbColor4f &v1, const SbColor4f &v2);
00071 
00072 private:
00073   float red() const { return this->vec[0]; }
00074   float green() const { return this->vec[1]; }
00075   float blue() const { return this->vec[2]; }
00076   float alpha() const { return this->vec[3]; }
00077 };
00078 
00079 COIN_DLL_API SbColor4f operator *(const SbColor4f &c, const float d);
00080 COIN_DLL_API SbColor4f operator *(const float d, const SbColor4f &c);
00081 COIN_DLL_API SbColor4f operator /(const SbColor4f &c, const float d);
00082 COIN_DLL_API SbColor4f operator +(const SbColor4f &v1, const SbColor4f &v2);
00083 COIN_DLL_API SbColor4f operator -(const SbColor4f &v1, const SbColor4f &v2);
00084 COIN_DLL_API int operator ==(const SbColor4f &v1, const SbColor4f &v2);
00085 COIN_DLL_API int operator !=(const SbColor4f &v1, const SbColor4f &v2);
00086 
00087 typedef class SbColor4f SbColorRGBA; // TGS compatibility
00088 
00089 #endif // !COIN_SBCOLOR4F_H

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Thu Apr 28 2011 03:43:02 for Coin by Doxygen 1.7.4.