SbColor Class Reference
[Basics]

Color vector class. More...

#include <Inventor/SbColor.h>

Inheritance diagram for SbColor:
SbVec3f

List of all members.

Public Member Functions

 SbColor ()
 SbColor (const SbVec3f vec3f)
 SbColor (const float rgb[3])
 SbColor (float r, float g, float b)
SbColorsetHSVValue (float h, float s, float v)
SbColorsetHSVValue (const float hsv[3])
void getHSVValue (float &h, float &s, float &v) const
void getHSVValue (float hsv[3]) const
void setRGBValue (unsigned char r, unsigned char g, unsigned char b)
SbColorsetPackedValue (uint32_t orderedRGBA, float &transparency)
uint32_t getPackedValue (float transparency=0.0) const
uint32_t getPackedValueEndiannessOrder (float transparency=0.0) const

Deprecated



SoDEPRECATED uint32_t getPackedValueInternal (float transparency=0.0) const

Detailed Description

Color vector class.

This class is used to represent an RGB color. Each component of the vector is a floating-point number between 0.0 and 1.0. There are routines to convert back and forth between RGB and HSV.

SEE ALSO

SbColorRGBA, SbVec3f


Constructor & Destructor Documentation

SbColor::SbColor (  ) 

Default constructor.

The color value is not initialized.

SbColor::SbColor ( const SbVec3f  vec3f  )  [inline]

Constructor that takes a vector value.

SbColor::SbColor ( const float  rgb[3]  )  [inline]

Constructor that takes an array of 3 floats.

SbColor::SbColor ( float  r,
float  g,
float  b 
) [inline]

Constructor that takes 3 floats.


Member Function Documentation

void SbColor::getHSVValue ( float  hsv[3]  )  const [inline]

Returns an array of 3 HSV components.

void SbColor::getHSVValue ( float &  h,
float &  s,
float &  v 
) const

Returns 3 individual HSV components.

uint32_t SbColor::getPackedValue ( float  transparency = 0.0  )  const

Returns an RGBA packed color value, derived from the color vector and the passed transparency value.

The alpha component is set to (1.0 - transparency) * 255, resulting in a hex value between 0 and 0xFF. If transparency not specified, alpha is set to 0xFF (opaque). The color format expressed in hexadecimal is 0xrrggbbaa.

uint32_t SbColor::getPackedValueEndiannessOrder ( float  transparency = 0.0  )  const

Returns an RGBA packed color value, derived from the color vector and the passed transparency value.

The alpha component is set to (1.0 - transparency) * 255, resulting in a hex value between 0 and 0xFF. If transparency not specified, alpha is set to 0xFF (opaque).

This method takes "endianness" in account and will return a value according to the processor architecture. For example, on "little-endian" processors like Intel, the color value returned is actually 0xaabbggrr. See the note in SoVolumeData about constructing RGBA voxel values programmatically.

SoDEPRECATED uint32_t SbColor::getPackedValueInternal ( float  transparency = 0.0  )  const [inline]
Deprecated:

Deprecated since Open Inventor 9500
Use getPackedValueendiannessOrder(float transparency = 0.0) const instead.
SbColor& SbColor::setHSVValue ( const float  hsv[3]  )  [inline]

Sets value of color vector from array of 3 HSV components.

SbColor& SbColor::setHSVValue ( float  h,
float  s,
float  v 
)

Sets value of color vector from 3 HSV (Hue, Saturation, and Value) components.

Value is the same as brightness of the color.

SbColor& SbColor::setPackedValue ( uint32_t  orderedRGBA,
float &  transparency 
)

Sets value of color vector from an RGBA packed color value.

The packed color format expressed in hexadecimal is 0xrrggbbaa, where

  • rr is the red value
  • gg is the green value
  • bb is the blue value
  • aa is the alpha value

RGBA component values range from 0 to 0xFF (255). The returned transparency value is a floating point value between 0.0 (opaque) and 1.0 (completely transparent). It is derived from the alpha component of the RGBA color.

void SbColor::setRGBValue ( unsigned char  r,
unsigned char  g,
unsigned char  b 
) [inline]

Set RGB values as unsigned char.

RGB values range from 0 to 0xFF (255)


The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/