#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) | |
Color & | operator= (const Color &inColor) |
Color & | operator= (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 |
This structure is used to express a color.
Function pointer definition for color converter functions.
inSrc | Pointer to a memory block which represents a color. |
|
inline |
Initialize with a color.
inColor | Color in 0xRRGGBB format. The default is InvalidColor. |
Referenced by fromBGR(), fromGray(), and fromRGB().
Initialize with a color.
inRed | |
inGreen | |
inBlue | |
inReserved | Every component of a color. |
|
inline |
Create a new Color instance from B-G-R data.
inSrc | 8-bit B-G-R data. |
Referenced by getConverter().
|
inlinestatic |
Create a new Color instance from byte data.
inSrc | 8-bit data. |
inPm | Photometric for the data. |
Create a new Color instance from gray data.
inSrc | 8-bit gray data. |
Referenced by getConverter().
Create a new Color instance from R-G-B data.
inSrc | 8-bit R-G-B data. |
Referenced by getConverter().
Create a new Color instance from Y-Cb-Cr data.
inSrc | 8-bit Y-Cb-Cr data. |
Referenced by getConverter().
|
inline |
|
inlinestatic |
Get byte-per-pixel for the specified photometric.
pm | Photometric to get the bytes-per-pixel. |
|
inlinestatic |
Get the Converter function for the specified photometric.
inPm | Photometric for the converter. |
Referenced by fromBytes().
|
inline |
Get square of the distance between this and another.
r | Another Color instance to calculate the distance with. |
|
inline |
|
inline |
|
inline |
Get the reserved value (the highest 8-bits).
|
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
.
true
if the color is valid; otherwise false
.
|
inline |
|
inline |
Assign a color.
inColor | A Color instance. |
|
inline |
u32 Celartem::DjVu::Color::color |
Color in 0xRRGGBB format.
Referenced by getBlue(), getGreen(), getRed(), getReserved(), isValid(), operator!=(), operator<(), operator=(), and operator==().
|
static |
This represents a color is not initialized or unspecified.
isValid return false
for InvalidColor.