COLOR Struct Reference

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

#include <mi32/color.h>

List of all members.

Public Types

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
}
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, DARKRED = 0x00000080, DARKGREEN = 0x00008000,
  DARKBLUE = 0x00800000, DARKCYAN = 0x00808000, DARKMAGENTA = 0x00A000A0, DARKYELLOW = 0x00008080,
  FORESTGREEN = 0x00228B22, WHITE = 0x00FFFFFF
}

Public Member Functions

void Blend (const COLOR &other, UINT8 alpha=128)
void Clear ()
 COLOR (NAME name)
 COLOR (UINT32 ColorRef)
 COLOR (UINT16 red, UINT16 green, UINT16 blue)
 COLOR ()
UINT16 GetBlue (UINT16 range) const
UINT16 GetBlue () const
UINT8 GetBlueByte () const
ERRVALUE GetByColorSpace (COLORSPACE colorspace, void *values) const
COLORMODEL GetColorModel () const
UINT32 GetColorRef () const
UINT16 GetGreen (UINT16 range) const
UINT16 GetGreen () const
UINT8 GetGreenByte () const
UINT8 GetOpacity () const
UINT16 GetRed (UINT16 range) const
UINT16 GetRed () 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
COLORoperator= (COLOR::NAME name)
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 (int red, int green, int blue, int range)
void SetRGB (const COLOR &color)
void SetRGB (UINT16 red, UINT16 green, UINT16 blue)
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 207 of file color.h.


Member Enumeration Documentation

enum COLOR::FLAGS

Enumerator:
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 238 of file color.h.

enum COLOR::NAME

Enumerated color names.

Enumerator:
BLACK 
RED 
GREEN 
BLUE 
CYAN 
MAGENTA 
YELLOW 
GRAY25 
GRAY50 
GRAY75 
GRAY 
ORANGE 
BROWN 
PURPLE 
DARKRED 
DARKGREEN 
DARKBLUE 
DARKCYAN 
DARKMAGENTA 
DARKYELLOW 
FORESTGREEN 
WHITE 

Definition at line 212 of file color.h.


Constructor & Destructor Documentation

COLOR::COLOR (  )  [inline]

Default constructor.

Definition at line 253 of file color.h.

COLOR::COLOR ( UINT16  red,
UINT16  green,
UINT16  blue 
) [inline]

Construct with specified red, green, blue values.

Definition at line 262 of file color.h.

COLOR::COLOR ( UINT32  ColorRef  )  [inline, explicit]

Construct by color reference.

Definition at line 274 of file color.h.

COLOR::COLOR ( NAME  name  )  [inline]

Construct by enumerated name.

Definition at line 284 of file color.h.


Member Function Documentation

void COLOR::Blend ( const COLOR other,
UINT8  alpha = 128 
) [inline]

Blend this color with another color.

The range of values for alpha is 0-255.

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

Definition at line 307 of file color.h.

void COLOR::Clear (  )  [inline]

Clear current color setting.

Definition at line 325 of file color.h.

UINT16 COLOR::GetBlue ( UINT16  range  )  const [inline]

Get Blue in range specified.

Parameters:
range  Range 1-65535

Definition at line 338 of file color.h.

UINT16 COLOR::GetBlue (  )  const [inline]

Get Blue as UINT16 (0-65535).

Definition at line 332 of file color.h.

UINT8 COLOR::GetBlueByte (  )  const [inline]

Get Blue as byte (0-255).

Definition at line 345 of file color.h.

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 [inline]

Definition at line 350 of file color.h.

UINT32 COLOR::GetColorRef (  )  const [inline]

Get WIN32 color reference (0x00BBGGRR).

Definition at line 367 of file color.h.

UINT16 COLOR::GetGreen ( UINT16  range  )  const [inline]

Get Green in range specified.

Parameters:
range  Range 1-65535

Definition at line 379 of file color.h.

UINT16 COLOR::GetGreen (  )  const [inline]

Get Green as UINT16 (0-65535).

Definition at line 373 of file color.h.

UINT8 COLOR::GetGreenByte (  )  const [inline]

Get Green as byte (0-255).

Definition at line 386 of file color.h.

UINT8 COLOR::GetOpacity (  )  const [inline]

Get opacity value (0-255).

Definition at line 392 of file color.h.

UINT16 COLOR::GetRed ( UINT16  range  )  const [inline]

Get Red in range specified.

Parameters:
range  Range 1-65535

Definition at line 408 of file color.h.

UINT16 COLOR::GetRed (  )  const [inline]

Get Red as UINT16 (0-65535).

Definition at line 402 of file color.h.

UINT8 COLOR::GetRedByte (  )  const [inline]

Get Red as byte (0-255).

Definition at line 415 of file color.h.

void COLOR::GetRGB ( UINT16 red,
UINT16 green,
UINT16 blue 
) const [inline]

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

Definition at line 421 of file color.h.

UINT8 COLOR::GetTransparency (  )  const [inline]

Retrieve transparency value.

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

Definition at line 434 of file color.h.

bool COLOR::HasTransparency (  )  const [inline]

Determine if has any transparency value (including invisible).

Definition at line 444 of file color.h.

bool COLOR::HasValue (  )  const [inline]

Determine if a color value has been set.

Definition at line 452 of file color.h.

bool COLOR::IsEqualNoTransp ( const COLOR rhs  )  const [inline]

Compare colors for equality, excluding transparency settings.

Definition at line 458 of file color.h.

bool COLOR::IsEqualTo ( const COLOR rhs  )  const [inline]

Compare colors for equality, including transparency, etc.

Definition at line 470 of file color.h.

bool COLOR::IsICMCorrected (  )  const [inline]

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.

Definition at line 484 of file color.h.

bool COLOR::IsInvisible (  )  const [inline]

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

Definition at line 491 of file color.h.

bool COLOR::IsReserved (  )  const [inline]

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

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

Definition at line 502 of file color.h.

COLOR& COLOR::operator= ( COLOR::NAME  name  )  [inline]

Assign by enumerated name.

Original flag and transparency values are retained.

Definition at line 295 of file color.h.

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 
) [inline]

Set from Cyan, Magenta, Yellow in specified range.

Parameters:
range  Range, 1-65535

Definition at line 534 of file color.h.

void COLOR::SetCMYK ( int  cyan,
int  magenta,
int  yellow,
int  black,
int  range 
) [inline]

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

Parameters:
range  Range, 1-65535

Definition at line 545 of file color.h.

void COLOR::SetColorRef ( UINT32  ColorRef  )  [inline]

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

Original flag and transparency values are retained.

Definition at line 561 of file color.h.

void COLOR::SetIsICMCorrected ( bool  bCorrected  )  [inline]

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.

Definition at line 578 of file color.h.

void COLOR::SetOpacity ( UINT8  opacity  )  [inline]

Set opacity value.

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

Definition at line 592 of file color.h.

void COLOR::SetReserved ( bool  reserved = true  )  [inline]

Set whether color is 'reserved' or not.

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

Definition at line 601 of file color.h.

void COLOR::SetRGB ( int  red,
int  green,
int  blue,
int  range 
) [inline]

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

Definition at line 640 of file color.h.

void COLOR::SetRGB ( const COLOR color  )  [inline]

Set red, green, blue values from COLOR.

Original flag and transparency values are retained.

Definition at line 631 of file color.h.

void COLOR::SetRGB ( UINT16  red,
UINT16  green,
UINT16  blue 
) [inline]

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

Original flag and transparency values are retained.

Definition at line 616 of file color.h.

void COLOR::SetTransparency ( UINT8  transparency  )  [inline]

Set transparency value.

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

Definition at line 656 of file color.h.

void COLOR::Validate (  )  [inline]

Validate status for some legacy stored color instances.

Definition at line 666 of file color.h.


The documentation for this struct was generated from the following file:
Generated on Thu Apr 26 04:47:01 2007 for TNTsdk by  doxygen 1.5.2