roo_display
API Documentation for roo_display
Loading...
Searching...
No Matches
roo_display::ColorGradient Class Reference

Multi-point gradient specification. More...

#include <gradient.h>

Data Structures

struct  Node
 A single node in the gradient. More...
 

Public Types

enum class  Boundary { kExtended , kTruncated , kPeriodic }
 Boundary behavior outside gradient range. More...
 

Public Member Functions

 ColorGradient (std::vector< Node > gradient, Boundary boundary=Boundary::kExtended)
 Create a gradient specification.
 
Color getColor (float value) const
 Return the color for a given value.
 
TransparencyMode getTransparencyMode () const
 Return the transparency mode of the gradient.
 

Static Public Attributes

static constexpr Boundary EXTENDED = Boundary::kExtended
 
static constexpr Boundary TRUNCATED = Boundary::kTruncated
 
static constexpr Boundary PERIODIC = Boundary::kPeriodic
 

Detailed Description

Multi-point gradient specification.

Definition at line 19 of file gradient.h.

Member Enumeration Documentation

◆ Boundary

Boundary behavior outside gradient range.

Enumerator
kExtended 
kTruncated 
kPeriodic 

Definition at line 28 of file gradient.h.

Constructor & Destructor Documentation

◆ ColorGradient()

roo_display::ColorGradient::ColorGradient ( std::vector< Node gradient,
Boundary  boundary = Boundary::kExtended 
)

Create a gradient specification.

Node list must contain at least one node for EXTENDED/TRUNCATED, and at least two nodes with different values for PERIODIC. Nodes must be sorted by value. Equal successive values create sharp transitions.

Definition at line 7 of file gradient.cpp.

References roo_display::kCrude, and roo_display::kFull.

Member Function Documentation

◆ getColor()

Color roo_display::ColorGradient::getColor ( float  value) const

Return the color for a given value.

Color is linearly interpolated between surrounding nodes. Values outside the range follow the boundary specification.

Definition at line 24 of file gradient.cpp.

References roo_display::InterpolateColors(), kExtended, kPeriodic, and kTruncated.

Referenced by roo_display::LinearGradient::readColorRect(), roo_display::RadialGradient::readColors(), roo_display::RadialGradientSq::readColors(), roo_display::LinearGradient::readColors(), and roo_display::AngularGradient::readColors().

◆ getTransparencyMode()

TransparencyMode roo_display::ColorGradient::getTransparencyMode ( ) const
inline

Return the transparency mode of the gradient.

Definition at line 62 of file gradient.h.

Field Documentation

◆ EXTENDED

constexpr Boundary roo_display::ColorGradient::EXTENDED = Boundary::kExtended
staticconstexpr

Definition at line 41 of file gradient.h.

◆ PERIODIC

constexpr Boundary roo_display::ColorGradient::PERIODIC = Boundary::kPeriodic
staticconstexpr

Definition at line 45 of file gradient.h.

◆ TRUNCATED

constexpr Boundary roo_display::ColorGradient::TRUNCATED = Boundary::kTruncated
staticconstexpr

Definition at line 43 of file gradient.h.


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