CartoType API
Public Member Functions | Public Attributes
CartoType::TColor Class Reference

#include <cartotype_graphics.h>

List of all members.

Public Member Functions

 TColor ()
 TColor (uint32 aValue)
 TColor (int32 aRed, int32 aGreen, int32 aBlue, int32 aAlpha=0xFF)
bool operator== (const TColor &aColor) const
bool operator!= (const TColor &aColor) const
int32 Red () const
int32 Green () const
int32 Blue () const
int32 Gray () const
int32 Alpha () const
void SetAlpha (int32 aAlpha)
CT_IMPORT void CombineAlpha (int32 aAlpha)
CT_IMPORT void PremultiplyAlpha ()
CT_IMPORT void Blend (const TColor &aOtherColor, int32 aOtherColorAlpha)

Public Attributes

uint32 iValue

Detailed Description

A color.

Colors are represented by 32-bit integers containing 8 bits each of red, green, blue and alpha channel (transparency) data.


Constructor & Destructor Documentation

CartoType::TColor::TColor ( ) [inline]

Create a color and set it to opaque black.

CartoType::TColor::TColor ( uint32  aValue) [inline]

Create a color from an integer value.

CartoType::TColor::TColor ( int32  aRed,
int32  aGreen,
int32  aBlue,
int32  aAlpha = 0xFF 
) [inline]

Create a color from red, green, blue and alpha values.


Member Function Documentation

int32 CartoType::TColor::Alpha ( ) const [inline]

Return the alpha (transparency) level as a value in the range 0...255: 0 = transparent, 255 = opaque.

CT_EXPORT void TColor::Blend ( const TColor aOtherColor,
int32  aOtherColorAlpha 
)

Blend aOtherColor with this color in the proportion specified by aOtherColorAlpha, which must be in the range 0...255.

int32 CartoType::TColor::Blue ( ) const [inline]

Return the blue component as a value in the range 0...255.

CT_EXPORT void TColor::CombineAlpha ( int32  aAlpha)

Multiply the current alpha value by a new alpha value in the range 0...255.

int32 CartoType::TColor::Gray ( ) const [inline]

Return the gray level (average of red, green and blue levels) as a value in the range 0...255.

int32 CartoType::TColor::Green ( ) const [inline]

Return the green component as a value in the range 0...255.

bool CartoType::TColor::operator!= ( const TColor aColor) const [inline]

The inequality operator.

bool CartoType::TColor::operator== ( const TColor aColor) const [inline]

The equality operator.

CT_EXPORT void TColor::PremultiplyAlpha ( )

Convert a color to premultiplied-alpha format. This function assumes that the color is in non-premultiplied-alpha format, where the three color components can have any value, and multiplies the color components by the alpha value, yielding values in the range 0...alpha.

Premultiplied alpha format is the format used by CartoType in 32bpp RGBA bitmaps, and as the return value of MPaintServer::Color.

int32 CartoType::TColor::Red ( ) const [inline]

Return the red component as a value in the range 0...255.

void CartoType::TColor::SetAlpha ( int32  aAlpha) [inline]

Set the alpha (transparency) level to a value in the range 0...255: 0 = transparent, 255 = opaque.


Member Data Documentation

The color value, containing, starting with the least significant byte, red, green, blue and alpha levels, each stored in eight bits. The color levels represent intensity. The alpha level represents opacity.


The documentation for this class was generated from the following files: