|
resonance 1.0.1
|
Colour recorded as its brightest channel and the three channels divided by it. More...
#include <normalkey.h>
Public Member Functions | |
| NormalKey (float flRed, float flGreen, float flBlue) | |
| Build the key of one colour. | |
| float | RatioDistance (const NormalKey &other) const |
| Sum of the absolute differences between this key's ratios and another's. | |
Static Public Member Functions | |
| static void | InsertUniqueNormalKey (std::vector< NormalKey > &keys, const Color &color) |
| Add the key of a colour to a set of keys unless the set already has its hue. | |
Public Attributes | |
| float | mScale |
| float | mRed |
| float | mGreen |
| float | mBlue |
Colour recorded as its brightest channel and the three channels divided by it.
Two colours of the same hue at different brightness share the three ratios and differ only in mScale. The palette quantiser at 0x00557af8 collects one key per distinct hue, builds a ramp of sixteen shades per key into the destination palette at 0x00557970, and maps each source pixel to the nearest key's ramp. The class is not polymorphic and does not emit RTTI, and the image does not include a string that identifies it. The name is inferred.
| NormalKey::NormalKey | ( | float | flRed, |
| float | flGreen, | ||
| float | flBlue ) |
Build the key of one colour.
The greatest channel becomes mScale and its ratio 1, and a tie goes to the later channel. When blue wins after green was at least red, and blue is zero, the key has a scale of zero and three ratios of 1. Blue winning over a greater red is not tested for zero.
| flRed | The red channel. |
| flGreen | The green channel. |
| flBlue | The blue channel. |
|
static |
Add the key of a colour to a set of keys unless the set already has its hue.
A key matches when the sum of the absolute differences of the three ratios is under 0.02. The first match is replaced by the new key when the new key is brighter, and otherwise the set is unchanged. Without a match the key is appended.
| keys | The set of keys. |
| color | The colour. Its alpha is not read. |
|
inline |
Sum of the absolute differences between this key's ratios and another's.
InsertUniqueNormalKey() and ACanvas::QuantizeToRamps() open-code it. The name is inferred.
| other | The key to compare with. |
| float NormalKey::mScale |
The brightest channel.
| float NormalKey::mRed |
Red divided by mScale.
| float NormalKey::mGreen |
Green divided by mScale.
| float NormalKey::mBlue |
Blue divided by mScale.