1 #ifndef color_contant_YCgCo 2 #define color_contant_YCgCo 3 4 // ::color::constant::YCgCo< typename ::color::akin::YCgCo< category_name >::akin_type >::Wr() 5 6 #include "./category.hpp" 7 #include "../generic/trait/scalar.hpp" 8 9 10 namespace color 11 { 12 namespace constant 13 { 14 15 template< typename category_name > 16 struct YCgCo 17 { 18 public: 19 typedef category_name category_type; 20 21 typedef typename ::color::trait::scalar< category_name >::instance_type scalar_type; 22 23 typedef ::color::constant::YCgCo<category_type> this_type; 24 halfcolor::constant::YCgCo25 static /* constexpr*/ scalar_type const half(){ return 0.5; } onecolor::constant::YCgCo26 static /* constexpr*/ scalar_type const one() { return 1; } 27 Cg_mincolor::constant::YCgCo28 static /* constexpr*/ scalar_type const Cg_min() { return -0.5; } Cg_maxcolor::constant::YCgCo29 static /* constexpr*/ scalar_type const Cg_max() { return 0.5; } Cg_rangecolor::constant::YCgCo30 static /* constexpr*/ scalar_type const Cg_range(){ return 1; } 31 Co_mincolor::constant::YCgCo32 static /* constexpr*/ scalar_type const Co_min() { return -0.5; } Co_maxcolor::constant::YCgCo33 static /* constexpr*/ scalar_type const Co_max() { return 0.5; } Co_rangecolor::constant::YCgCo34 static /* constexpr*/ scalar_type const Co_range(){ return 1; } 35 Cg_diversecolor::constant::YCgCo36 static scalar_type Cg_diverse ( scalar_type const& normal ){ return this_type::Cg_range() * normal + this_type::Cg_min(); } Cg_normalizecolor::constant::YCgCo37 static scalar_type Cg_normalize( scalar_type const& divert ){ return ( divert - this_type::Cg_min() ) /this_type::Cg_range(); } 38 Co_diversecolor::constant::YCgCo39 static scalar_type Co_diverse ( scalar_type const& normal ){ return this_type::Co_range() * normal + this_type::Co_min(); } Co_normalizecolor::constant::YCgCo40 static scalar_type Co_normalize( scalar_type const& divert ){ return ( divert - this_type::Co_min() ) /this_type::Co_range(); } 41 42 }; 43 44 } 45 } 46 47 #endif 48