Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes

Celartem::DjVu::Color Struct Reference

#include <djv_common.h>

List of all members.

Public Member Functions

 Color (u32 inColor=InvalidColor)
 Color (u8 inRed, u8 inGreen, u8 inBlue, u8 inReserved=0)
 Color (const Color &inColor)
Coloroperator= (const Color &inColor)
Coloroperator= (u32 inColor)
u8 getRed () const
u8 getGreen () const
u8 getBlue () const
u8 getReserved () const
bool isValid () const
bool operator< (const Color &r) const
bool operator== (const Color &r) const
bool operator!= (const Color &r) const
size_t getDist2 (const Color &r) const

Static Public Member Functions

static Color fromRGB (const u8 *inSrc)
static Color fromBGR (const u8 *inSrc)
static Color fromYCbCr (const u8 *inSrc)
static Color fromGray (const u8 *inSrc)

Public Attributes

u32 color

Static Public Attributes

static const u32 InvalidColor = 0xffffffff

Detailed Description

This structure is used to express a color.


Constructor & Destructor Documentation

Celartem::DjVu::Color::Color ( u32  inColor = InvalidColor  )  [inline]

Initialize with a color.

Parameters:
inColor Color in 0xRRGGBB format. The default is InvalidColor.

Referenced by fromBGR(), fromGray(), and fromRGB().

Celartem::DjVu::Color::Color ( u8  inRed,
u8  inGreen,
u8  inBlue,
u8  inReserved = 0 
) [inline]

Initialize with a color.

Parameters:
inRed 
inGreen 
inBlue 
inReserved Every component of a color.
Celartem::DjVu::Color::Color ( const Color inColor  )  [inline]

Copy a Color instance.

Parameters:
inColor A Color instance.

Member Function Documentation

static Color Celartem::DjVu::Color::fromBGR ( const u8 inSrc  )  [inline, static]

Create a new Color instance from B-G-R data.

Parameters:
inSrc 8-bit B-G-R data.
Returns:
Return newly created Color instance.
static Color Celartem::DjVu::Color::fromGray ( const u8 inSrc  )  [inline, static]

Create a new Color instance from gray data.

Parameters:
inSrc 8-bit gray data.
Returns:
Return newly created Color instance.
static Color Celartem::DjVu::Color::fromRGB ( const u8 inSrc  )  [inline, static]

Create a new Color instance from R-G-B data.

Parameters:
inSrc 8-bit R-G-B data.
Returns:
Return newly created Color instance.
static Color Celartem::DjVu::Color::fromYCbCr ( const u8 inSrc  )  [static]

Create a new Color instance from Y-Cb-Cr data.

Parameters:
inSrc 8-bit Y-Cb-Cr data.
Returns:
Return newly created Color instance.
u8 Celartem::DjVu::Color::getBlue (  )  const [inline]

Get the blue value.

Returns:
The blue value. The value is within 0 - 255.

Referenced by getDist2().

size_t Celartem::DjVu::Color::getDist2 ( const Color r  )  const [inline]

Get square of the distance between this and another.

Parameters:
r Another Color instance to calculate the distance with.
Returns:
Returns distance^2.
u8 Celartem::DjVu::Color::getGreen (  )  const [inline]

Get the green value.

Returns:
The green value. The value is within 0 - 255.

Referenced by getDist2().

u8 Celartem::DjVu::Color::getRed (  )  const [inline]

Get the red value.

Returns:
The red value. The value is within 0 - 255.

Referenced by getDist2().

u8 Celartem::DjVu::Color::getReserved (  )  const [inline]

Get the reserved value (the highest 8-bits).

Returns:
The reserved value. The value is within 0 - 255.
bool Celartem::DjVu::Color::isValid (  )  const [inline]

Determines whether the color is valid or not.
The definition of the valid colors is that the highest 8bit are all 0. In other words, color is smaller than 0x1000000.

Returns:
true if the color is valid; otherwise false.
See also:
InvalidColor
bool Celartem::DjVu::Color::operator!= ( const Color r  )  const [inline]

Compare this instance with another (check inequality).

Parameters:
r Another Color instance to compare with.
Returns:
true if the color member of this Color instance is not equal to the one of r.
bool Celartem::DjVu::Color::operator< ( const Color r  )  const [inline]

Compare this instance with another.

Parameters:
r Another Color instance to compare with.
Returns:
true if the color member of this Color instance is less than the one of r.
Color& Celartem::DjVu::Color::operator= ( u32  inColor  )  [inline]

Assign a color.

Parameters:
inColor A Color instance.
Color& Celartem::DjVu::Color::operator= ( const Color inColor  )  [inline]

Copy a Color instance.

Parameters:
inColor A Color instance.
bool Celartem::DjVu::Color::operator== ( const Color r  )  const [inline]

Compare this instance with another (check equality).

Parameters:
r Another Color instance to compare with.
Returns:
true if the color member of this Color instance is equal to the one of r.

Member Data Documentation

const u32 Celartem::DjVu::Color::InvalidColor = 0xffffffff [static]

This represents a color is not initialized or unspecified.
isValid return false for InvalidColor.

See also:
isValid

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

This document is made with doxygen 1.7.1 at Sun Sep 5 2010 13:03:40.
Caminova Logo