Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Celartem::DjVu::Color Struct Reference

#include <djv_common.h>

Public Types

typedef Color(* Converter )(const u8 *)
 

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)
 
static Converter getConverter (Photometric inPm)
 
static Color fromBytes (const u8 *inSrc, Photometric inPm)
 
static size_t getBytesPerPixel (DjVu::Photometric pm)
 

Public Attributes

u32 color
 

Static Public Attributes

static const u32 InvalidColor = 0xffffffff
 

Detailed Description

This structure is used to express a color.

Member Typedef Documentation

typedef Color(* Celartem::DjVu::Color::Converter)(const u8 *)

Function pointer definition for color converter functions.

Parameters
inSrcPointer to a memory block which represents a color.
Returns
Return newly created Color instance.
See Also
getConverter

Constructor & Destructor Documentation

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

Initialize with a color.

Parameters
inColorColor 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
inReservedEvery component of a color.
Celartem::DjVu::Color::Color ( const Color inColor)
inline

Copy a Color instance.

Parameters
inColorA Color instance.

Member Function Documentation

static Color Celartem::DjVu::Color::fromBGR ( const u8 inSrc)
inlinestatic

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

Parameters
inSrc8-bit B-G-R data.
Returns
Return newly created Color instance.

Referenced by getConverter().

static Color Celartem::DjVu::Color::fromBytes ( const u8 inSrc,
Photometric  inPm 
)
inlinestatic

Create a new Color instance from byte data.

Parameters
inSrc8-bit data.
inPmPhotometric for the data.
Returns
Return newly created Color instance.
static Color Celartem::DjVu::Color::fromGray ( const u8 inSrc)
inlinestatic

Create a new Color instance from gray data.

Parameters
inSrc8-bit gray data.
Returns
Return newly created Color instance.

Referenced by getConverter().

static Color Celartem::DjVu::Color::fromRGB ( const u8 inSrc)
inlinestatic

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

Parameters
inSrc8-bit R-G-B data.
Returns
Return newly created Color instance.

Referenced by getConverter().

static Color Celartem::DjVu::Color::fromYCbCr ( const u8 inSrc)
static

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

Parameters
inSrc8-bit Y-Cb-Cr data.
Returns
Return newly created Color instance.

Referenced by getConverter().

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

Get the blue value.

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

Referenced by getDist2().

static size_t Celartem::DjVu::Color::getBytesPerPixel ( DjVu::Photometric  pm)
inlinestatic

Get byte-per-pixel for the specified photometric.

Parameters
pmPhotometric to get the bytes-per-pixel.
Returns
The bytes-per-pixel for the photometric.
static Converter Celartem::DjVu::Color::getConverter ( Photometric  inPm)
inlinestatic

Get the Converter function for the specified photometric.

Parameters
inPmPhotometric for the converter.
Returns
Converter for the photometric.
See Also
Converter

Referenced by fromBytes().

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

Get square of the distance between this and another.

Parameters
rAnother 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
rAnother 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
rAnother 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= ( const Color inColor)
inline

Copy a Color instance.

Parameters
inColorA Color instance.
Color& Celartem::DjVu::Color::operator= ( u32  inColor)
inline

Assign a color.

Parameters
inColorA Color instance.
bool Celartem::DjVu::Color::operator== ( const Color r) const
inline

Compare this instance with another (check equality).

Parameters
rAnother 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

u32 Celartem::DjVu::Color::color
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:

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:07.
Cuminas Logo