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.

Definition at line 70 of file djv_common.h.


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.

Definition at line 89 of file djv_common.h.

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.

Definition at line 101 of file djv_common.h.

Celartem::DjVu::Color::Color ( const Color inColor  )  [inline]

Copy a Color instance.

Parameters:
inColor A Color instance.

Definition at line 111 of file djv_common.h.


Member Function Documentation

Color& Celartem::DjVu::Color::operator= ( const Color inColor  )  [inline]

Copy a Color instance.

Parameters:
inColor A Color instance.

Definition at line 120 of file djv_common.h.

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

Assign a color.

Parameters:
inColor A Color instance.

Definition at line 131 of file djv_common.h.

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

Get the red value.

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

Definition at line 147 of file djv_common.h.

Referenced by getDist2().

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

Get the green value.

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

Definition at line 154 of file djv_common.h.

Referenced by getDist2().

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

Get the blue value.

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

Definition at line 161 of file djv_common.h.

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.

Definition at line 168 of file djv_common.h.

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

Definition at line 179 of file djv_common.h.

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.

Definition at line 188 of file djv_common.h.

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.

Definition at line 200 of file djv_common.h.

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.

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.

Definition at line 221 of file djv_common.h.

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.

Definition at line 234 of file djv_common.h.

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.

Definition at line 247 of file djv_common.h.

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.

Definition at line 260 of file djv_common.h.

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.

Definition at line 272 of file djv_common.h.


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

Definition at line 77 of file djv_common.h.

u32 Celartem::DjVu::Color::color

Color in 0xRRGGBB format.

Definition at line 82 of file djv_common.h.

Referenced by getBlue(), getGreen(), getRed(), getReserved(), isValid(), operator!=(), operator<(), operator=(), and operator==().


The documentation for this struct was generated from the following file:
This document is automatically generated using doxygen 1.5.4 at Fri Jun 27 18:23:26 2008.