library of assembled shared sources |
http://lass.cocamware.com |
#include <color_rgba.h>
Public Types | |
enum | { dimension = 4 } |
typedef Vector4D< float > | TVector |
typedef TVector::TValue | TValue |
typedef TVector::TParam | TParam |
typedef TVector::TReference | TReference |
typedef TVector::TConstReference | TConstReference |
typedef TVector::TNumTraits | TNumTraits |
Public Member Functions | |
ColorRGBA () | |
construct an unexisting color (black with zero alpha) | |
ColorRGBA (TParam iRed, TParam iGreen, TParam iBlue, TParam iAlpha=ColorRGBA::TNumTraits::one) | |
construct a color with values for all channels | |
ColorRGBA (TParam iWhite, TParam iAlpha=ColorRGBA::TNumTraits::one) | |
construct a color in white range (r == g == b), with an alpha value | |
ColorRGBA (const TVector &iVector) | |
construct a color from a raw vector | |
const TVector | vector () const |
TConstReference | operator[] (unsigned iIndex) const |
TReference | operator[] (unsigned iIndex) |
TConstReference | at (signed iIndex) const |
TReference | at (signed iIndex) |
const ColorRGBA & | operator+ () const |
const ColorRGBA | operator- () const |
ColorRGBA & | operator+= (const ColorRGBA &iOther) |
raw addition of iOther to this color, including alpha channel | |
ColorRGBA & | operator-= (const ColorRGBA &iOther) |
raw subtraction iOther from this color, including alpha channel | |
ColorRGBA & | operator*= (const ColorRGBA &iOther) |
raw multiplication of iOther with this color, including alpha channel | |
ColorRGBA & | operator/= (const ColorRGBA &iOther) |
raw division of this color by iOther, including alpha channel | |
ColorRGBA & | operator+= (TParam iWhite) |
raw addition of iWhite to this color, including alpha channel | |
ColorRGBA & | operator-= (TParam iWhite) |
raw subtraction iWhite from this color, including alpha channel | |
ColorRGBA & | operator*= (TParam iWhite) |
raw multiplication of iWhite with this color, including alpha channel | |
ColorRGBA & | operator/= (TParam iWhite) |
raw division of this color by iWhite, including alpha channel | |
const TValue | brightness () const |
const bool | isBlack () const |
return true if all color components are zero | |
const bool | isZero () const |
return true if all components are zero | |
const bool | isNaN () const |
Return true if at least one of the components is NaN. | |
const ColorRGBA | darkened (TParam iFactor) const |
return darkened colour without changing the opaqueness. | |
const ColorRGBA | dissolved (TParam iFactor) const |
return color with dissolved opaqueness | |
const ColorRGBA | gammaCorrected (TParam iGamma) const |
return gamma corrected color. | |
const ColorRGBA | exposed (TParam iTime) const |
return exposed color. | |
const ColorRGBA | invExposed (TParam iTime) const |
return result of inverse exposure function | |
const ColorRGBA | clamped () const |
clamp all channels (including alpha channel) to the range [0, 1]. | |
Static Public Member Functions | |
static const ColorRGBA | mapAutumn (TParam iValue) |
convert a value in range [0, 1] to a color like in colormap 'autumn' of matlab. | |
static const ColorRGBA | mapBone (TParam iValue) |
convert a value in range [0, 1] to a color like in colormap 'bone' of matlab. | |
static const ColorRGBA | mapCool (TParam iValue) |
convert a value in range [0, 1] to a color like in colormap 'cool' of matlab. | |
static const ColorRGBA | mapCopper (TParam iValue) |
convert a value in range [0, 1] to a color like in colormap 'copper' of matlab. | |
static const ColorRGBA | mapGray (TParam iValue) |
convert a value in range [0, 1] to a color like in colormap 'gray' of matlab. | |
static const ColorRGBA | mapHot (TParam iValue) |
convert a value in range [0, 1] to a color like in colormap 'hot' of matlab. | |
static const ColorRGBA | mapHsv (TParam iValue) |
convert a value to a color like in colormap 'hsv' of matlab. | |
static const ColorRGBA | mapJet (TParam iValue) |
convert a value in range [0, 1] to a color like in colormap 'jet' of matlab. | |
static const ColorRGBA | mapPink (TParam iValue) |
convert a value in range [0, 1] to a color like in colormap 'pink' of matlab. | |
static const ColorRGBA | mapSpring (TParam iValue) |
convert a value in range [0, 1] to a color like in colormap 'spring' of matlab. | |
static const ColorRGBA | mapSummer (TParam iValue) |
convert a value in range [0, 1] to a color like in colormap 'summer' of matlab. | |
static const ColorRGBA | mapWinter (TParam iValue) |
convert a value in range [0, 1] to a color like in colormap 'winter' of matlab. | |
static const ColorRGBA | mapCustom (TParam iValue, const std::vector< ColorRGBA > &iColorMap) |
convert a value in range [0, 1] to a color from a custom color map. | |
Data Fields | |
TValue | r |
TValue | g |
TValue | b |
TValue | a |
Static Private Member Functions | |
static const ColorRGBA | doMap (TParam iValue, const ColorRGBA *iMap, int iMapSize) |
Related Functions | |
(Note that these are not member functions.) | |
ColorRGBA | operator+ (const ColorRGBA &iA, const ColorRGBA &iB) |
raw addition of iA and iB, including alpha channels | |
ColorRGBA | operator- (const ColorRGBA &iA, const ColorRGBA &iB) |
raw subtraction of iA and iB, including alpha channels | |
ColorRGBA | operator* (const ColorRGBA &iA, const ColorRGBA &iB) |
raw addition of iA and iB, including alpha channels | |
ColorRGBA | operator/ (const ColorRGBA &iA, const ColorRGBA &iB) |
raw addition of iA and iB, including alpha channels | |
ColorRGBA | operator+ (ColorRGBA::TParam iA, const ColorRGBA &iB) |
raw addition of iA and iB, including alpha channels | |
ColorRGBA | operator- (ColorRGBA::TParam iA, const ColorRGBA &iB) |
raw subtraction of iA and iB, including alpha channels | |
ColorRGBA | operator* (ColorRGBA::TParam iA, const ColorRGBA &iB) |
raw addition of iA and iB, including alpha channels | |
ColorRGBA | operator/ (ColorRGBA::TParam iA, const ColorRGBA &iB) |
raw addition of iA and iB, including alpha channels | |
ColorRGBA | operator+ (const ColorRGBA &iA, ColorRGBA::TParam iB) |
raw addition of iA and iB, including alpha channels | |
ColorRGBA | operator- (const ColorRGBA &iA, ColorRGBA::TParam iB) |
raw subtraction of iA and iB, including alpha channels | |
ColorRGBA | operator* (const ColorRGBA &iA, ColorRGBA::TParam iB) |
raw addition of iA and iB, including alpha channels | |
ColorRGBA | operator/ (const ColorRGBA &iA, ColorRGBA::TParam iB) |
raw addition of iA and iB, including alpha channels |
Definition at line 61 of file color_rgba.h.
typedef Vector4D<float> lass::prim::ColorRGBA::TVector |
Definition at line 65 of file color_rgba.h.
Definition at line 67 of file color_rgba.h.
Definition at line 68 of file color_rgba.h.
Definition at line 69 of file color_rgba.h.
Definition at line 70 of file color_rgba.h.
Definition at line 71 of file color_rgba.h.
anonymous enum |
lass::prim::ColorRGBA::ColorRGBA | ( | ) |
construct an unexisting color (black with zero alpha)
Definition at line 64 of file color_rgba.cpp.
References isZero(), and LASS_ASSERT.
Referenced by clamped(), exposed(), gammaCorrected(), invExposed(), mapAutumn(), mapBone(), mapCool(), mapCopper(), mapGray(), mapHot(), mapHsv(), mapJet(), mapPink(), mapSpring(), mapSummer(), and mapWinter().
lass::prim::ColorRGBA::ColorRGBA | ( | TParam | iRed, | |
TParam | iGreen, | |||
TParam | iBlue, | |||
TParam | iAlpha = ColorRGBA::TNumTraits::one | |||
) |
lass::prim::ColorRGBA::ColorRGBA | ( | TParam | iWhite, | |
TParam | iAlpha = ColorRGBA::TNumTraits::one | |||
) | [explicit] |
construct a color in white range (r == g == b), with an alpha value
Definition at line 89 of file color_rgba.cpp.
lass::prim::ColorRGBA::ColorRGBA | ( | const TVector & | iVector | ) | [explicit] |
const TVector lass::prim::ColorRGBA::vector | ( | ) | const [inline] |
Definition at line 88 of file color_rgba.h.
TConstReference lass::prim::ColorRGBA::operator[] | ( | unsigned | iIndex | ) | const [inline] |
Definition at line 89 of file color_rgba.h.
TReference lass::prim::ColorRGBA::operator[] | ( | unsigned | iIndex | ) | [inline] |
Definition at line 90 of file color_rgba.h.
TConstReference lass::prim::ColorRGBA::at | ( | signed | iIndex | ) | const [inline] |
TReference lass::prim::ColorRGBA::at | ( | signed | iIndex | ) | [inline] |
const ColorRGBA& lass::prim::ColorRGBA::operator+ | ( | ) | const |
const ColorRGBA lass::prim::ColorRGBA::operator- | ( | ) | const |
raw division of this color by iWhite, including alpha channel
Definition at line 204 of file color_rgba.cpp.
References a, b, g, lass::num::NumTraits< C >::one, and r.
const ColorRGBA::TValue lass::prim::ColorRGBA::brightness | ( | ) | const |
const bool lass::prim::ColorRGBA::isBlack | ( | ) | const |
return true if all color components are zero
Definition at line 225 of file color_rgba.cpp.
References b, g, r, and lass::num::NumTraits< C >::zero.
const bool lass::prim::ColorRGBA::isZero | ( | ) | const |
return true if all components are zero
Definition at line 234 of file color_rgba.cpp.
References a, b, g, r, and lass::num::NumTraits< C >::zero.
Referenced by ColorRGBA().
const bool lass::prim::ColorRGBA::isNaN | ( | ) | const |
const ColorRGBA lass::prim::ColorRGBA::darkened | ( | ColorRGBA::TParam | iFactor | ) | const |
return darkened colour without changing the opaqueness.
alphaR = alphaA. ColorR = ColorA * darkenFactor.
Definition at line 262 of file color_rgba.cpp.
References a.
return color with dissolved opaqueness
alphaR = alphaA * dissolveFactor. ColorR = ColorA.
Definition at line 283 of file color_rgba.cpp.
References a.
return gamma corrected color.
corrects gamma of all channels, except alpha.
alphaR = alphaA. ColorR = ColorA ** (1 / gamma).
Definition at line 303 of file color_rgba.cpp.
References a, b, ColorRGBA(), g, lass::num::inv(), lass::num::pow(), and r.
return exposed color.
apply exposure function to color and clamp alpha channel
alphaR = alphaA. ColorR = 1 - exp(-time * ColorA).
Definition at line 323 of file color_rgba.cpp.
References a, b, lass::num::clamp(), ColorRGBA(), lass::num::exp(), g, lass::num::NumTraits< C >::one, r, and lass::num::NumTraits< C >::zero.
return result of inverse exposure function
apply inverse of exposure function to color and clamp alpha channel
alphaR = alphaA. ColorR = log(1 - colorA) / -time
Definition at line 347 of file color_rgba.cpp.
References a, b, lass::num::clamp(), ColorRGBA(), g, lass::num::inv(), lass::num::log(), lass::num::NumTraits< C >::minStrictPositive, lass::num::NumTraits< C >::one, and r.
const ColorRGBA lass::prim::ColorRGBA::clamped | ( | ) | const |
clamp all channels (including alpha channel) to the range [0, 1].
Definition at line 362 of file color_rgba.cpp.
References a, b, lass::num::clamp(), ColorRGBA(), g, lass::num::NumTraits< C >::one, r, and lass::num::NumTraits< C >::zero.
convert a value in range [0, 1] to a color like in colormap 'autumn' of matlab.
Definition at line 375 of file color_rgba.cpp.
References ColorRGBA(), inpclamp(), lass::num::NumTraits< C >::one, and lass::num::NumTraits< C >::zero.
convert a value in range [0, 1] to a color like in colormap 'bone' of matlab.
Definition at line 385 of file color_rgba.cpp.
References ColorRGBA(), and doMap().
convert a value in range [0, 1] to a color like in colormap 'cool' of matlab.
Definition at line 401 of file color_rgba.cpp.
References ColorRGBA(), inpclamp(), lass::num::NumTraits< C >::one, and lass::num::NumTraits< C >::zero.
convert a value in range [0, 1] to a color like in colormap 'copper' of matlab.
Definition at line 411 of file color_rgba.cpp.
References ColorRGBA(), inpclamp(), lass::num::NumTraits< C >::one, and lass::num::NumTraits< C >::zero.
convert a value in range [0, 1] to a color like in colormap 'gray' of matlab.
Definition at line 421 of file color_rgba.cpp.
References ColorRGBA(), inpclamp(), lass::num::NumTraits< C >::one, and lass::num::NumTraits< C >::zero.
convert a value in range [0, 1] to a color like in colormap 'hot' of matlab.
Definition at line 431 of file color_rgba.cpp.
References ColorRGBA(), and doMap().
convert a value to a color like in colormap 'hsv' of matlab.
Definition at line 452 of file color_rgba.cpp.
References ColorRGBA(), doMap(), and lass::num::floor().
convert a value in range [0, 1] to a color like in colormap 'jet' of matlab.
Definition at line 471 of file color_rgba.cpp.
References ColorRGBA(), and doMap().
convert a value in range [0, 1] to a color like in colormap 'pink' of matlab.
Definition at line 493 of file color_rgba.cpp.
References ColorRGBA(), and doMap().
convert a value in range [0, 1] to a color like in colormap 'spring' of matlab.
Definition at line 522 of file color_rgba.cpp.
References ColorRGBA(), inpclamp(), lass::num::NumTraits< C >::one, and lass::num::NumTraits< C >::zero.
convert a value in range [0, 1] to a color like in colormap 'summer' of matlab.
Definition at line 532 of file color_rgba.cpp.
References ColorRGBA(), inpclamp(), lass::num::NumTraits< C >::one, and lass::num::NumTraits< C >::zero.
convert a value in range [0, 1] to a color like in colormap 'winter' of matlab.
Definition at line 542 of file color_rgba.cpp.
References ColorRGBA(), inpclamp(), lass::num::NumTraits< C >::one, and lass::num::NumTraits< C >::zero.
const ColorRGBA lass::prim::ColorRGBA::mapCustom | ( | TParam | iValue, | |
const std::vector< ColorRGBA > & | iColorMap | |||
) | [static] |
convert a value in range [0, 1] to a color from a custom color map.
Definition at line 552 of file color_rgba.cpp.
References doMap(), and LASS_ASSERT.
const ColorRGBA lass::prim::ColorRGBA::doMap | ( | TParam | iValue, | |
const ColorRGBA * | iMap, | |||
int | iMapSize | |||
) | [static, private] |
Definition at line 566 of file color_rgba.cpp.
References lass::num::floor(), inpclamp(), LASS_ASSERT, lass::num::NumTraits< C >::one, and lass::num::NumTraits< C >::zero.
Referenced by mapBone(), mapCustom(), mapHot(), mapHsv(), mapJet(), and mapPink().
raw subtraction of iA and iB, including alpha channels
Definition at line 603 of file color_rgba.cpp.
ColorRGBA operator+ | ( | ColorRGBA::TParam | iA, | |
const ColorRGBA & | iB | |||
) | [related] |
ColorRGBA operator- | ( | ColorRGBA::TParam | iA, | |
const ColorRGBA & | iB | |||
) | [related] |
raw subtraction of iA and iB, including alpha channels
Definition at line 651 of file color_rgba.cpp.
ColorRGBA operator* | ( | ColorRGBA::TParam | iA, | |
const ColorRGBA & | iB | |||
) | [related] |
ColorRGBA operator/ | ( | ColorRGBA::TParam | iA, | |
const ColorRGBA & | iB | |||
) | [related] |
ColorRGBA operator+ | ( | const ColorRGBA & | iA, | |
ColorRGBA::TParam | iB | |||
) | [related] |
ColorRGBA operator- | ( | const ColorRGBA & | iA, | |
ColorRGBA::TParam | iB | |||
) | [related] |
raw subtraction of iA and iB, including alpha channels
Definition at line 699 of file color_rgba.cpp.
ColorRGBA operator* | ( | const ColorRGBA & | iA, | |
ColorRGBA::TParam | iB | |||
) | [related] |
ColorRGBA operator/ | ( | const ColorRGBA & | iA, | |
ColorRGBA::TParam | iB | |||
) | [related] |
Definition at line 75 of file color_rgba.h.
Referenced by brightness(), clamped(), lass::prim::distance(), exposed(), gammaCorrected(), invExposed(), isBlack(), isNaN(), isZero(), lass::io::Image::openTargaTrueColor(), operator*=(), operator+=(), operator-=(), operator/=(), lass::io::Image::saveRadianceHdr(), lass::io::Image::saveTarga(), and lass::prim::Transformation3D< T >::transform().
Definition at line 76 of file color_rgba.h.
Referenced by brightness(), clamped(), lass::prim::distance(), exposed(), gammaCorrected(), invExposed(), isBlack(), isNaN(), isZero(), lass::io::Image::openTargaTrueColor(), operator*=(), operator+=(), operator-=(), operator/=(), lass::io::Image::saveRadianceHdr(), lass::io::Image::saveTarga(), and lass::prim::Transformation3D< T >::transform().
Definition at line 77 of file color_rgba.h.
Referenced by brightness(), clamped(), exposed(), gammaCorrected(), invExposed(), isBlack(), isNaN(), isZero(), lass::io::Image::openTargaTrueColor(), operator*=(), operator+=(), operator-=(), operator/=(), lass::io::Image::saveRadianceHdr(), lass::io::Image::saveTarga(), lass::prim::through(), and lass::prim::Transformation3D< T >::transform().
Definition at line 78 of file color_rgba.h.
Referenced by lass::prim::atop(), clamped(), darkened(), dissolved(), lass::prim::distance(), exposed(), lass::io::Image::filterMedian(), gammaCorrected(), lass::prim::in(), invExposed(), isNaN(), isZero(), lass::io::Image::openTargaTrueColor(), operator*=(), operator+=(), operator-=(), operator/=(), lass::prim::out(), lass::prim::over(), lass::prim::plus(), lass::io::Image::saveTarga(), lass::prim::through(), and lass::prim::Transformation3D< T >::transform().
Generated on Mon Nov 10 14:22:13 2008 for Library of Assembled Shared Sources by 1.5.7.1 |