Color class

From Solid Graphics Wiki

(Redirected from Color)
Jump to: navigation, search
Color class
Namespace: SKL3D
Base type: (None)
Include: Skl3DDraw.h
Lib (Release): SKL.lib
Lib (Debug): SKL_D.lib

The Color class specifies a color using color's red, green, blue and alpha (transparency) components using float precision.



Constructors

Default color class constructor does not initialize the color components to any value. This is on purpose for performance reasons. Other class costructors allow to initialize the color object it's component values, or from o pointer to four float values.

Fields

Field name Type Description
red float The red color component.
green float The green color component.
blue float The blue color component.
alpha float The transparency/opacity color component. Value 0.0f means that the color is transparent, value 1.0f means that the color is opaque.

Methods

The class has no public methods.

Helper Functions

SolidKit Library provides these additional helper function for the color class:

Method name Description
ColorToColorRef Translates Color object to Window's COLORREF type value.
ColorRefToColor Translates Window's COLORREF type value to Color object. The alpha component of the Color is initialized to 1.0f (opaque).

Operators

+ Adds components of another color to the color object instance.
* Multiplies components of the color with components of another color object instance.
const float* Provides access to the color components as const pointer to four float values. The color components are ordered in this order: red, green, blue, alpha.
float* Provides access to the color components as pointer to four float values. The color components are ordered in this order: red, green, blue, alpha.

Predefined color constants

The Color class defines these static constants: White, LightGray, DimGray, DarkGray, Gray, Black, Yellow, Red, Green, Blue, Orange. The constants can be accessed by the Color class scope, for example:

Color theColor( Color::Red );

See Also

   


SolidKit Library Documentation

Personal tools