TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::ColorStyle Class Reference

A fill: solid color, gradient or texture, as used for backgrounds, borders, text and icons. More...

#include <gui_core/style/gui_style.h>

Public Member Functions

void SetTransformation (float3 x, float3 y)
 Sets the 2x3 transform applied to gradient coordinates, row by row.
void SetAnimSpeed (float x, float y=0.0f)
 Scroll speed over time: x along the gradient (or texture U), y texture V.
float3x2 GetTransformation () const
 The 2x3 gradient transform as floats.
color4b GetFirstColor () const noexcept
 The first stop's color, which is all of a SolidColor; transparent without stops.
VisualColorStyle ToVisualStyle (GradientManager &gradientManager, ImageIndex textureIndex, GradientHandle &outHandle) const
 Bakes the GPU-facing style and acquires its atlas slot.

Static Public Member Functions

static ColorStyle Create (color4b color)
 A SolidColor style.
static ColorStyle Create (color4f color)
 A SolidColor style.
static ColorStyle Create (color4b c0, color4b c1, ColorType type)
 Two stops at 0 and 1.
static ColorStyle Create (color4f c0, color4f c1, ColorType type)
 Two stops at 0 and 1.
static ColorStyle Create (color4b c0, color4b c1, color4b c2, ColorType type)
 Three stops at 0, 0.5 and 1.
static ColorStyle Create (color4f c0, color4f c1, color4f c2, ColorType type)
 Three stops at 0, 0.5 and 1.
static ColorStyle Create (color4b c0, color4b c1, color4b c2, color4b c3, ColorType type)
 Four stops at 0, 0.25, 0.5 and 1.
static ColorStyle Create (color4f c0, color4f c1, color4f c2, color4f c3, ColorType type)
 Four stops at 0, 0.25, 0.5 and 1.
static ColorStyle Create (Gradient gradient, ColorType type)
 Any gradient with any type.

Public Attributes

Gradient gradient {}
 colors; SolidColor uses the first stop
short4 transformationX = { one, 0, 0, 0 }
 first row of the 2x3 gradient transform (half floats)
short4 transformationY = { 0, one, 0, 0 }
 second row of the 2x3 gradient transform (half floats)
ColorType type = (ColorType)0
 how the fill is painted
short2 animSpeed = { 0, 0 }
 half floats, see SetAnimSpeed

Static Public Attributes

static constexpr int16_t one = 15360
 1.0 as a half float

Detailed Description

A fill: solid color, gradient or texture, as used for backgrounds, borders, text and icons.

Register it with StyleManager (inside a Style, or with RegisterColorStyle) to get the GPU-side VisualColorStyle.

Member Function Documentation

◆ SetTransformation()

void tachyon::ColorStyle::SetTransformation ( float3 x,
float3 y )

Sets the 2x3 transform applied to gradient coordinates, row by row.

◆ SetAnimSpeed()

void tachyon::ColorStyle::SetAnimSpeed ( float x,
float y = 0.0f )

Scroll speed over time: x along the gradient (or texture U), y texture V.

◆ GetTransformation()

float3x2 tachyon::ColorStyle::GetTransformation ( ) const

The 2x3 gradient transform as floats.

◆ GetFirstColor()

color4b tachyon::ColorStyle::GetFirstColor ( ) const
inlinenoexcept

The first stop's color, which is all of a SolidColor; transparent without stops.

◆ ToVisualStyle()

VisualColorStyle tachyon::ColorStyle::ToVisualStyle ( GradientManager & gradientManager,
ImageIndex textureIndex,
GradientHandle & outHandle ) const

Bakes the GPU-facing style and acquires its atlas slot.

The caller owns outHandle and must Release it (or hand it to RegisterVisualColorStyle). Texture types return an invalid handle.

◆ Create() [1/9]

ColorStyle tachyon::ColorStyle::Create ( color4b color)
static

A SolidColor style.

◆ Create() [2/9]

ColorStyle tachyon::ColorStyle::Create ( color4f color)
static

A SolidColor style.

◆ Create() [3/9]

ColorStyle tachyon::ColorStyle::Create ( color4b c0,
color4b c1,
ColorType type )
static

Two stops at 0 and 1.

The color overloads build the gradient like Gradient::Linear; the type can't be SolidColor or one that takes another color count (InterpolatedTriangle takes 3, InterpolatedBox 4).

◆ Create() [4/9]

ColorStyle tachyon::ColorStyle::Create ( color4f c0,
color4f c1,
ColorType type )
static

Two stops at 0 and 1.

◆ Create() [5/9]

ColorStyle tachyon::ColorStyle::Create ( color4b c0,
color4b c1,
color4b c2,
ColorType type )
static

Three stops at 0, 0.5 and 1.

◆ Create() [6/9]

ColorStyle tachyon::ColorStyle::Create ( color4f c0,
color4f c1,
color4f c2,
ColorType type )
static

Three stops at 0, 0.5 and 1.

◆ Create() [7/9]

ColorStyle tachyon::ColorStyle::Create ( color4b c0,
color4b c1,
color4b c2,
color4b c3,
ColorType type )
static

Four stops at 0, 0.25, 0.5 and 1.

◆ Create() [8/9]

ColorStyle tachyon::ColorStyle::Create ( color4f c0,
color4f c1,
color4f c2,
color4f c3,
ColorType type )
static

Four stops at 0, 0.25, 0.5 and 1.

◆ Create() [9/9]

ColorStyle tachyon::ColorStyle::Create ( Gradient gradient,
ColorType type )
static

Any gradient with any type.

Member Data Documentation

◆ one

int16_t tachyon::ColorStyle::one = 15360
staticconstexpr

1.0 as a half float

◆ gradient

Gradient tachyon::ColorStyle::gradient {}

colors; SolidColor uses the first stop

◆ transformationX

short4 tachyon::ColorStyle::transformationX = { one, 0, 0, 0 }

first row of the 2x3 gradient transform (half floats)

◆ transformationY

short4 tachyon::ColorStyle::transformationY = { 0, one, 0, 0 }

second row of the 2x3 gradient transform (half floats)

◆ type

ColorType tachyon::ColorStyle::type = (ColorType)0

how the fill is painted

◆ animSpeed

short2 tachyon::ColorStyle::animSpeed = { 0, 0 }

half floats, see SetAnimSpeed


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