COLOR Struct Reference

Structure to contain single color specification with possible transparency. More...

#include <color.h>

List of all members.

Public Types

enum  NAME {
  BLACK = 0x00000000, RED = 0x000000FF, GREEN = 0x0000FF00, BLUE = 0x00FF0000,
  CYAN = 0x00FFFF00, MAGENTA = 0x00FF00FF, YELLOW = 0x0000FFFF, GRAY25 = 0x003F3F3F,
  GRAY50 = 0x007F7F7F, GRAY75 = 0x00BFBFBF, GRAY = GRAY50, ORANGE = 0x0000A5FF,
  BROWN = 0x00A52A2A, PURPLE = 0x00A020F0, WHITE = 0x00FFFFFF
}
enum  FLAGS {
  STATUS_ValueSet = 0x0001, STATUS_Reserved = 0x0004, STATUS_Invisible = 0x0008, STATUS_ICMCorrected = 0x0020,
  STATUS_NonRGB = 0x0080, MASK_Compare = 0xFFE9, MASK_CompareNoTransp = 0x00E5, MASK_Transparency = 0xFF00,
  LEGACY_Invalid = 0xFFFF
}

Public Member Functions

 COLOR ()
 COLOR (UINT16 red, UINT16 green, UINT16 blue)
 COLOR (UINT32 ColorRef)
 COLOR (NAME name)
COLORoperator= (COLOR::NAME name)
void Blend (const COLOR &other, UINT8 alpha=128)
void Clear ()
UINT16 GetBlue () const
UINT16 GetBlue (UINT16 range) const
UINT8 GetBlueByte () const
COLORMODEL GetColorModel () const
ERRVALUE GetByColorSpace (COLORSPACE colorspace, void *values) const
UINT32 GetColorRef () const
UINT16 GetGreen () const
UINT16 GetGreen (UINT16 range) const
UINT8 GetGreenByte () const
UINT8 GetOpacity () const
UINT16 GetRed () const
UINT16 GetRed (UINT16 range) const
UINT8 GetRedByte () const
void GetRGB (UINT16 &red, UINT16 &green, UINT16 &blue) const
UINT8 GetTransparency () const
bool HasTransparency () const
bool HasValue () const
bool IsEqualNoTransp (const COLOR &rhs) const
bool IsEqualTo (const COLOR &rhs) const
bool IsICMCorrected () const
bool IsInvisible () const
bool IsReserved () const
void SerialGetString (char *string) const
void SerialSetString (const char *string)
ERRVALUE SetByColorSpace (COLORSPACE colorspace, const void *values)
bool SetByName (const char *string)
void SetCMY (int cyan, int magenta, int yellow, int range)
void SetCMYK (int cyan, int magenta, int yellow, int black, int range)
void SetColorRef (UINT32 ColorRef)
void SetIsICMCorrected (bool bCorrected)
void SetOpacity (UINT8 opacity)
void SetReserved (bool reserved=true)
void SetRGB (UINT16 red, UINT16 green, UINT16 blue)
void SetRGB (const COLOR &color)
void SetRGB (int red, int green, int blue, int range)
void SetTransparency (UINT8 transparency)
void Validate ()


Detailed Description

Structure to contain single color specification with possible transparency.

This structure is stored in files and will never change in size.

Definition at line 192 of file color.h.


Member Enumeration Documentation

enum COLOR::FLAGS
 

Enumeration values:
STATUS_ValueSet 
STATUS_Reserved 
STATUS_Invisible 
STATUS_ICMCorrected  ICM correction already done. Note, NonRGB imlies ICM's already been done too.
STATUS_NonRGB  If set, other flags are usurped to hold COLORMODEL.
MASK_Compare 
MASK_CompareNoTransp 
MASK_Transparency 
LEGACY_Invalid 

Definition at line 215 of file color.h.

enum COLOR::NAME
 

Enumerated color names.

Enumeration values:
BLACK 
RED 
GREEN 
BLUE 
CYAN 
MAGENTA 
YELLOW 
GRAY25 
GRAY50 
GRAY75 
GRAY 
ORANGE 
BROWN 
PURPLE 
WHITE 

Definition at line 197 of file color.h.


Constructor & Destructor Documentation

COLOR::COLOR  ) 
 

Default constructor.

COLOR::COLOR UINT16  red,
UINT16  green,
UINT16  blue
 

Construct with specified red, green, blue values.

COLOR::COLOR UINT32  ColorRef  )  [explicit]
 

Construct by color reference.

COLOR::COLOR NAME  name  ) 
 

Construct by enumerated name.


Member Function Documentation

void COLOR::Blend const COLOR other,
UINT8  alpha = 128
 

Blend this color with another color.

The range of values for alpha is 0-255.

Parameters:
alpha  0 == all "this", 255 = all "other"

void COLOR::Clear  ) 
 

Clear current color setting.

UINT16 COLOR::GetBlue UINT16  range  )  const
 

Get Blue in range specified.

Parameters:
range  Range 1-65535

UINT16 COLOR::GetBlue  )  const
 

Get Blue as UINT16 (0-65535).

UINT8 COLOR::GetBlueByte  )  const
 

Get Blue as byte (0-255).

ERRVALUE COLOR::GetByColorSpace COLORSPACE  colorspace,
void *  values
const
 

Get values in specified COLORSPACE.

For colorspaces containing an "alpha" component, "alpha" is considered to be "opacity". Binary, grayscale and indexed colorspaces are not supported and an error will be returned for such.

Parameters:
colorspace  Color space
values  Buffer to hold returned values, size depends on colorspace

COLORMODEL COLOR::GetColorModel  )  const
 

UINT32 COLOR::GetColorRef  )  const
 

Get WIN32 color reference (0x00BBGGRR).

UINT16 COLOR::GetGreen UINT16  range  )  const
 

Get Green in range specified.

Parameters:
range  Range 1-65535

UINT16 COLOR::GetGreen  )  const
 

Get Green as UINT16 (0-65535).

UINT8 COLOR::GetGreenByte  )  const
 

Get Green as byte (0-255).

UINT8 COLOR::GetOpacity  )  const
 

Get opacity value (0-255).

UINT16 COLOR::GetRed UINT16  range  )  const
 

Get Red in range specified.

Parameters:
range  Range 1-65535

UINT16 COLOR::GetRed  )  const
 

Get Red as UINT16 (0-65535).

UINT8 COLOR::GetRedByte  )  const
 

Get Red as byte (0-255).

void COLOR::GetRGB UINT16 red,
UINT16 green,
UINT16 blue
const
 

Get Red, Green, Blue values in single call for efficiency.

UINT8 COLOR::GetTransparency  )  const
 

Retrieve transparency value.

Returns:
Transparency (0 - 255), 0 = opaque, 255 = 100% transparent.

bool COLOR::HasTransparency  )  const
 

Determine if has any transparency value (including invisible).

bool COLOR::HasValue  )  const
 

Determine if a color value has been set.

bool COLOR::IsEqualNoTransp const COLOR rhs  )  const
 

Compare colors for equality, excluding transparency settings.

bool COLOR::IsEqualTo const COLOR rhs  )  const
 

Compare colors for equality, including transparency, etc.

bool COLOR::IsICMCorrected  )  const
 

Determine if the color has been run through an ICM transformation.

This is used to insure that the same color isn't translated more than once.

bool COLOR::IsInvisible  )  const
 

Determine if color is 'invisible' (100% transparent).

bool COLOR::IsReserved  )  const
 

Determine if color is 'reserved' for application-specific use.

In color search and allocation operations 'reserved' colors are not used or changed.

COLOR& COLOR::operator= COLOR::NAME  name  ) 
 

Assign by enumerated name.

Original flag and transparency values are retained.

void COLOR::SerialGetString char *  string  )  const
 

Get as string for serializer writing.

Parameters:
string  String to contain values, should be at least 32 bytes

void COLOR::SerialSetString const char *  string  ) 
 

Set from string for serializer reading.

Parameters:
string  String to set from

ERRVALUE COLOR::SetByColorSpace COLORSPACE  colorspace,
const void *  values
 

Set values using specified COLORSPACE.

For colorspaces containing an "alpha" component, "alpha" is considered to be "opacity". Binary, grayscale and indexed colorspaces are not supported and an error will be returned for such.

Parameters:
colorspace  Color space
values  Buffer holding values to set, size depends on colorspace

bool COLOR::SetByName const char *  string  ) 
 

Set color by name string.

Returns:
'true' if name found, 'false' if not. Also supports strings in forms "redpct greenpct bluepct" and "redpct,greenpct,bluepct".
Parameters:
string  Color name, case-insensitive

void COLOR::SetCMY int  cyan,
int  magenta,
int  yellow,
int  range
 

Set from Cyan, Magenta, Yellow in specified range.

Parameters:
range  Range, 1-65535

void COLOR::SetCMYK int  cyan,
int  magenta,
int  yellow,
int  black,
int  range
 

Set from Cyan, Magenta, Yellow, Black in specified range.

Parameters:
range  Range, 1-65535

void COLOR::SetColorRef UINT32  ColorRef  ) 
 

Set red, green, blue values from WIN32 color reference (0x00BBGGRR).

Original flag and transparency values are retained.

void COLOR::SetIsICMCorrected bool  bCorrected  ) 
 

Specify whether the color has been run through an ICM transformation.

This is used to insure that the same color isn't translated more than once. Of course there's no way to specify which target profile it's been corrected to. ICM-corrected colors should never be stored in files unless the whole file is corrected to some target device profile.

void COLOR::SetOpacity UINT8  opacity  ) 
 

Set opacity value.

Parameters:
opacity  Value to set, 0 = invisible, 255 = 100% opaque

void COLOR::SetReserved bool  reserved = true  ) 
 

Set whether color is 'reserved' or not.

Parameters:
reserved  'true' to make reserved, 'false' to not

void COLOR::SetRGB int  red,
int  green,
int  blue,
int  range
 

Set from Red, Green, Blue in specified range.

Values outside the range will be limited to the range specified.

Parameters:
red  Red in range specified
green  Green in range specified
blue  Blue in range specified
range  Range, 1-65535

void COLOR::SetRGB const COLOR color  ) 
 

Set red, green, blue values from COLOR.

Original flag and transparency values are retained.

void COLOR::SetRGB UINT16  red,
UINT16  green,
UINT16  blue
 

Set red, green, blue values in range 0-65535.

Original flag and transparency values are retained.

void COLOR::SetTransparency UINT8  transparency  ) 
 

Set transparency value.

Parameters:
transparency  Value to set, 0 = opaque, 255 = 100% transparent

void COLOR::Validate  ) 
 

Validate status for some legacy stored color instances.


The documentation for this struct was generated from the following file:
Generated on Thu Aug 12 06:26:14 2004 for TNTsdk by doxygen 1.3.4-20031026