Thea
Public Types | Public Member Functions | Static Public Member Functions | List of all members
ColorL8 Class Reference

Monochrome luminance value represented as a single byte value in [0, 255], with automatic scaling by 255 when switching between integer (ColorL8) and floating point (ColorL) formats. More...

#include <ColorL8.hpp>

Public Types

typedef uint8 value_type
 The numerical type of the luminance value. More...
 

Public Member Functions

 ColorL8 ()
 Default constructor, initializes color to 0. More...
 
 ColorL8 (uint8 v)
 Initializing constructor. More...
 
 ColorL8 (ColorRgba const &other)
 Initialize from a 32-bit RGBA color. More...
 
 ColorL8 (ColorL const &other)
 Initialize from a floating-point color, automatically multiplying by 255. More...
 
uint8 const * data () const
 Get the address of the color value. More...
 
uint8 * data ()
 Get the address of the color value. More...
 
void fill (uint8 v)
 Set the luminance value, for consistency with multi-channel colors. More...
 
ColorL8 max (ColorL8 const &other) const
 Get the maximum of two color values. More...
 
ColorL8 min (ColorL8 const &other) const
 Get the minimum of two color values. More...
 
ColorL8 operator* (Real other) const
 Multiply by a scalar. More...
 
ColorL8operator*= (Real other)
 Multiply by a scalar and assign. More...
 
ColorL8 operator+ (ColorL8 const &other) const
 Addition operator. More...
 
ColorL8operator+= (ColorL8 const &other)
 Add-and-assign. More...
 
ColorL8 operator- (ColorL8 const &other) const
 Subtraction operator. More...
 
ColorL8operator-= (ColorL8 const &other)
 Subtract-and-assign. More...
 
ColorL8 operator/ (Real other) const
 Divide by a scalar. More...
 
ColorL8operator/= (Real other)
 Divide by a scalar and assign. More...
 
template<typename IntegerT >
uint8 const & operator[] (IntegerT channel) const
 Array-style channel access. More...
 
template<typename IntegerT >
uint8 & operator[] (IntegerT channel)
 Array-style channel access. More...
 
std::string toString () const
 Get a string representation of the color. More...
 
uint8 value () const
 The value of the color. More...
 
uint8 & value ()
 The value of the color. More...
 

Static Public Member Functions

static ColorL8 const & zero ()
 Color with zero luminance (black). More...
 

Detailed Description

Monochrome luminance value represented as a single byte value in [0, 255], with automatic scaling by 255 when switching between integer (ColorL8) and floating point (ColorL) formats.

Derived from the G3D library: http://g3d.sourceforge.net

Definition at line 46 of file ColorL8.hpp.

Member Typedef Documentation

typedef uint8 value_type

The numerical type of the luminance value.

Definition at line 52 of file ColorL8.hpp.

Constructor & Destructor Documentation

ColorL8 ( )

Default constructor, initializes color to 0.

Definition at line 55 of file ColorL8.hpp.

ColorL8 ( uint8  v)
explicit

Initializing constructor.

Definition at line 58 of file ColorL8.hpp.

ColorL8 ( ColorRgba const &  other)

Initialize from a 32-bit RGBA color.

For conversion from a consistent source type.

ColorL8 ( ColorL const &  other)

Initialize from a floating-point color, automatically multiplying by 255.

Definition at line 33 of file ColorL8.cpp.

Member Function Documentation

uint8 const* data ( ) const

Get the address of the color value.

Definition at line 73 of file ColorL8.hpp.

uint8* data ( )

Get the address of the color value.

Definition at line 76 of file ColorL8.hpp.

void fill ( uint8  v)

Set the luminance value, for consistency with multi-channel colors.

Definition at line 93 of file ColorL8.hpp.

ColorL8 max ( ColorL8 const &  other) const

Get the maximum of two color values.

Definition at line 148 of file ColorL8.hpp.

ColorL8 min ( ColorL8 const &  other) const

Get the minimum of two color values.

Definition at line 154 of file ColorL8.hpp.

ColorL8 operator* ( Real  other) const

Multiply by a scalar.

The result is rounded to the nearest byte value.

Definition at line 108 of file ColorL8.hpp.

ColorL8& operator*= ( Real  other)

Multiply by a scalar and assign.

The result is rounded to the nearest byte value.

Definition at line 134 of file ColorL8.hpp.

ColorL8 operator+ ( ColorL8 const &  other) const

Addition operator.

Upper-bounds result to 255.

Definition at line 96 of file ColorL8.hpp.

ColorL8& operator+= ( ColorL8 const &  other)

Add-and-assign.

Upper-bounds result to 255.

Definition at line 120 of file ColorL8.hpp.

ColorL8 operator- ( ColorL8 const &  other) const

Subtraction operator.

Lower-bounds result to 0.

Definition at line 102 of file ColorL8.hpp.

ColorL8& operator-= ( ColorL8 const &  other)

Subtract-and-assign.

Lower-bounds result to 0.

Definition at line 127 of file ColorL8.hpp.

ColorL8 operator/ ( Real  other) const

Divide by a scalar.

The result is rounded to the nearest byte value.

Definition at line 114 of file ColorL8.hpp.

ColorL8& operator/= ( Real  other)

Divide by a scalar and assign.

The result is rounded to the nearest byte value.

Definition at line 141 of file ColorL8.hpp.

uint8 const& operator[] ( IntegerT  channel) const

Array-style channel access.

Definition at line 79 of file ColorL8.hpp.

uint8& operator[] ( IntegerT  channel)

Array-style channel access.

Definition at line 86 of file ColorL8.hpp.

std::string toString ( ) const

Get a string representation of the color.

Definition at line 44 of file ColorL8.cpp.

uint8 value ( ) const

The value of the color.

Definition at line 67 of file ColorL8.hpp.

uint8& value ( )

The value of the color.

Definition at line 70 of file ColorL8.hpp.

static ColorL8 const& zero ( )
static

Color with zero luminance (black).

Definition at line 160 of file ColorL8.hpp.


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