neoGFX
Cross-platform C++ app/game engine
neogfx::gradient Class Reference

#include <color.hpp>

Classes

struct  bad_position
 

Public Types

typedef neolib::variant< corner, double > orientation_type
 
typedef std::pair< double, colorcolor_stop
 
typedef std::vector< color_stopcolor_stop_list
 
typedef std::pair< double, color::componentalpha_stop
 
typedef std::vector< alpha_stopalpha_stop_list
 

Public Member Functions

 gradient ()
 
 gradient (const gradient &aOther)
 
 gradient (const color &aColor)
 
 gradient (const color &aColor, gradient_direction aDirection)
 
 gradient (const color &aColor1, const color &aColor2, gradient_direction aDirection=gradient_direction::Vertical)
 
 gradient (const color_stop_list &aColorStops, gradient_direction aDirection=gradient_direction::Vertical)
 
 gradient (const color_stop_list &aColorStops, const alpha_stop_list &aAlphaStops, gradient_direction aDirection=gradient_direction::Vertical)
 
 gradient (const gradient &aOther, const color_stop_list &aColorStops, const alpha_stop_list &aAlphaStops)
 
 gradient (const std::initializer_list< color > &aColors, gradient_direction aDirection=gradient_direction::Vertical)
 
bool use_cache () const
 
void set_cache_usage (bool aUseCache)
 
color_stop_list::const_iterator color_begin () const
 
color_stop_list::const_iterator color_end () const
 
alpha_stop_list::const_iterator alpha_begin () const
 
alpha_stop_list::const_iterator alpha_end () const
 
color_stop_list::iterator color_begin ()
 
color_stop_list::iterator color_end ()
 
alpha_stop_list::iterator alpha_begin ()
 
alpha_stop_list::iterator alpha_end ()
 
color_stop_list::iterator find_color_stop (double aPos, bool aToInsert=false)
 
color_stop_list::iterator find_color_stop (double aPos, double aStart, double aEnd, bool aToInsert=false)
 
alpha_stop_list::iterator find_alpha_stop (double aPos, bool aToInsert=false)
 
alpha_stop_list::iterator find_alpha_stop (double aPos, double aStart, double aEnd, bool aToInsert=false)
 
color_stop_list::iterator insert_color_stop (double aPos)
 
color_stop_list::iterator insert_color_stop (double aPos, double aStart, double aEnd)
 
alpha_stop_list::iterator insert_alpha_stop (double aPos)
 
alpha_stop_list::iterator insert_alpha_stop (double aPos, double aStart, double aEnd)
 
void erase_stop (color_stop_list::iterator aStop)
 
void erase_stop (alpha_stop_list::iterator aStop)
 
std::size_t color_stop_count () const
 
std::size_t alpha_stop_count () const
 
color_stop_list combined_stops () const
 
color at (double aPos) const
 
color at (double aPos, double aStart, double aEnd) const
 
color color_at (double aPos) const
 
color color_at (double aPos, double aStart, double aEnd) const
 
color::component alpha_at (double aPos) const
 
color::component alpha_at (double aPos, double aStart, double aEnd) const
 
gradient reversed () const
 
template<typename T >
gradient with_alpha (T aAlpha, std::enable_if_t< std::is_floating_point_v< T >, sfinae >={})
 
gradient with_alpha (color::component aAlpha) const
 
template<typename T >
gradient with_combined_alpha (T aAlpha, std::enable_if_t< std::is_floating_point_v< T >, sfinae >={})
 
gradient with_combined_alpha (color::component aAlpha) const
 
gradient_direction direction () const
 
void set_direction (gradient_direction aDirection)
 
gradient with_direction (gradient_direction aDirection) const
 
orientation_type orientation () const
 
void set_orientation (orientation_type aOrientation)
 
gradient with_orientation (orientation_type aOrientation) const
 
gradient_shape shape () const
 
void set_shape (gradient_shape aShape)
 
gradient with_shape (gradient_shape aShape) const
 
gradient_size size () const
 
void set_size (gradient_size aSize)
 
gradient with_size (gradient_size aSize) const
 
const optional_vec2exponents () const
 
void set_exponents (const optional_vec2 &aExponents)
 
gradient with_exponents (const optional_vec2 &aExponents) const
 
const optional_pointcentre () const
 
void set_centre (const optional_point &aCentre)
 
gradient with_centre (const optional_point &aCentre) const
 
double smoothness () const
 
void set_smoothness (double aSmoothness)
 
gradient with_smoothness (double aSmoothness) const
 
bool operator== (const gradient &aOther) const
 
bool operator!= (const gradient &aOther) const
 
bool operator< (const gradient &aOther) const
 

Static Public Member Functions

static double normalized_position (double aPos, double aStart, double aEnd)
 

Static Public Attributes

static const std::uint32_t MaxStops = 256
 

Detailed Description

Definition at line 905 of file color.hpp.

Member Typedef Documentation

◆ alpha_stop

typedef std::pair<double, color::component> neogfx::gradient::alpha_stop

Definition at line 915 of file color.hpp.

◆ alpha_stop_list

Definition at line 916 of file color.hpp.

◆ color_stop

typedef std::pair<double, color> neogfx::gradient::color_stop

Definition at line 913 of file color.hpp.

◆ color_stop_list

Definition at line 914 of file color.hpp.

◆ orientation_type

Definition at line 912 of file color.hpp.

Constructor & Destructor Documentation

◆ gradient() [1/9]

neogfx::gradient::gradient ( )

◆ gradient() [2/9]

neogfx::gradient::gradient ( const gradient aOther)

◆ gradient() [3/9]

neogfx::gradient::gradient ( const color aColor)
explicit

◆ gradient() [4/9]

neogfx::gradient::gradient ( const color aColor,
gradient_direction  aDirection 
)

◆ gradient() [5/9]

neogfx::gradient::gradient ( const color aColor1,
const color aColor2,
gradient_direction  aDirection = gradient_direction::Vertical 
)

◆ gradient() [6/9]

neogfx::gradient::gradient ( const color_stop_list aColorStops,
gradient_direction  aDirection = gradient_direction::Vertical 
)

◆ gradient() [7/9]

neogfx::gradient::gradient ( const color_stop_list aColorStops,
const alpha_stop_list aAlphaStops,
gradient_direction  aDirection = gradient_direction::Vertical 
)

◆ gradient() [8/9]

neogfx::gradient::gradient ( const gradient aOther,
const color_stop_list aColorStops,
const alpha_stop_list aAlphaStops 
)

◆ gradient() [9/9]

neogfx::gradient::gradient ( const std::initializer_list< color > &  aColors,
gradient_direction  aDirection = gradient_direction::Vertical 
)

Member Function Documentation

◆ alpha_at() [1/2]

color::component neogfx::gradient::alpha_at ( double  aPos) const

◆ alpha_at() [2/2]

color::component neogfx::gradient::alpha_at ( double  aPos,
double  aStart,
double  aEnd 
) const

◆ alpha_begin() [1/2]

alpha_stop_list::const_iterator neogfx::gradient::alpha_begin ( ) const

◆ alpha_begin() [2/2]

alpha_stop_list::iterator neogfx::gradient::alpha_begin ( )

◆ alpha_end() [1/2]

alpha_stop_list::const_iterator neogfx::gradient::alpha_end ( ) const

◆ alpha_end() [2/2]

alpha_stop_list::iterator neogfx::gradient::alpha_end ( )

◆ alpha_stop_count()

std::size_t neogfx::gradient::alpha_stop_count ( ) const

◆ at() [1/2]

color neogfx::gradient::at ( double  aPos) const

◆ at() [2/2]

color neogfx::gradient::at ( double  aPos,
double  aStart,
double  aEnd 
) const

◆ centre()

const optional_point& neogfx::gradient::centre ( ) const

◆ color_at() [1/2]

color neogfx::gradient::color_at ( double  aPos) const

◆ color_at() [2/2]

color neogfx::gradient::color_at ( double  aPos,
double  aStart,
double  aEnd 
) const

◆ color_begin() [1/2]

color_stop_list::const_iterator neogfx::gradient::color_begin ( ) const

◆ color_begin() [2/2]

color_stop_list::iterator neogfx::gradient::color_begin ( )

◆ color_end() [1/2]

color_stop_list::const_iterator neogfx::gradient::color_end ( ) const

◆ color_end() [2/2]

color_stop_list::iterator neogfx::gradient::color_end ( )

◆ color_stop_count()

std::size_t neogfx::gradient::color_stop_count ( ) const

◆ combined_stops()

color_stop_list neogfx::gradient::combined_stops ( ) const

◆ direction()

gradient_direction neogfx::gradient::direction ( ) const

◆ erase_stop() [1/2]

void neogfx::gradient::erase_stop ( color_stop_list::iterator  aStop)

◆ erase_stop() [2/2]

void neogfx::gradient::erase_stop ( alpha_stop_list::iterator  aStop)

◆ exponents()

const optional_vec2& neogfx::gradient::exponents ( ) const

◆ find_alpha_stop() [1/2]

alpha_stop_list::iterator neogfx::gradient::find_alpha_stop ( double  aPos,
bool  aToInsert = false 
)

◆ find_alpha_stop() [2/2]

alpha_stop_list::iterator neogfx::gradient::find_alpha_stop ( double  aPos,
double  aStart,
double  aEnd,
bool  aToInsert = false 
)

◆ find_color_stop() [1/2]

color_stop_list::iterator neogfx::gradient::find_color_stop ( double  aPos,
bool  aToInsert = false 
)

◆ find_color_stop() [2/2]

color_stop_list::iterator neogfx::gradient::find_color_stop ( double  aPos,
double  aStart,
double  aEnd,
bool  aToInsert = false 
)

◆ insert_alpha_stop() [1/2]

alpha_stop_list::iterator neogfx::gradient::insert_alpha_stop ( double  aPos)

◆ insert_alpha_stop() [2/2]

alpha_stop_list::iterator neogfx::gradient::insert_alpha_stop ( double  aPos,
double  aStart,
double  aEnd 
)

◆ insert_color_stop() [1/2]

color_stop_list::iterator neogfx::gradient::insert_color_stop ( double  aPos)

◆ insert_color_stop() [2/2]

color_stop_list::iterator neogfx::gradient::insert_color_stop ( double  aPos,
double  aStart,
double  aEnd 
)

◆ normalized_position()

static double neogfx::gradient::normalized_position ( double  aPos,
double  aStart,
double  aEnd 
)
static

◆ operator!=()

bool neogfx::gradient::operator!= ( const gradient aOther) const

◆ operator<()

bool neogfx::gradient::operator< ( const gradient aOther) const

◆ operator==()

bool neogfx::gradient::operator== ( const gradient aOther) const

◆ orientation()

orientation_type neogfx::gradient::orientation ( ) const

◆ reversed()

gradient neogfx::gradient::reversed ( ) const

◆ set_cache_usage()

void neogfx::gradient::set_cache_usage ( bool  aUseCache)

◆ set_centre()

void neogfx::gradient::set_centre ( const optional_point aCentre)

◆ set_direction()

void neogfx::gradient::set_direction ( gradient_direction  aDirection)

◆ set_exponents()

void neogfx::gradient::set_exponents ( const optional_vec2 aExponents)

◆ set_orientation()

void neogfx::gradient::set_orientation ( orientation_type  aOrientation)

◆ set_shape()

void neogfx::gradient::set_shape ( gradient_shape  aShape)

◆ set_size()

void neogfx::gradient::set_size ( gradient_size  aSize)

◆ set_smoothness()

void neogfx::gradient::set_smoothness ( double  aSmoothness)

◆ shape()

gradient_shape neogfx::gradient::shape ( ) const

◆ size()

gradient_size neogfx::gradient::size ( ) const

◆ smoothness()

double neogfx::gradient::smoothness ( ) const

◆ use_cache()

bool neogfx::gradient::use_cache ( ) const

◆ with_alpha() [1/2]

template<typename T >
gradient neogfx::gradient::with_alpha ( aAlpha,
std::enable_if_t< std::is_floating_point_v< T >, sfinae = {} 
)
inline

Definition at line 963 of file color.hpp.

◆ with_alpha() [2/2]

gradient neogfx::gradient::with_alpha ( color::component  aAlpha) const

◆ with_centre()

gradient neogfx::gradient::with_centre ( const optional_point aCentre) const

◆ with_combined_alpha() [1/2]

template<typename T >
gradient neogfx::gradient::with_combined_alpha ( aAlpha,
std::enable_if_t< std::is_floating_point_v< T >, sfinae = {} 
)
inline

Definition at line 969 of file color.hpp.

◆ with_combined_alpha() [2/2]

gradient neogfx::gradient::with_combined_alpha ( color::component  aAlpha) const

◆ with_direction()

gradient neogfx::gradient::with_direction ( gradient_direction  aDirection) const

◆ with_exponents()

gradient neogfx::gradient::with_exponents ( const optional_vec2 aExponents) const

◆ with_orientation()

gradient neogfx::gradient::with_orientation ( orientation_type  aOrientation) const

◆ with_shape()

gradient neogfx::gradient::with_shape ( gradient_shape  aShape) const

◆ with_size()

gradient neogfx::gradient::with_size ( gradient_size  aSize) const

◆ with_smoothness()

gradient neogfx::gradient::with_smoothness ( double  aSmoothness) const

Member Data Documentation

◆ MaxStops

const std::uint32_t neogfx::gradient::MaxStops = 256
static

Definition at line 909 of file color.hpp.


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