|
Jameo Core Library
|
A class as a colour representation is so fundamental for us that it is used as a basic data type. The storage is as universal as possible. The special thing about this data type is that it stores the values "differently" depending on the mode. The data type is extremely space-saving. It only requires 6 bytes. More...
Public Member Functions | |
| Color () | |
| Constructor. | |
| Color (const Color &other) | |
| Copy construktur. | |
| ~Color ()=default | |
| Destructor. | |
| Color & | operator= (const Color &other) |
| const Color & | toRgb () |
| Converts the colour to the RGB colour space. | |
| void | toCmyk () |
| Converts the colour to the CMYK colour space. | |
| void | toGreyScale () |
| Converts the colour to the greyscale colour space. | |
| uint8 | alpha () const |
| Returns alpha component directly. 0 = transparent, 255 = opaque. | |
| uint8 | red () const |
| Returns red component directly. | |
| uint8 | green () const |
| Returns green component directly. | |
| uint8 | blue () const |
| Returns blue component directly. | |
| uint8 | grey () const |
| Returns grey component directly. | |
| uint8 | cyan () const |
| Returns cyan component directly. | |
| uint8 | magenta () const |
| Returns magenta component directly. | |
| uint8 | yellow () const |
| Returns yellow component directly. | |
| uint8 | key () const |
| Returns key (black) component directly. | |
| ColorMode | mode () const |
| Returns the colour mode. | |
| bool | isWhite () const |
| Is the colour white? | |
| void | hsvModel (float &hue, float &saturation, float &value) const |
| Returns the HSV values of this colour. If the colour is not created in the RGB colour space, this method first temporarily converts the colour to the RFB colour space. | |
| void | setMode (ColorMode mode) |
| Sets the colour space directly. | |
| void | setAlpha (uint8 alpha) |
| Directly sets the transparency. 0 = transparent, 255 = opaque. | |
| void | setRed (uint8 red) |
| Sets the red component directly. | |
| void | setGreen (uint8 green) |
| Sets the green component directly. | |
| void | setBlue (uint8 blue) |
| Sets the blue component directly. | |
| void | setGrey (uint8 grey) |
| Sets the grey component directly. | |
| void | setCyan (uint8 cyan) |
| Sets the cyan component directly. | |
| void | setMagenta (uint8 magenta) |
| Sets the magenta component directly. | |
| void | setYellow (uint8 yellow) |
| Sets the yellow component directly. | |
| void | setKey (uint8 key) |
| Sets the key (black) component directly. | |
Static Public Member Functions | |
| static Color | fromGrey (uint8 grey, uint8 alpha=255) |
| This method creates a colour in the colour space "greyscale". 0 means black, 255 means white. | |
| static Color | fromRgb (uint8 red, uint8 green, uint8 blue, uint8 alpha=255) |
| This method creates a colour in the colour space "RGB". 0 means black/dark/no colour, 255 means white/light/full colour. | |
| static Color | fromCmyk (uint8 cyan, uint8 magenta, uint8 yellow, uint8 key, uint8 alpha=255) |
| This method creates a colour in the colour space "CMYK". 0 means no colour (white on paper), 255 means full colour (dark on paper) | |
| static Color | FromHsv (float hue, float saturation, float value, float alpha=1.0) |
| This method creates a colour in the colour space "RGB" using the HSV model. All specifications in the space from 0.0-1.0. | |
Friends | |
| DllExport friend bool | operator== (Color const &c1, Color const &c2) |
| DllExport friend bool | operator!= (Color const &c1, Color const &c2) |
| DllExport friend Color | operator- (Color const &c1, Color const &c2) |
| DllExport friend Color | operator+ (Color const &c1, Color const &c2) |
| DllExport friend Color | blend (Color background, Color foreground, uint8 alpha) |
| DllExport friend Color | interpolate (Color colour1, Color colour2, float percent) |
A class as a colour representation is so fundamental for us that it is used as a basic data type. The storage is as universal as possible. The special thing about this data type is that it stores the values "differently" depending on the mode. The data type is extremely space-saving. It only requires 6 bytes.
| jm::Color::Color | ( | ) |
Constructor.
| jm::Color::Color | ( | const Color & | other | ) |
Copy construktur.
| other | The colour we became a copy of. |
|
default |
Destructor.
| uint8 jm::Color::alpha | ( | ) | const |
Returns alpha component directly. 0 = transparent, 255 = opaque.
Value is colour space independent.
| uint8 jm::Color::blue | ( | ) | const |
Returns blue component directly.
| uint8 jm::Color::cyan | ( | ) | const |
Returns cyan component directly.
|
static |
This method creates a colour in the colour space "CMYK". 0 means no colour (white on paper), 255 means full colour (dark on paper)
|
static |
This method creates a colour in the colour space "greyscale". 0 means black, 255 means white.
|
static |
This method creates a colour in the colour space "RGB" using the HSV model. All specifications in the space from 0.0-1.0.
|
static |
This method creates a colour in the colour space "RGB". 0 means black/dark/no colour, 255 means white/light/full colour.
| uint8 jm::Color::green | ( | ) | const |
Returns green component directly.
| uint8 jm::Color::grey | ( | ) | const |
Returns grey component directly.
| void jm::Color::hsvModel | ( | float & | hue, |
| float & | saturation, | ||
| float & | value | ||
| ) | const |
Returns the HSV values of this colour. If the colour is not created in the RGB colour space, this method first temporarily converts the colour to the RFB colour space.
| hue | Output filled in with the hue value. |
| saturation | Output filled in with the saturation value. |
| value | Output filled in with the brightness value. |
| bool jm::Color::isWhite | ( | ) | const |
Is the colour white?
| uint8 jm::Color::key | ( | ) | const |
Returns key (black) component directly.
| uint8 jm::Color::magenta | ( | ) | const |
Returns magenta component directly.
| ColorMode jm::Color::mode | ( | ) | const |
Returns the colour mode.
| uint8 jm::Color::red | ( | ) | const |
Returns red component directly.
| void jm::Color::setAlpha | ( | uint8 | alpha | ) |
Directly sets the transparency. 0 = transparent, 255 = opaque.
| void jm::Color::setBlue | ( | uint8 | blue | ) |
Sets the blue component directly.
| void jm::Color::setCyan | ( | uint8 | cyan | ) |
Sets the cyan component directly.
| void jm::Color::setGreen | ( | uint8 | green | ) |
Sets the green component directly.
| void jm::Color::setGrey | ( | uint8 | grey | ) |
Sets the grey component directly.
| void jm::Color::setKey | ( | uint8 | key | ) |
Sets the key (black) component directly.
| void jm::Color::setMagenta | ( | uint8 | magenta | ) |
Sets the magenta component directly.
| void jm::Color::setMode | ( | ColorMode | mode | ) |
Sets the colour space directly.
| void jm::Color::setRed | ( | uint8 | red | ) |
Sets the red component directly.
| void jm::Color::setYellow | ( | uint8 | yellow | ) |
Sets the yellow component directly.
| void jm::Color::toCmyk | ( | ) |
Converts the colour to the CMYK colour space.
| void jm::Color::toGreyScale | ( | ) |
Converts the colour to the greyscale colour space.
The following algorithm is used: G = 0.2126 R + 0.7152 G + 0.0722 B.
| const Color & jm::Color::toRgb | ( | ) |
Converts the colour to the RGB colour space.
| uint8 jm::Color::yellow | ( | ) | const |
Returns yellow component directly.
| uint8 jm::Color::blue |
| struct { ... } jm::Color::cmyk |
| uint8 jm::Color::cyan |
| struct { ... } jm::Color::g |
| uint8 jm::Color::green |
| uint8 jm::Color::grey |
| uint8 jm::Color::key |
| uint8 jm::Color::magenta |
| uint8 jm::Color::red |
| struct { ... } jm::Color::rgb |
| uint8 jm::Color::yellow |