neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived > Class Template Reference

#include <color.hpp>

Inheritance diagram for neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >:
neolib::math::basic_vector< T, _Size, Type > neogfx::basic_rgb_color< color_space::sRGB, scalar, uint8_t, sRGB_color > neogfx::basic_rgb_color< ColorSpace, BaseComponent, ViewComponent, Derived > neogfx::sRGB_color

Public Types

typedef base_type abstract_type
 
typedef BaseComponent base_component
 
typedef ViewComponent view_component
 
typedef color_return_type_cracker< self_type, derived_type >::return_type return_type
 
- Public Types inherited from neolib::math::basic_vector< T, _Size, Type >
typedef self_type abstract_type
 
typedef Type type
 
typedef T value_type
 
typedef basic_vector< value_type, _Size, Type > vector_type
 
typedef uint32_t size_type
 
typedef std::array< value_type, _Sizearray_type
 
typedef array_type::const_iterator const_iterator
 
typedef array_type::iterator iterator
 

Public Member Functions

 basic_color (const basic_vector< BaseComponent, ColorComponentCount > &aNoAlpha)
 
 basic_color (const self_type &aOther)
 
self_typeoperator= (const self_type &aOther)
 
view_component alpha () const
 
template<typename T >
alpha () const
 
return_typeset_alpha (view_component aAlpha)
 
template<typename T >
return_typeset_alpha (T aAlpha)
 
return_type with_alpha (view_component aAlpha) const
 
template<typename T >
return_type with_alpha (T aAlpha) const
 
return_type with_combined_alpha (view_component aAlpha) const
 
template<typename T >
return_type with_combined_alpha (T aAlpha) const
 
- Public Member Functions inherited from neolib::math::basic_vector< T, _Size, Type >
 basic_vector ()
 
template<typename SFINAE = int>
 basic_vector (value_type x, typename std::enable_if_t< Size==1, SFINAE >=0)
 
template<typename SFINAE = int>
 basic_vector (value_type x, value_type y, typename std::enable_if_t< Size==2, SFINAE >=0)
 
template<typename SFINAE = int>
 basic_vector (value_type x, value_type y, value_type z, typename std::enable_if_t< Size==3, SFINAE >=0)
 
template<typename SFINAE = int>
 basic_vector (value_type x, value_type y, value_type z, value_type w, typename std::enable_if_t< Size==4, SFINAE >=0)
 
template<typename... Arguments>
 basic_vector (const value_type &value, Arguments &&... aArguments)
 
template<typename... Arguments>
 basic_vector (value_type &&value, Arguments &&... aArguments)
 
 basic_vector (const array_type &v)
 
 basic_vector (std::initializer_list< value_type > values)
 
template<typename V , typename A , uint32_t S, uint32_t... Indexes>
 basic_vector (const swizzle< V, A, S, Indexes... > &aSwizzle)
 
 basic_vector (const self_type &other)
 
 basic_vector (self_type &&other)
 
template<typename T2 >
 basic_vector (const basic_vector< T2, Size, Type > &other)
 
template<typename T2 , uint32_t Size2, typename SFINAE = int>
 basic_vector (const basic_vector< T2, Size2, Type > &other, typename std::enable_if_t< Size2< Size, SFINAE >=0)
 
self_typeoperator= (const self_type &other)
 
self_typeoperator= (self_type &&other)
 
self_typeoperator= (std::initializer_list< value_type > values)
 
value_type operator[] (uint32_t aIndex) const
 
value_typeoperator[] (uint32_t aIndex)
 
const_iterator begin () const
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 
 operator const array_type & () const
 
template<typename T2 >
basic_vector< T2, Size, Type > as () const
 
bool operator== (const self_type &right) const
 
bool operator!= (const self_type &right) const
 
self_typeoperator+= (value_type value)
 
self_typeoperator-= (value_type value)
 
self_typeoperator*= (value_type value)
 
self_typeoperator/= (value_type value)
 
self_typeoperator+= (const self_type &right)
 
self_typeoperator-= (const self_type &right)
 
self_typeoperator*= (const self_type &right)
 
self_typeoperator/= (const self_type &right)
 
self_type operator- () const
 
self_type scale (const self_type &right) const
 
value_type magnitude () const
 
self_type normalized () const
 
self_type min (const self_type &right) const
 
self_type max (const self_type &right) const
 
value_type min () const
 
self_type ceil () const
 
self_type floor () const
 
self_type round () const
 
value_type distance (const self_type &right) const
 
value_type dot (const self_type &right) const
 
template<typename SFINAE = self_type>
std::enable_if_t< Size==3, SFINAEcross (const self_type &right) const
 
self_type hadamard_product (const self_type &right) const
 

Static Public Member Functions

template<typename To , typename From >
static To convert (From aComponent)
 
static view_component base_to_view (base_component aComponent)
 
- Static Public Member Functions inherited from neolib::math::basic_vector< T, _Size, Type >
static uint32_t size ()
 

Static Public Attributes

static constexpr color_space color_space = ColorSpace
 
static constexpr std::size_t component_count = ColorComponentCount + 1
 
static constexpr std::size_t alpha_component_index = component_count - 1
 
- Static Public Attributes inherited from neolib::math::basic_vector< T, _Size, Type >
static constexpr uint32_t Size = _Size
 

Additional Inherited Members

- Public Attributes inherited from neolib::math::basic_vector< T, _Size, Type >
union { 
 
   array_type   v 
 
   struct { 
 
      value_type   x 
 
      value_type   y 
 
      value_type   z 
 
   }  
 
   swizzle< vector_type, array_type, 2, 0, 0 >   xx 
 
   swizzle< vector_type, array_type, 2, 0, 1 >   xy 
 
   swizzle< vector_type, array_type, 2, 0, 2 >   xz 
 
   swizzle< vector_type, array_type, 2, 1, 0 >   yx 
 
   swizzle< vector_type, array_type, 2, 1, 1 >   yy 
 
   swizzle< vector_type, array_type, 2, 1, 2 >   yz 
 
   swizzle< vector_type, array_type, 2, 2, 0 >   zx 
 
   swizzle< vector_type, array_type, 2, 2, 1 >   zy 
 
   swizzle< vector_type, array_type, 2, 2, 2 >   zz 
 
   swizzle< vector_type, array_type, 3, 0, 0, 0 >   xxx 
 
   swizzle< vector_type, array_type, 3, 0, 0, 1 >   xxy 
 
   swizzle< vector_type, array_type, 3, 0, 0, 2 >   xxz 
 
   swizzle< vector_type, array_type, 3, 0, 1, 0 >   xyx 
 
   swizzle< vector_type, array_type, 3, 0, 1, 1 >   xyy 
 
   swizzle< vector_type, array_type, 3, 0, 1, 2 >   xyz 
 
   swizzle< vector_type, array_type, 3, 1, 0, 0 >   yxx 
 
   swizzle< vector_type, array_type, 3, 1, 0, 1 >   yxy 
 
   swizzle< vector_type, array_type, 3, 1, 0, 2 >   yxz 
 
   swizzle< vector_type, array_type, 3, 1, 1, 0 >   yyx 
 
   swizzle< vector_type, array_type, 3, 1, 1, 1 >   yyy 
 
   swizzle< vector_type, array_type, 3, 1, 1, 2 >   yyz 
 
   swizzle< vector_type, array_type, 3, 1, 2, 0 >   yzx 
 
   swizzle< vector_type, array_type, 3, 1, 2, 1 >   yzy 
 
   swizzle< vector_type, array_type, 3, 1, 2, 2 >   yzz 
 
   swizzle< vector_type, array_type, 3, 2, 0, 0 >   zxx 
 
   swizzle< vector_type, array_type, 3, 2, 0, 1 >   zxy 
 
   swizzle< vector_type, array_type, 3, 2, 0, 2 >   zxz 
 
   swizzle< vector_type, array_type, 3, 2, 1, 0 >   zyx 
 
   swizzle< vector_type, array_type, 3, 2, 1, 1 >   zyy 
 
   swizzle< vector_type, array_type, 3, 2, 1, 2 >   zyz 
 
   swizzle< vector_type, array_type, 3, 2, 2, 0 >   zzx 
 
   swizzle< vector_type, array_type, 3, 2, 2, 1 >   zzy 
 
   swizzle< vector_type, array_type, 3, 2, 2, 2 >   zzz 
 
};  
 

Detailed Description

template<color_space ColorSpace, typename BaseComponent, typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
class neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >

Definition at line 73 of file color.hpp.

Member Typedef Documentation

◆ abstract_type

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
typedef base_type neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::abstract_type

Definition at line 81 of file color.hpp.

◆ base_component

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
typedef BaseComponent neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::base_component

Definition at line 82 of file color.hpp.

◆ return_type

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
typedef color_return_type_cracker<self_type,derived_type>::return_type neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::return_type

Definition at line 84 of file color.hpp.

◆ view_component

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
typedef ViewComponent neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::view_component

Definition at line 83 of file color.hpp.

Constructor & Destructor Documentation

◆ basic_color() [1/2]

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::basic_color ( const basic_vector< BaseComponent, ColorComponentCount > &  aNoAlpha)
inline

Definition at line 112 of file color.hpp.

◆ basic_color() [2/2]

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::basic_color ( const self_type aOther)
inline

Definition at line 117 of file color.hpp.

Member Function Documentation

◆ alpha() [1/2]

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
view_component neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::alpha ( ) const
inline

Definition at line 134 of file color.hpp.

◆ alpha() [2/2]

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
template<typename T >
T neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::alpha ( ) const
inline

Definition at line 139 of file color.hpp.

◆ base_to_view()

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
static view_component neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::base_to_view ( base_component  aComponent)
inlinestatic

Definition at line 130 of file color.hpp.

◆ convert()

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
template<typename To , typename From >
static To neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::convert ( From  aComponent)
inlinestatic

Definition at line 93 of file color.hpp.

◆ operator=()

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
self_type & neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::operator= ( const self_type aOther)
inline

Definition at line 123 of file color.hpp.

◆ set_alpha() [1/2]

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
template<typename T >
return_type & neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::set_alpha ( aAlpha)
inline

Definition at line 149 of file color.hpp.

◆ set_alpha() [2/2]

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
return_type & neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::set_alpha ( view_component  aAlpha)
inline

Definition at line 143 of file color.hpp.

◆ with_alpha() [1/2]

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
template<typename T >
return_type neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::with_alpha ( aAlpha) const
inline

Definition at line 159 of file color.hpp.

◆ with_alpha() [2/2]

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
return_type neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::with_alpha ( view_component  aAlpha) const
inline

Definition at line 154 of file color.hpp.

◆ with_combined_alpha() [1/2]

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
template<typename T >
return_type neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::with_combined_alpha ( aAlpha) const
inline

Definition at line 168 of file color.hpp.

◆ with_combined_alpha() [2/2]

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
return_type neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::with_combined_alpha ( view_component  aAlpha) const
inline

Definition at line 163 of file color.hpp.

Member Data Documentation

◆ alpha_component_index

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
constexpr std::size_t neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::alpha_component_index = component_count - 1
staticconstexpr

Definition at line 89 of file color.hpp.

◆ color_space

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
constexpr color_space neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::color_space = ColorSpace
staticconstexpr

Definition at line 87 of file color.hpp.

◆ component_count

template<color_space ColorSpace, typename BaseComponent , typename ViewComponent = BaseComponent, std::size_t ColorComponentCount = 3, typename Derived = void>
constexpr std::size_t neogfx::basic_color< ColorSpace, BaseComponent, ViewComponent, ColorComponentCount, Derived >::component_count = ColorComponentCount + 1
staticconstexpr

Definition at line 88 of file color.hpp.


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