Gradient

Gradient class.

Nothing here is a public API, it's only internal to dplug:canvas.

A gradient owns:

- a list of colours and positions (known as stops) along a single dimension from 0 to 1. The colors are a 32-bit RGBA quadruplet.

- a look-up table of colors (LUT) indexed by blitters.

It has a lookup table for the rasterizer, built lazily (was originally always 256 samples).

FUTURE: size of look-up is dynamically choosen

Members

Functions

addStop
void addStop(float pos, uint color)

Add a color stop.

getLookup
uint[] getLookup()
hasChanged
bool hasChanged()
length
size_t length()
lutLength
int lutLength()

Get look-up length. This is invalidated in cases the color stops are redone with .reset or .addStop.

reset
void reset()

Reset things, have zero color stop. Invalidate look-up.

Structs

ColorStop
struct ColorStop
Undocumented in source.

Meta