resonance 1.0.1
Loading...
Searching...
No Matches
NormalKey Class Reference

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

Detailed Description

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.

Constructor & Destructor Documentation

◆ NormalKey()

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.

Parameters
flRedThe red channel.
flGreenThe green channel.
flBlueThe blue channel.
Ghidra address:
NTSC-U/C: 0x00558740
Ghidra address:
PAL: 0x00599898

Member Function Documentation

◆ InsertUniqueNormalKey()

void NormalKey::InsertUniqueNormalKey ( std::vector< NormalKey > & keys,
const Color & color )
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.

Parameters
keysThe set of keys.
colorThe colour. Its alpha is not read.
Ghidra address:
NTSC-U/C: 0x00557858
Ghidra address:
PAL: 0x005989b0

◆ RatioDistance()

float NormalKey::RatioDistance ( const NormalKey & other) const
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.

Parameters
otherThe key to compare with.
Returns
The summed difference, red and green added first.

Member Data Documentation

◆ mScale

float NormalKey::mScale

The brightest channel.

◆ mRed

float NormalKey::mRed

Red divided by mScale.

◆ mGreen

float NormalKey::mGreen

Green divided by mScale.

◆ mBlue

float NormalKey::mBlue

Blue divided by mScale.


The documentation for this class was generated from the following file: