Saga3D API Documentation  1.0-RC4
saga::video::SColorf Class Reference

Class representing a color with four floats. More...

#include <SColor.h>

Public Member Functions

 SColorf ()
 Default constructor for SColorf. More...
 
 SColorf (float r, float g, float b, float a=1.0f)
 Constructs a color from up to four color values: red, green, blue, and alpha. More...
 
 SColorf (SColor c)
 Constructs a color from 32 bit Color. More...
 
SColor toSColor () const
 Converts this color to a SColor without floats. More...
 
void set (float rr, float gg, float bb)
 Sets three color components to new values at once. More...
 
void set (float aa, float rr, float gg, float bb)
 Sets all four color components to new values at once. More...
 
SColorf getInterpolated (const SColorf &other, float d) const
 Interpolates the color with a float value to another color. More...
 
SColorf getInterpolated_quadratic (const SColorf &c1, const SColorf &c2, float d) const
 Returns interpolated color. (quadratic) More...
 
void setColorComponentValue (std::int32_t index, float value)
 Sets a color component by index. R= 0, G=1, B=2, A=3. More...
 
float getAlpha () const
 Returns the alpha component of the color in the range 0.0 (transparent) to 1.0 (opaque) More...
 
float getRed () const
 Returns the red component of the color in the range 0.0 to 1.0. More...
 
float getGreen () const
 Returns the green component of the color in the range 0.0 to 1.0. More...
 
float getBlue () const
 Returns the blue component of the color in the range 0.0 to 1.0. More...
 

Public Attributes

float r
 red color component More...
 
float g
 green color component More...
 
float b
 blue component More...
 
float a
 alpha color component More...
 

Detailed Description

Class representing a color with four floats.

The color values for red, green, blue and alpha are each stored in a 32 bit floating point variable. So all four values may be between 0.0f and 1.0f. Another, faster way to define colors is using the class SColor, which stores the color values in a single 32 bit integer.

Definition at line 446 of file SColor.h.

Constructor & Destructor Documentation

◆ SColorf() [1/3]

saga::video::SColorf::SColorf ( )
inline

Default constructor for SColorf.

Sets red, green and blue to 0.0f and alpha to 1.0f.

Definition at line 451 of file SColor.h.

◆ SColorf() [2/3]

saga::video::SColorf::SColorf ( float  r,
float  g,
float  b,
float  a = 1.0f 
)
inline

Constructs a color from up to four color values: red, green, blue, and alpha.

Parameters
rRed color component. Should be a value between 0.0f meaning no red and 1.0f, meaning full red.
gGreen color component. Should be a value between 0.0f meaning no green and 1.0f, meaning full green.
bBlue color component. Should be a value between 0.0f meaning no blue and 1.0f, meaning full blue.
aAlpha color component of the color. The alpha component defines how transparent a color should be. Has to be a value between 0.0f and 1.0f, 1.0f means not transparent (opaque), 0.0f means fully transparent.

Definition at line 464 of file SColor.h.

◆ SColorf() [3/3]

saga::video::SColorf::SColorf ( SColor  c)
inline

Constructs a color from 32 bit Color.

Parameters
c32 bit color from which this SColorf class is constructed from.

Definition at line 469 of file SColor.h.

Member Function Documentation

◆ getAlpha()

float saga::video::SColorf::getAlpha ( ) const
inline

Returns the alpha component of the color in the range 0.0 (transparent) to 1.0 (opaque)

Definition at line 550 of file SColor.h.

◆ getBlue()

float saga::video::SColorf::getBlue ( ) const
inline

Returns the blue component of the color in the range 0.0 to 1.0.

Definition at line 559 of file SColor.h.

◆ getGreen()

float saga::video::SColorf::getGreen ( ) const
inline

Returns the green component of the color in the range 0.0 to 1.0.

Definition at line 556 of file SColor.h.

◆ getInterpolated()

SColorf saga::video::SColorf::getInterpolated ( const SColorf other,
float  d 
) const
inline

Interpolates the color with a float value to another color.

Parameters
otherOther color
dvalue between 0.0f and 1.0f
Returns
Interpolated color.

Definition at line 508 of file SColor.h.

◆ getInterpolated_quadratic()

SColorf saga::video::SColorf::getInterpolated_quadratic ( const SColorf c1,
const SColorf c2,
float  d 
) const
inline

Returns interpolated color. (quadratic)

Parameters
c1first color to interpolate with
c2second color to interpolate with
dvalue between 0.0f and 1.0f.

Definition at line 520 of file SColor.h.

◆ getRed()

float saga::video::SColorf::getRed ( ) const
inline

Returns the red component of the color in the range 0.0 to 1.0.

Definition at line 553 of file SColor.h.

◆ set() [1/2]

void saga::video::SColorf::set ( float  aa,
float  rr,
float  gg,
float  bb 
)
inline

Sets all four color components to new values at once.

Parameters
aaAlpha component. Should be a value between 0.0f meaning fully transparent and 1.0f, meaning opaque.
rrRed color component. Should be a value between 0.0f meaning no red and 1.0f, meaning full red.
ggGreen color component. Should be a value between 0.0f meaning no green and 1.0f, meaning full green.
bbBlue color component. Should be a value between 0.0f meaning no blue and 1.0f, meaning full blue.

Definition at line 502 of file SColor.h.

◆ set() [2/2]

void saga::video::SColorf::set ( float  rr,
float  gg,
float  bb 
)
inline

Sets three color components to new values at once.

Parameters
rrRed color component. Should be a value between 0.0f meaning no red (=black) and 1.0f, meaning full red.
ggGreen color component. Should be a value between 0.0f meaning no green (=black) and 1.0f, meaning full green.
bbBlue color component. Should be a value between 0.0f meaning no blue (=black) and 1.0f, meaning full blue.

Definition at line 491 of file SColor.h.

◆ setColorComponentValue()

void saga::video::SColorf::setColorComponentValue ( std::int32_t  index,
float  value 
)
inline

Sets a color component by index. R= 0, G=1, B=2, A=3.

Definition at line 538 of file SColor.h.

◆ toSColor()

SColor saga::video::SColorf::toSColor ( ) const
inline

Converts this color to a SColor without floats.

Definition at line 479 of file SColor.h.

Member Data Documentation

◆ a

float saga::video::SColorf::a

alpha color component

Definition at line 571 of file SColor.h.

◆ b

float saga::video::SColorf::b

blue component

Definition at line 568 of file SColor.h.

◆ g

float saga::video::SColorf::g

green color component

Definition at line 565 of file SColor.h.

◆ r

float saga::video::SColorf::r

red color component

Definition at line 562 of file SColor.h.


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