![]() |
http://www.sim.no http://www.coin3d.org |
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) 1998-2007 by Systems in Motion. All rights reserved. 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 Systems in Motion about acquiring 00018 * a Coin Professional Edition License. 00019 * 00020 * See http://www.coin3d.org/ for more information. 00021 * 00022 * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, 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/SbColor.h> 00029 00030 class SbVec4f; 00031 00032 class COIN_DLL_API SbColor4f { 00033 public: 00034 SbColor4f(void); 00035 SbColor4f(const SbColor &rgb, const float alpha); 00036 SbColor4f(const SbVec4f& v); 00037 SbColor4f(const float* const rgba); 00038 SbColor4f(const float r, const float g, const float b, const float a = 1.0f); 00039 00040 void setValue(const float r, const float g, const float b, 00041 const float a = 1.0f); 00042 void setValue(const float col[4]); 00043 const float *getValue() const; 00044 void getValue(float &r, float &g, float &b, float &a); 00045 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 vec[4]; 00074 float red() const { return this->vec[0]; } 00075 float green() const { return this->vec[1]; } 00076 float blue() const { return this->vec[2]; } 00077 float alpha() const { return this->vec[3]; } 00078 }; 00079 00080 COIN_DLL_API SbColor4f operator *(const SbColor4f &c, const float d); 00081 COIN_DLL_API SbColor4f operator *(const float d, const SbColor4f &c); 00082 COIN_DLL_API SbColor4f operator /(const SbColor4f &c, const float d); 00083 COIN_DLL_API SbColor4f operator +(const SbColor4f &v1, const SbColor4f &v2); 00084 COIN_DLL_API SbColor4f operator -(const SbColor4f &v1, const SbColor4f &v2); 00085 COIN_DLL_API int operator ==(const SbColor4f &v1, const SbColor4f &v2); 00086 COIN_DLL_API int operator !=(const SbColor4f &v1, const SbColor4f &v2); 00087 00088 #endif // !COIN_SBCOLOR4F_H
Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.
Generated on Mon Feb 28 2011 10:11:52 for Coin by Doxygen. 1.7.3