← All compilation units

Flyology_TUI.Components.Gradients

Description

Application

function Application (Item : Model) return Color_Application
Parameters
Item
Return value

Apply

procedure Apply
  (Item   : Model;
   Target : in out Flyology_TUI.Surfaces.Surface;
   Region : Flyology_TUI.Geometry.Rectangle)

Apply semantic RGB colors to complete cells inside Region. Region uses surface coordinates and may be signed or clipped. A wide glyph is recolored only when both its lead and continuation cells are in Region; both cells retain one appearance, so clipping cannot orphan it. Existing glyphs, non-target colors, and every non-color style attribute survive. Terminal profile degradation remains the Renderer's responsibility.

Parameters
Item
Target
Region

Color_Application

type Color_Application is
  (Apply_Foreground, Apply_Background, Apply_Both);
Enumeration literals
Apply_Foreground
Apply_Background
Apply_Both

Create

function Create
  (Max_Stops    : Positive;
   Initial_Color : RGB_Color := (others => 0);
   Flow          : Direction := Horizontal;
   Application   : Color_Application := Apply_Foreground;
   Interpolation : Interpolation_Mode := SRGB_Channels) return Model
Parameters
Max_Stops
Initial_Color
Flow
Application
Interpolation
Return value

Direction

type Direction is (Horizontal, Vertical);
Enumeration literals
Horizontal
Vertical

Flow

function Flow (Item : Model) return Direction
Parameters
Item
Return value

Heatmap

function Heatmap
  (Item : Model;
   Value, Minimum, Maximum : Long_Float) return RGB_Color

Clamp Value to Minimum .. Maximum and sample that normalized position. Minimum must be strictly below Maximum.

Parameters
Item
Value
Minimum
Maximum
Return value

Interpolation

function Interpolation (Item : Model) return Interpolation_Mode
Parameters
Item
Return value

Interpolation_Mode

type Interpolation_Mode is (SRGB_Channels, Linear_Light);
Enumeration literals
SRGB_Channels
Linear_Light

Model

type Model (Max_Stops : Positive) is tagged private;

A model owns at most Max_Stops values and no animation clock, task, or process state. Create starts as a solid gradient at Initial_Color.

Record fields
Max_Stops

RGB_Color

type RGB_Color is record
   Red, Green, Blue : Flyology_TUI.Colors.Channel := 0;
end record;
Record fields
Red
Green
Blue

Sample

function Sample (Item : Model; Offset : Stop_Offset) return RGB_Color

Sample the normalized offset. SRGB_Channels linearly interpolates the encoded 8-bit channels with integer arithmetic; its channel rounding is nearest with an exact half choosing the larger value. Linear_Light decodes and encodes with the IEC 61966-2-1 sRGB transfer function using Long_Float logarithm and exponentiation. Its intermediate results can therefore vary by one channel value with target precision and the runtime math implementation; final conversion rounds to nearest.

Parameters
Item
Offset
Return value

Set_Application

procedure Set_Application
  (Item : in out Model; Application : Color_Application)
Parameters
Item
Application

Set_Direction

procedure Set_Direction (Item : in out Model; Flow : Direction)
Parameters
Item
Flow

Set_Interpolation

procedure Set_Interpolation
  (Item : in out Model; Interpolation : Interpolation_Mode)
Parameters
Item
Interpolation

Set_Solid

procedure Set_Solid (Item : in out Model; Color : RGB_Color)
Parameters
Item
Color

Stop

type Stop is record
   Offset : Stop_Offset := 0;
   Color  : RGB_Color;
end record;
Record fields
Offset
Color

Stop_Array

type Stop_Array is array (Natural range <>) of Stop;

Stop_At

function Stop_At (Item : Model; Position : Positive) return Stop
Parameters
Item
Position
Return value

Stop_Count

function Stop_Count (Item : Model) return Positive
Parameters
Item
Return value

Stop_Offset

subtype Stop_Offset is Natural range 0 .. Stop_Scale;

Stop_Scale

Stop_Scale : constant := 1_000_000;

Try_Set_Stops

procedure Try_Set_Stops
  (Item    : in out Model;
   Values  : Stop_Array;
   Success : out Boolean)

Replace all stops only when Values is nonempty, fits Max_Stops, and has strictly increasing offsets. Duplicate and descending offsets reject the complete replacement; the previous gradient remains unchanged.

Parameters
Item
Values
Success