#include <tb_color.hpp>
Public Member Functions | |
| constexpr | Color (void) noexcept |
| constexpr | Color (const tbCore::uint32 &colorARGB) noexcept |
| constexpr | Color (const float clampedAlpha, const float clampedRed, const float clampedGreen, const float clampedBlue) noexcept |
| bool | SetColor (const tbCore::DynamicStructure &colorData, bool triggerErrorOnFailure=true) |
| void | SetColor (const tbCore::uint32 &colorARGB) |
| void | SetColor (const float clampedAlpha, const float clampedRed, const float clampedGreen, const float clampedBlue) |
| void | SetColor (const float clampedTween, const Color &startColor, const Color &finalColor) |
| tbCore::uint32 | GetColorARGB (void) const |
| tbCore::uint32 | GetColorABGR (void) const |
| tbCore::uint8 | GetAlphaByte (void) const |
| tbCore::uint8 | GetRedByte (void) const |
| tbCore::uint8 | GetGreenByte (void) const |
| tbCore::uint8 | GetBlueByte (void) const |
| float | GetAlpha (void) const |
| void | SetAlpha (const float alpha) |
| void | SetAlpha (const int alpha) |
| float | GetRed (void) const |
| void | SetRed (const float red) |
| void | SetRed (const int red) |
| float | GetGreen (void) const |
| void | SetGreen (const float green) |
| void | SetGreen (const int green) |
| float | GetBlue (void) const |
| void | SetBlue (const float blue) |
| void | SetBlue (const int blue) |
Stores a 24 bit color with 8 bit alpha and provides an interface to set the color through a variety of inputs either floating point channels or unsigned byte channels.
|
inlineconstexprnoexcept |
Constructs a default Color object with all channels fully on including alpha, resulting in white.
|
inlineexplicitconstexprnoexcept |
Constructs a Color object from the 32bit color value with each channel as a byte in the order Alpha, Red, Green, Blue.
|
inlineexplicitconstexprnoexcept |
Constructs a Color object based on floats for each of the channels. Each channel should be clamped in the range of 0.0f to 1.0f, although that will happen automatically when setting a color in this function.
| clampedAlpha | The amount of alpha to use for the color from transparent 0.0f to opaque 1.0f. |
| clampedRed | The amount of red to use for the color from none 0.0f to full 1.0f. |
| clampedGreen | The amount of green to use for the color from none 0.0f to full 1.0f. |
| clampedBlue | The amount of blue to use for the color from none 0.0f to full 1.0f. |
| float TurtleBrains::Graphics::Color::GetAlpha | ( | void | ) | const |
Returns the clamped value of the alpha channel from transparent at 0.0f to 1.0f fully opaque.
| tbCore::uint8 TurtleBrains::Graphics::Color::GetAlphaByte | ( | void | ) | const |
Returns the byte value of the alpha channel from transparent at 0 to 255 fully opaque.
| float TurtleBrains::Graphics::Color::GetBlue | ( | void | ) | const |
Returns the clamped value of the blue channel from 0.0f to 1.0f representing full blue.
| tbCore::uint8 TurtleBrains::Graphics::Color::GetBlueByte | ( | void | ) | const |
Returns the byte value of the blue channel from 0 to 255 for full blue.
| tbCore::uint32 TurtleBrains::Graphics::Color::GetColorABGR | ( | void | ) | const |
Computes and returns the 32bit color with each channel as a byte in the order Alpha, Blue, Green, Red.
| tbCore::uint32 TurtleBrains::Graphics::Color::GetColorARGB | ( | void | ) | const |
Returns the 32bit color value with each channel as a byte in the order Alpha, Red, Green, Blue.
| float TurtleBrains::Graphics::Color::GetGreen | ( | void | ) | const |
Returns the clamped value of the green channel from 0.0f to 1.0f representing full green.
| tbCore::uint8 TurtleBrains::Graphics::Color::GetGreenByte | ( | void | ) | const |
Returns the byte value of the green channel from 0 to 255 for full green.
| float TurtleBrains::Graphics::Color::GetRed | ( | void | ) | const |
Returns the clamped value of the red channel from 0.0f to 1.0f representing full red.
| tbCore::uint8 TurtleBrains::Graphics::Color::GetRedByte | ( | void | ) | const |
Returns the byte value of the red channel from 0 to 255 for full red.
| void TurtleBrains::Graphics::Color::SetColor | ( | const float | clampedAlpha, |
| const float | clampedRed, | ||
| const float | clampedGreen, | ||
| const float | clampedBlue | ||
| ) |
Set the color value based on floats for each of the channels. Each channel should be clamped in the range of 0.0f to 1.0f, although that will happen automatically when setting a color in this function.
| clampedAlpha | The amount of alpha to use for the color from transparent 0.0f to opaque 1.0f. |
| clampedRed | The amount of red to use for the color from none 0.0f to full 1.0f. |
| clampedGreen | The amount of green to use for the color from none 0.0f to full 1.0f. |
| clampedBlue | The amount of blue to use for the color from none 0.0f to full 1.0f. |
| void TurtleBrains::Graphics::Color::SetColor | ( | const float | clampedTween, |
| const Color & | startColor, | ||
| const Color & | finalColor | ||
| ) |
Sets a color to be a color in between a startColor and finalColor by linearly interpolating between the two values.
| clampedTween | The amount of interpolation to be applied from 0.0f to be startColor and 1.0f to be the finalColor. Any value in between will use linear interpolation, so 0.5f is the color halfway between the startColor and finalColor. |
| startColor | A color the start from for the in-between linear interpolation. |
| finalColor | A color at the end of the in-between linear interpolation. |
| bool TurtleBrains::Graphics::Color::SetColor | ( | const tbCore::DynamicStructure & | colorData, |
| bool | triggerErrorOnFailure = true |
||
| ) |
Returns a Color object based on a dynamic structure of information. The information can be: A string represnting a color name in the palette, a string of hexadecimal ARGB values starting with 0xFFFFFFFF. More support to come in the future.
| colorData | The dynamic structure object holding the data for the color. |
| triggerErrorOnFailure | When set to false no error conditions will be triggered, only false returned, color will remain unchanged. |
| void TurtleBrains::Graphics::Color::SetColor | ( | const tbCore::uint32 & | colorARGB | ) |
Sets the color value based on the 32bit value with each channel as a byte in the order Alpha, Red, Green, Blue.