Created RgbColor object API (markdown)

Michael Miller
2016-02-26 17:57:26 -08:00
parent 085a87ffab
commit ce3af6149f

54
RgbColor-object-API.md Normal file

@@ -0,0 +1,54 @@
RgbColor represents a color object that is represented by Red, Green, Blue component values.
## Properties
There are three properties that represent the component values Red, Green, and Blue. The values range from 0 to 255. Black would 0,0,0 and white would be 255,255,255.
```
uint8_t R;
uint8_t G;
uint8_t B;
```
## Constructors
### RgbColor(uint8_t r, uint8_t g, uint8_t b) :
Constructs a RgbColor using Red, Green, and Blue color component values.
### RgbColor(uint8_t brightness)
Constructs a RgbColor using a single brightness value(0 - 255). This works well for creating gray tone colors.
(0) = black, (255) = white, (128) = gray
### RgbColor(HslColor color);
Construct a RgbColor using HslColor, converting the Hsl to Rgb
### RgbColor(HsbColor color);
Construct a RgbColor using HsbColor, converting the Hsb to Rgb
### RgbColor()
Construct a RgbColor that will have its values set in latter operations.
CAUTION: The R,G,B members are not initialized and may not be consistent until set.
## Methods
### uint8_t CalculateBrightness();
CalculateBrightness will calculate the overall brightness.
NOTE: This is a simple linear brightness
### void Darken(uint8_t delta);
Darken will adjust the color by the given delta toward black.
NOTE: This is a simple linear change.
delta - (0-255) the amount to dim the color by.
### void Lighten(uint8_t delta);
Lighten will adjust the color by the given delta toward white.
NOTE: This is a simple linear change.
delta - (0-255) the amount to lighten the color by.
### static RgbColor LinearBlend(RgbColor left, RgbColor right, float progress);
This will blend between two colors by the amount defined by the progress variable.
left - the color to start the blend at.
right - the color to end the blend at.
progress - (0.0f - 1.0f) value where 0.0f will return left and 1.0f will return right and a value between will blend the color weighted linearly between them.
This is a static function, which means you need to call it scoped to the object class and not an instance like...
```
RgbColor results = RgbColor::LinearBlend(RgbColor(255,0,0), RgbColor(0,255,0), 0.33f);
```