Namespace color::get
TOC
-
Description
- Get color property. From each color we can uniquely extract some information.
Note
- All functions has the same signature and they return akin values for akin type for given model.
- Generalized form:
-
template< typename category_name >
inline
typename ::color::trait::component< category_name >::return_image_type
blue( ::color::model< category_name > const& color_parameter );
- Specialized:
-
template< typename tag_name >
inline
typename ::color::trait::component< typename ::color::akin::rgb<::color::category::ModelName< tag_name > >::akin_type >::return_type
blue( ::color::model< ::color::category::ModelName< tag_name > > const& color_parameter );
- Example:
-
template< typename tag_name >
inline
typename ::color::trait::component< typename ::color::akin::rgb<::color::category::hsv< tag_name > >::akin_type >::return_type
blue( ::color::model< ::color::category::hsv< tag_name > > const& color_parameter );
Namespaces
-
- Name
- ::color::get::constant::rgb
- Description
- Contain constant to retrieve various feature from rgb model with different algorithm.
- Example
-
color::rgb c{ color::constant::turquoise_t{} };
auto hue = color::get::hue< ::color::get::constant::rgb::hue::polar_entity >( c );
Functions
-
- Name
- alpha
- Declaration
- See general Note about general declaration.
- Description
- Get alpha component.
- Note
- If alpha not exist maximum possible value for zeroth component will be returned.
- Example
-
::color::hsv < double > h{ ::color::constant::turquoise{} };
std::cout << ::color::get::alpha( h ) << std::cout;
- Name
- black
- Declaration
- See general Note about general declaration.
- Description
- Get black component or calculate if model does not support natively.
- Example
-
::color::yiq < double > h{ ::color::constant::aqua_t{}; };
std::cout << ::color::get::black( h ) << std::cout;
- Name
- blue
- Declaration
- See general Note about general declaration.
- Description
- Get blue component or calculate if model does not support natively.
- Example
-
::color::hsv < double > h{ ::color::constant::turquoise{} };
std::cout << ::color::get::blue( h ) << std::cout;
- Name
- chroma
- Declaration
- See general Note about general declaration.
- Description
- Get chroma component or calculate if model does not support natively.
- Note
- Getting chroma from different model may result different values.
- Example
-
::color::rgb < double > c { ::color::constant::aqua_t{}; }
std::cout << ::color::get::chroma< ::color::get::constant::rgb::chroma::distance2gray_entity >( c ) << std::cout;
std::cout << ::color::get::chroma< ::color::get::constant::rgb::chroma::max_minus_min_entity >( c ) << std::cout;
::color::LuvCH< double > c1;
std::cout << color::get::chroma( c1 ) << std::cout;
- Name
- gray
- Declaration
- See general Note about general declaration.
- Description
- Get gray component natively supported by model or calculate if does not supported natively.
- Note
- RGB support two algorithms for gray extraction.
- Example
-
::color::hsl < double > h = ::color::constant::orange_t{};
std::cout << ::color::get::gray( h ) << std::cout;
- Example
-
color::rgb<float> c = color::constant::turquoise_t{};
// Here is how to get gray component using default algorithm. Default is yuv709_entity formula.
auto g0 = color::get::gray( c );
// Here is how to get gray component by calculating average of them
auto g1 = color::get::gray< ::color::get::constant::gray::average_entity >( c );
// Here is how to get gray component by calculating (min + max)/2 of them
auto g1 = color::get::gray< ::color::get::constant::gray::middle_entity >( c );
// Here is how to get gray component by calculating y from YUV
auto g2 = color::get::gray< ::color::get::constant::gray::yuv709_entity >( c );
- Name
- green
- Declaration
- See general Note about general declaration.
- Description
- Get green component or calculate if model does not support natively.
- Example
-
::color::yiq < double > h{ ::color::constant::aqua_t{}; };
std::cout << ::color::get::green( h ) << std::cout;
- Name
- hue
- Declaration
- See general Note about general declaration.
- Description
- Get hue component or calculate if model does not support natively.
- Note
- If model is RGB you can pick different formula for calculation.
- Note
- For RGB model:
- Return type is ::color::trait::component< ::color::rgb< _type_ > ::category_type >::component_type.
- Range of return value mach to ::color::trait::bound< ::color::rgb< _type_ > ::category_type >.
- Example
-
::color::yiq < double > y{ ::color::contant::aqua_t{} };
std::cout << ::color::get::hue( y ) << std::cout;
- Example
-
::color::rgb< double > r{ ::color::contant::aqua_t{} };
::color::get::hue( r ); // Use default formula. Defualt is hexagon_entity
::color::get::hue< ::color::constant::hue::polar_entity >( r ); // Use default polar formula . Equal to polar_atan2_entity
::color::get::hue< ::color::constant::hue::polar_atan2_entity >( r ); // Use Evans, Hanson, and Brewer.
::color::get::hue< ::color::constant::hue::polar_acos_entity >( r ); // Use Evans, Hanson, and Brewer.
::color::get::hue< ::color::constant::hue::hexagon_entity >( r ); // Use Preucil formula.
- See
- hue in constants
- Name
- inphase
- Declaration
- See general Note about general declaration.
- Description
- Get inphase component or calculate if model does not support natively.
- Example
-
::color::yiq < double > h{ ::color::constant::aqua_t{}; };
std::cout << ::color::get::inphase( h ) << std::cout;
- Name
- tint
- Declaration
- See general Note about general declaration.
- Description
- Get tint component or calculate if model does not support natively.
- Example
-
::color::tsl < double > h{ ::color::constant::aqua_t{}; };
std::cout << ::color::get::tint( h ) << std::cout;
- Name
- key
- Declaration
- See general Note about general declaration.
- Description
- Get key component or calculate if model does not support natively.
- Note
- Key is fourth component of CMYK model.
- Example
-
::color::yiq < double > h{ ::color::constant::aqua_t{}; };
std::cout << ::color::get::key( h ) << std::cout;
- Name
- luma
- Declaration
- See general Note about general declaration.
- Get luma component or calculate if model does not support natively.
- Example
-
::color::yiq < double > h{ ::color::constant::aqua_t{}; };
std::cout << ::color::get::luma( h ) << std::cout;
- Name
- luminance
- Declaration
- See general Note about general declaration.
- Description
- Get luminance component or calculate if model does not support natively.
- Example
-
::color::yiq < double > h{ ::color::constant::aqua_t{}; };
std::cout << ::color::get::luminance( h ) << std::cout;
- Name
- quadrature
- Declaration
- See general Note about general declaration.
- Description
- Get quadrature component or calculate if model does not support natively.
- Example
-
::color::yiq < double > h{ ::color::constant::aqua_t{}; };
std::cout << ::color::get::quadrature( h ) << std::cout;
- Name
- saturation
- Declaration
- See general Note about general declaration.
- Description
- Get saturation component or calculate if model does not support natively.
- Example
-
::color::rgb < double > c { ::color::constant::aqua_t{}; }
std::cout << ::color::get::saturation< ::color::get::constant::rgb::saturation::hsv_entity >( c ) << std::cout;
std::cout << ::color::get::saturation< ::color::get::constant::rgb::saturation::hsl_entity >( c ) << std::cout;
std::cout << ::color::get::saturation< ::color::get::constant::rgb::saturation::hsi_entity >( c ) << std::cout;
::color::hsi< double > c1;
std::cout << color::get::saturation( c1 ) << std::cout;
::color::hsl< double > c2;
std::cout << color::get::saturation( c2 ) << std::cout;
::color::hsv< double > c3;
std::cout << color::get::saturation( c3 ) << std::cout;
- Name
- red
- Declaration
- See general Note about general declaration.
- Description
- Get red component or calculate if model does not support natively.
- Example
-
::color::yiq < double > h{ ::color::constant::aqua_t{}; };
std::cout << ::color::get::red( h ) << std::cout;
- Name
- white
- Declaration
- See general Note about general declaration.
- Description
- Get white component or calculate if model does not support natively.
- Example
-
::color::yiq < double > h{ ::color::constant::aqua_t{}; };
std::cout << ::color::get::white( h ) << std::cout;