This class represents the colour format most used by the Deluge globally.
More...
#include <rgb.h>
|
using | channel_type = uint8_t |
| The size of each colour channel.
|
|
|
constexpr RGB & | operator= (const RGB &other)=default |
| Copies RGB values from a colour.
|
|
template<typename UnaryOp>
requires std::convertible_to<UnaryOp, std::function<channel_type(channel_type)>> |
constexpr RGB | transform (UnaryOp transformFn) const |
| Create a new colour by transforming each channel of a colour.
|
|
constexpr RGB | forTail () const |
| Create a derived colour for tails (used by views)
|
|
constexpr RGB | forBlur () const |
| Create a derived colour for blurs (used by views)
|
|
constexpr RGB | dim (uint8_t level=1) const |
| Dim a colour.
|
|
constexpr RGB | dull () const |
| Dull a colour, clamping it to [5, 50].
|
|
constexpr RGB | greyOut (int32_t proportion) |
| Grey out a colour.
|
|
bool | operator== (RGB const &) const =default |
| Compare two colours to determine if they're the same.
|
|
constexpr channel_type & | operator[] (size_t idx) |
| Legacy access to the colour internals for ease of use.
|
|
constexpr channel_type * | begin () |
| Iterator constructor pointing to the beginning of this structure.
|
|
constexpr channel_type * | end () |
| Iterator constructor for the end sentinel of this structure.
|
|
constexpr RGB | adjust (uint8_t intensity, uint8_t brightnessDivider) const |
| Adjust a colour by altering its intensity and brightness.
|
|
constexpr RGB | adjustFractional (uint16_t numerator, uint16_t divisor) const |
| Adjust a colour by altering its intensity and brightness. Intensity/brightnessDivider must be less than 1.
|
|
constexpr RGB | rotate () |
|
|
static constexpr RGB | monochrome (uint8_t brightness) |
| Construct a monochrome (white) shade.
|
|
static RGB | fromHue (int32_t hue) |
| Construct a colour from a hue.
|
|
static RGB | fromHuePastel (int32_t hue) |
| Construct a colour from a hue.
|
|
static constexpr RGB | average (RGB colourA, RGB colourB) |
| Average two colours together.
|
|
static constexpr RGB | blend (RGB sourceA, RGB sourceB, uint16_t index) |
| Generate a new colour made from blending two source colours.
|
|
static constexpr RGB | blend2 (RGB sourceA, RGB sourceB, uint16_t indexA, uint16_t indexB) |
| Generate a new colour made from blending two source colours with individual proportions.
|
|
static constexpr size_t | size () |
| Used in combination with operator[] and begin end.
|
|
template<typename BinaryOp>
requires std::convertible_to<BinaryOp, std::function<channel_type(channel_type, channel_type)>> |
static constexpr RGB | transform2 (RGB colourA, RGB colourB, BinaryOp transformFn) |
| Create a new colour by transforming the channels of two colours.
|
|
|
constexpr RGB | xform (const uint32_t mat[4][4]) |
|
|
static constexpr channel_type | blendChannel (uint32_t channelA, uint32_t channelB, uint16_t index) |
| Blend a channel in equal proportions.
|
|
static constexpr channel_type | blendChannel2 (uint32_t channelA, uint32_t channelB, uint16_t indexA, uint16_t indexB) |
| Blend two channels in differing proportions.
|
|
|
static constexpr uint32_t | IMat [4][4] |
|
static constexpr float | c = 0.5403f |
|
static constexpr float | s = 0.8414f |
|
static constexpr uint32_t | RMat [4][4] |
|
This class represents the colour format most used by the Deluge globally.
◆ adjust()
RGB RGB::adjust |
( |
uint8_t | intensity, |
|
|
uint8_t | brightnessDivider ) const |
|
inlinenodiscardconstexpr |
Adjust a colour by altering its intensity and brightness.
- Returns
- RGB The new colour
◆ adjustFractional()
RGB RGB::adjustFractional |
( |
uint16_t | numerator, |
|
|
uint16_t | divisor ) const |
|
inlinenodiscardconstexpr |
Adjust a colour by altering its intensity and brightness. Intensity/brightnessDivider must be less than 1.
- Returns
- RGB The new colour
◆ average()
static constexpr RGB RGB::average |
( |
RGB | colourA, |
|
|
RGB | colourB ) |
|
inlinestaticconstexpr |
Average two colours together.
- Parameters
-
colourA | The first colour |
colourB | The second colour |
- Returns
- RGB A composite average of the channel values of the component colours
◆ begin()
Iterator constructor pointing to the beginning of this structure.
- Warning
- Strongly relies on both the sizeof() and byte layout of this object (i.e. that it is a POD and 3 bytes)
- Returns
- constexpr channel_type* The first channel
◆ blend()
static constexpr RGB RGB::blend |
( |
RGB | sourceA, |
|
|
RGB | sourceB, |
|
|
uint16_t | index ) |
|
inlinestaticnodiscardconstexpr |
Generate a new colour made from blending two source colours.
- Parameters
-
sourceA | The first colour |
sourceB | The second colour |
index | The blend amount. You can think of this as a slider from one RGB to the other |
- Returns
- RGB The new blended colour
◆ blend2()
static constexpr RGB RGB::blend2 |
( |
RGB | sourceA, |
|
|
RGB | sourceB, |
|
|
uint16_t | indexA, |
|
|
uint16_t | indexB ) |
|
inlinestaticnodiscardconstexpr |
Generate a new colour made from blending two source colours with individual proportions.
- Parameters
-
sourceA | The first colour |
sourceB | The second colour |
indexA | The blend amount for sourceA |
indexB | The blend amount for sourceB |
- Returns
- RGB The new blended colour
◆ blendChannel()
static constexpr channel_type RGB::blendChannel |
( |
uint32_t | channelA, |
|
|
uint32_t | channelB, |
|
|
uint16_t | index ) |
|
inlinestaticconstexprprivate |
Blend a channel in equal proportions.
- Returns
- The blended channel value
◆ blendChannel2()
static constexpr channel_type RGB::blendChannel2 |
( |
uint32_t | channelA, |
|
|
uint32_t | channelB, |
|
|
uint16_t | indexA, |
|
|
uint16_t | indexB ) |
|
inlinestaticconstexprprivate |
Blend two channels in differing proportions.
- Returns
- The blended channel value
◆ dim()
RGB RGB::dim |
( |
uint8_t | level = 1 | ) |
const |
|
inlinenodiscardconstexpr |
Dim a colour.
- Parameters
-
level | How much to dim (up to 8) |
- Returns
- RGB The dimmed colour
◆ dull()
Dull a colour, clamping it to [5, 50].
This is only used by the ArrangerView and its parent, View
- See also
- ArrangerView#drawMuteSquare
-
View::getClipMuteSquareColour
- Returns
- RGB the dulled colour
◆ end()
Iterator constructor for the end sentinel of this structure.
- Warning
- Strongly relies on both the sizeof() and byte layout of this object (i.e. that it is a POD and 3 bytes)
- Returns
- constexpr channel_type* One byte past the last channel
◆ forBlur()
RGB RGB::forBlur |
( |
| ) |
const |
|
inlinenodiscardconstexpr |
Create a derived colour for blurs (used by views)
- Returns
- RGB The derived colour
◆ forTail()
RGB RGB::forTail |
( |
| ) |
const |
|
inlinenodiscardconstexpr |
Create a derived colour for tails (used by views)
- Returns
- RGB The derived colour
◆ fromHue()
RGB RGB::fromHue |
( |
int32_t | hue | ) |
|
|
static |
Construct a colour from a hue.
- Parameters
-
- Returns
- RGB The colour
◆ fromHuePastel()
RGB RGB::fromHuePastel |
( |
int32_t | hue | ) |
|
|
static |
Construct a colour from a hue.
- Parameters
-
- Returns
- RGB A pastel colour
◆ greyOut()
RGB RGB::greyOut |
( |
int32_t | proportion | ) |
|
|
inlinenodiscardconstexpr |
Grey out a colour.
- Parameters
-
proportion | The amount to grey out |
- Returns
- RGB The resulting colour
◆ monochrome()
static constexpr RGB RGB::monochrome |
( |
uint8_t | brightness | ) |
|
|
inlinestaticconstexpr |
Construct a monochrome (white) shade.
- Parameters
-
brightness | The brightness level |
- Returns
- RGB The constructed colour
◆ operator==()
bool RGB::operator== |
( |
RGB const & | | ) |
const |
|
default |
Compare two colours to determine if they're the same.
- Returns
- bool The true / false result if they're the equal
◆ operator[]()
Legacy access to the colour internals for ease of use.
- Parameters
-
idx | The channel to access (order R G B) |
- Returns
- channel_type& The channel
◆ rotate()
This rotates the colour in fromRgb by 1 radian and places it in rgb This is useful to generate a complementary colour with the same brightness
◆ size()
static constexpr size_t RGB::size |
( |
| ) |
|
|
inlinestaticconstexpr |
Used in combination with operator[] and begin end.
- Returns
- constexpr size_t The size of this 'container'
◆ transform()
RGB RGB::transform |
( |
UnaryOp | transformFn | ) |
const |
|
inlinenodiscardconstexpr |
Create a new colour by transforming each channel of a colour.
- Template Parameters
-
UnaryOp | The function type (should be equivalent to std::function<channel_type(channel_type)>) |
- Parameters
-
- Returns
- RGB The new colour
◆ transform2()
static constexpr RGB RGB::transform2 |
( |
RGB | colourA, |
|
|
RGB | colourB, |
|
|
BinaryOp | transformFn ) |
|
inlinestaticconstexpr |
Create a new colour by transforming the channels of two colours.
- Template Parameters
-
- Parameters
-
colourA | The first colour |
colourB | The second colour |
transformFn | The transformer function, taking two channel_type values and returning a channel_type value |
- Returns
- RGB The new colour
◆ channel_max
auto RGB::channel_max = std::numeric_limits<channel_type>::max() |
|
staticconstexpr |
The maximum value each channel can hold. Useful for std::clamp<>(val, RGB::channel_min, RGB::channel_max)
◆ channel_min
auto RGB::channel_min = std::numeric_limits<channel_type>::min() |
|
staticconstexpr |
The maximum value each channel can hold. Useful for std::clamp<>(val, RGB::channel_min, RGB::channel_max)
◆ IMat
Initial value:= {
{ONE_Q16, 0, 0, 0},
{0, ONE_Q16, 0, 0},
{0, 0, ONE_Q16, 0},
{0, 0, 0, ONE_Q16},
}
◆ RMat
Initial value:= {
{(uint32_t)(c * ONE_Q16), 0, (uint32_t)(s* ONE_Q16), 0},
{(uint32_t)(s * ONE_Q16), (uint32_t)(c* ONE_Q16), 0, 0},
{0, (uint32_t)(s* ONE_Q16), (uint32_t)(c* ONE_Q16), 0},
{0, 0, 0, ONE_Q16},
}
The documentation for this class was generated from the following files:
- src/deluge/gui/colour/rgb.h
- src/deluge/gui/colour/rgb.cpp