Main Page   Class Hierarchy   Compound List   File List   Compound Members  

KrColorTransform Class Reference

A class that defines a color transformation. More...

#include <color.h>

List of all members.

Public Methods

void SetIdentity ()
 Clear all color transformations.

void SetAlpha (U8 a)
 Set the alpha. 0 is transparent and 255 is opaque.

void TintRed (U8 tint)
 Tint but leave the other channels unchanged.

void TintGreen (U8 tint)
 Tint but leave the other channels unchanged.

void TintBlue (U8 tint)
 Tint but leave the other channels unchanged.

void TintAlpha (U8 tint)
 Only sets alpha, but in inverse: 0 is opaque.

void Brighten (U8 val)
 Approximate brightening -- not symmetric with darken. val==0 is no change.

void Darken (U8 val)
 Approximate darkening -- not symmetric with brighten. val==0 is no change.

void Set (U8 mRed, U8 bRed, U8 mGreen, U8 bGreen, U8 mBlue, U8 bBlue, U8 alpha)
 Arbitrary set of the components. More...

void SetRed (U8 _m, U8 _b)
 Arbitrary red set (other channel will not be affected.).

void SetGreen (U8 _m, U8 _b)
 Arbitrary green set (other channel will not be affected.).

void SetBlue (U8 _m, U8 _b)
 Arbitrary blue set (other channel will not be affected.).


Detailed Description

A class that defines a color transformation.

Unlike vectors and rectangles, it has many invalid states and is better ecapselated. It does have a constructor, and it's private data can not be directly accessed.

c' = m * c / 255 + b / 255

where:

c will always be in the range of 0-255. m and b must be specified so that c' will always be in the range of 0-255 as well. In other words, this is an unbounded transform. If colors out of range occur, strange things will happen.

Using the "Friendly API" this will never be a problem: values will be kept in range for you. When using Set* directly, however, be cautious.


Member Function Documentation

void KrColorTransform::Set U8    mRed,
U8    bRed,
U8    mGreen,
U8    bGreen,
U8    mBlue,
U8    bBlue,
U8    alpha
 

Arbitrary set of the components.

Gives lots of control over the color transformation. The color is transformed by the equation:

c' = m * c / 255 + b / 255

where:

  • c is the original color component, either the red, green, blue, or alpha component.
  • c' is the transformed color component.
c will always be in the range of 0-255. m and b must be specified so that c' will always be in the range of 0-255 as well. In other words, this is an unbounded transform. If colors out of range occur, strange things will happen.

The "friendly api", above, will always guarentee color transformations are correctly bounded.


The documentation for this class was generated from the following file:
Generated on Mon Sep 15 12:01:11 2003 for Kyra by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001