COLOR Struct Reference

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

#include <mi32/color.h>

List of all members.

Public Types

enum  CAPABILITY { CAPABILITY_NoTransparency = 0, CAPABILITY_AllowTransparent = 1, CAPABILITY_AllowTransparency = 2, CAPABILITY_AsPrevious = 3 }
enum  MODEL { MODEL_RGB = 0, MODEL_CMY = 1, MODEL_CMYK = 2, MODEL_COUNT }
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 = 0x002A2AA5, PURPLE = 0x00A020F0, DARKRED = 0x00000080, DARKGREEN = 0x00008000,
  DARKBLUE = 0x00800000, DARKCYAN = 0x00808000, DARKMAGENTA = 0x00A000A0, DARKYELLOW = 0x00008080,
  FORESTGREEN = 0x00228B22, WHITE = 0x00FFFFFF, INTERFACE_RED = 0x009C9CFF, INTERFACE_YELLOW = 0x009CFFFF,
  INTERFACE_GREEN = 0x009CFF9C, INTERFACE_CYAN = 0x00FFFF9C
}

Public Member Functions

 COLOR (NAME name)
 COLOR (UINT32 ColorRef)
 COLOR (UINT16 r16, UINT16 g16, UINT16 b16)
 COLOR ()
void Blend (const COLOR &other, UINT8 alpha=128)
void Clear ()
 DEPRECATED_MSG ("Deprecated, use SetColor method instead.") void SetRGB(const COLOR &color)
ERRVALUE GetByColorSpace (COLORSPACE colorspace, void *values) const
void GetCMY (UINT16 &c16, UINT16 &m16, UINT16 &y16) const
void GetCMY (UINT8 &c8, UINT8 &m8, UINT8 &y8) const
void GetCMYK (UINT16 &c16, UINT16 &m16, UINT16 &y16, UINT16 &k16) const
void GetCMYK (UINT8 &c8, UINT8 &m8, UINT8 &y8, UINT8 &k8) const
UINT32 GetColor0BGR32 () const
UINT32 GetColor0RGB32 () const
UINT32 GetColorABGR32 () const
UINT32 GetColorARGB32 () const
DEPRECATED COLORMODEL GetColorModel () const
UINT32 GetColorRef () const
void GetIniValues (UINT16 values[4]) const
MODEL GetModel () const
UINT8 GetOpacity () const
void GetRGB (UINT16 *rgb) const
void GetRGB (UINT16 &r16, UINT16 &g16, UINT16 &b16) const
void GetRGB (UINT8 *rgb) const
void GetRGB (UINT8 &r8, UINT8 &g8, UINT8 &b8) const
void GetRGBA (float &r, float &g, float &b, float &a) const
UINT8 GetTransparency () const
bool HasTransparency () const
bool HasValue () const
bool IniRead (INIHANDLE hdl, const char *group, const char *field)
void IniWrite (INIHANDLE hdl, const char *group, const char *field) 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 SetCMY8 (UINT8 c8, UINT8 m8, UINT8 y8)
void SetCMYK (int cyan, int magenta, int yellow, int black, int range)
void SetCMYK8 (UINT8 c8, UINT8 m8, UINT8 y8, UINT8 k8)
void SetColor (const COLOR &color)
void SetColorABGR32 (UINT32 abgr32)
void SetColorARGB32 (UINT32 argb32)
void SetColorRef (UINT32 ColorRef)
void SetColorXBGR32 (UINT32 xbgr32)
void SetColorXRGB32 (UINT32 xrgb32)
void SetIniValues (const UINT16 values[4])
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 (UINT16 red, UINT16 green, UINT16 blue)
void SetRGB8 (UINT8 r8, UINT8 g8, UINT8 b8)
void SetTransparency (UINT8 transparency)
void SwapBytes ()
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.


Member Enumeration Documentation

Color capabilities.

Enumerator:
CAPABILITY_NoTransparency 

Don't allow any transparency.

CAPABILITY_AllowTransparent 

Allow fully transparent, but not partial.

CAPABILITY_AllowTransparency 

Allow both full and partial transparency.

CAPABILITY_AsPrevious 

Use previously specified capability.

Color "model" enumeration.

Enumerator:
MODEL_RGB 

Red-Green-Blue.

MODEL_CMY 

Cyan-Magenta-Yellow.

MODEL_CMYK 

Cyan-Magenta-Yellow-Black.

MODEL_COUNT 

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 
INTERFACE_RED 
INTERFACE_YELLOW 
INTERFACE_GREEN 
INTERFACE_CYAN 

Constructor & Destructor Documentation

COLOR::COLOR (  )  [inline]

Default constructor.

COLOR::COLOR ( UINT16  r16,
UINT16  g16,
UINT16  b16 
) [inline]

Construct with specified red, green, blue values.

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

Construct by color reference.

COLOR::COLOR ( NAME  name  )  [inline]

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

Clear current color setting.

COLOR::DEPRECATED_MSG ( Deprecated,
use SetColor method instead."   
) const

Set red, green, blue values from COLOR.

Original flag and transparency values are retained.

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
void COLOR::GetCMY ( UINT16 c16,
UINT16 m16,
UINT16 y16 
) const

Get as Cyan-Magenta-Yellow 16-bit values in range (0-UINT16_MAX).

Parameters:
c16 Cyan returned
m16 Magenta returned
y16 Yellow returned
void COLOR::GetCMY ( UINT8 c8,
UINT8 m8,
UINT8 y8 
) const

Get as Cyan-Magenta-Yellow 8-bit values in range (0-255).

Parameters:
c8 Cyan returned (0-255)
m8 Magenta returned (0-255)
y8 Yellow returned (0-255)
void COLOR::GetCMYK ( UINT16 c16,
UINT16 m16,
UINT16 y16,
UINT16 k16 
) const

Get as Cyan-Magenta-Yellow-Black 16-bit values in range (0-UINT16_MAX).

Parameters:
c16 Cyan returned
m16 Magenta returned
y16 Yellow returned
k16 Black returned
void COLOR::GetCMYK ( UINT8 c8,
UINT8 m8,
UINT8 y8,
UINT8 k8 
) const

Get as Cyan-Magenta-Yellow-Black 8-bit values in range (0-255).

Parameters:
c8 Cyan returned (0-255)
m8 Magenta returned (0-255)
y8 Yellow returned (0-255)
k8 Black returned (0-255)
UINT32 COLOR::GetColor0BGR32 (  )  const

Get color as (0x00BBGGRR) UINT32.

Returns:
Color value with red in lowest bits.
UINT32 COLOR::GetColor0RGB32 (  )  const

Get color as (0x00RRGGBB) UINT32.

Returns:
Color value with blue in lowest bits.
UINT32 COLOR::GetColorABGR32 (  )  const

Get color as (0xAABBGGRR) UINT32.

Returns:
Color value with red in lowest bits.
UINT32 COLOR::GetColorARGB32 (  )  const

Get color as (0xAARRGGBB) UINT32.

Returns:
Color value with blue in lowest bits.
DEPRECATED COLORMODEL COLOR::GetColorModel (  )  const

Get color model.

UINT32 COLOR::GetColorRef (  )  const [inline]

Get WIN32 color reference (0x00BBGGRR).

void COLOR::GetIniValues ( UINT16  values[4]  )  const

Get array of values to store in Ini file.

MODEL COLOR::GetModel (  )  const

Get color model.

UINT8 COLOR::GetOpacity (  )  const [inline]

Get opacity value (0-255).

void COLOR::GetRGB ( UINT16 rgb  )  const [inline]

Get Red, Green, Blue values as UINT16 array.

void COLOR::GetRGB ( UINT16 r16,
UINT16 g16,
UINT16 b16 
) const

Get Red, Green, Blue values as UINT16 values.

void COLOR::GetRGB ( UINT8 rgb  )  const [inline]

Get Red, Green, Blue values as UINT8 array.

void COLOR::GetRGB ( UINT8 r8,
UINT8 g8,
UINT8 b8 
) const

Get Red, Green, Blue values as UINT8 values.

void COLOR::GetRGBA ( float &  r,
float &  g,
float &  b,
float &  a 
) const

Get Red, Green, Blue, Alpha values as float values in range (0-1).

Parameters:
r Red returned in range 0-1
g Green returned in range 0-1
b Blue returned in range 0-1
a Alpha returned in range 0-1
UINT8 COLOR::GetTransparency (  )  const [inline]

Retrieve transparency value.

Returns:
Transparency (0 - 255), 0 = opaque, 255 = 100% transparent.
bool COLOR::HasTransparency (  )  const [inline]

Determine if has any transparency value.

bool COLOR::HasValue (  )  const [inline]

Determine if a color value has been set.

bool COLOR::IniRead ( INIHANDLE  hdl,
const char *  group,
const char *  field 
)

Read value from INI file.

void COLOR::IniWrite ( INIHANDLE  hdl,
const char *  group,
const char *  field 
) const

Write value to INI file.

bool COLOR::IsEqualNoTransp ( const COLOR rhs  )  const

Compare colors for equality, excluding transparency settings.

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

Compare colors for equality, including transparency, etc.

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.

bool COLOR::IsInvisible (  )  const [inline]

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

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.

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

Assign by enumerated name.

Original 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::SetCMY8 ( UINT8  c8,
UINT8  m8,
UINT8  y8 
)

Set from Cyan, Magenta, Yellow as UINT8.

Parameters:
c8 Cyan 0-255
m8 Magenta 0-255
y8 Yellow 0-255
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::SetCMYK8 ( UINT8  c8,
UINT8  m8,
UINT8  y8,
UINT8  k8 
)

Set from Cyan, Magenta, Yellow, Black as UINT8.

Parameters:
c8 Cyan 0-255
m8 Magenta 0-255
y8 Yellow 0-255
k8 Black 0-255
void COLOR::SetColor ( const COLOR color  ) 

Set from COLOR, retaining original transparency value.

Model will be changed to match specified color.

Parameters:
color Color value to set
void COLOR::SetColorABGR32 ( UINT32  abgr32  ) 

Set from color value as (0xAABBGGRR) UINT32.

Original flag values are retained, model will be changed to RGB.

Parameters:
abgr32 Color and opacity value to set
void COLOR::SetColorARGB32 ( UINT32  argb32  ) 

Set from color value as (0xAARRGGBB) UINT32.

Original flag values are retained, model will be changed to RGB.

Parameters:
argb32 Color and opacity value to set
void COLOR::SetColorRef ( UINT32  ColorRef  )  [inline]

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

Original flag and transparency values are retained, model will be changed to RGB.

void COLOR::SetColorXBGR32 ( UINT32  xbgr32  ) 

Set from color value as (0x??BBGGRR) UINT32.

Original flag and transparency values are retained, model will be changed to RGB.

Parameters:
xbgr32 Color value to set
void COLOR::SetColorXRGB32 ( UINT32  xrgb32  ) 

Set from color value as (0x??RRGGBB) UINT32.

Original flag and transparency values are retained, model will be changed to RGB.

Parameters:
xrgb32 Color value to set
void COLOR::SetIniValues ( const UINT16  values[4]  ) 

Set from array of values read from Ini file.

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 ( UINT16  red,
UINT16  green,
UINT16  blue 
)

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

Original flag and transparency values are retained.

void COLOR::SetRGB8 ( UINT8  r8,
UINT8  g8,
UINT8  b8 
)

Set red, green, blue values from UINT8.

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

Perform byte-swapping.

void COLOR::Validate (  ) 

Validate status for some legacy stored color instances.


The documentation for this struct was generated from the following file:

Generated on Sun Oct 7 21:33:15 2012 for TNTsdk 2012 by  doxygen 1.6.1