1 #ifndef color__internal_lab_bound_natural 2 #define color__internal_lab_bound_natural 3 4 // ::color::_internal::lab::bound::natural< index_type, scalar_name > 5 6 7 #include "../../../_internal/utility/type/traitc.hpp" 8 #include "../../../_internal/utility/type/index.hpp" 9 10 11 #include "../../constant/reference.hpp" 12 13 14 namespace color 15 { 16 namespace _internal 17 { 18 namespace lab 19 { 20 namespace bound 21 { 22 template< typename scalar_name, typename index_name, ::color::constant::lab::reference_enum = ::color::constant::lab::error_entity > 23 struct natural 24 { 25 }; 26 27 template< typename scalar_name, typename index_name > 28 struct natural< scalar_name, index_name, ::color::constant::lab::CIE_entity > 29 { 30 public: 31 typedef scalar_name scalar_type; 32 typedef index_name index_type; 33 34 typedef ::color::_internal::utility::type::traitC< scalar_type > trait_type; 35 typedef ::color::_internal::utility::type::index< index_type > index_trait_type; 36 37 typedef typename trait_type::instance_type instance_type; 38 typedef typename trait_type::return_image_type return_image_type; 39 40 typedef typename index_trait_type::instance_type index_instance_type; 41 typedef typename index_trait_type::model_type index_input_const_type; 42 43 typedef natural< scalar_name, index_name, ::color::constant::lab::CIE_entity > this_type; 44 45 magiccolor::_internal::lab::bound::natural46 static instance_type magic() 47 { 48 return instance_type(1)-instance_type(16)/instance_type(116); 49 } 50 51 template< index_instance_type index > maximumcolor::_internal::lab::bound::natural52 static /*constexpr*/ return_image_type maximum( ) 53 { 54 static instance_type max_list[] = { 100, 500*this_type::magic(), 200*this_type::magic() }; 55 return max_list[index]; 56 } 57 maximumcolor::_internal::lab::bound::natural58 static /*constexpr*/ return_image_type maximum( index_input_const_type index ) 59 { 60 static instance_type max_list[] = { 100, 500*this_type::magic(), 200*this_type::magic() }; 61 return max_list[index]; 62 } 63 64 template< index_instance_type index > minimumcolor::_internal::lab::bound::natural65 static /*constexpr*/ return_image_type minimum( ) 66 { 67 static instance_type min_list[] = { 0, -500*this_type::magic(), -200*this_type::magic() }; 68 return min_list[index]; 69 } 70 minimumcolor::_internal::lab::bound::natural71 static /*constexpr*/ return_image_type minimum( index_input_const_type index ) 72 { 73 static instance_type min_list[] = { 0, -500*this_type::magic(), -200*this_type::magic() }; 74 return min_list[index]; 75 } 76 77 template< index_instance_type index > rangecolor::_internal::lab::bound::natural78 static /*constexpr*/ return_image_type range() 79 { 80 static instance_type range_list[] = { 100, 1000*this_type::magic(), 400*this_type::magic() }; 81 return range_list[index]; 82 } 83 rangecolor::_internal::lab::bound::natural84 static /*constexpr*/ return_image_type range( index_input_const_type index ) 85 { 86 static instance_type range_list[] = { 100, 1000*this_type::magic(), 400*this_type::magic() }; 87 return range_list[index]; 88 } 89 }; 90 91 template< typename scalar_name, typename index_name > 92 struct natural< scalar_name, index_name, ::color::constant::lab::Hunter_entity > 93 { 94 public: 95 typedef scalar_name scalar_type; 96 typedef index_name index_type; 97 98 typedef ::color::_internal::utility::type::traitC< scalar_type > trait_type; 99 typedef ::color::_internal::utility::type::index< index_type > index_trait_type; 100 101 typedef typename trait_type::instance_type instance_type; 102 typedef typename trait_type::return_image_type return_image_type; 103 104 typedef typename index_trait_type::instance_type index_instance_type; 105 typedef typename index_trait_type::model_type index_input_const_type; 106 107 typedef natural< scalar_name, index_name, ::color::constant::lab::Hunter_entity > this_type; 108 109 template< index_instance_type index > maximumcolor::_internal::lab::bound::natural110 static /*constexpr*/ return_image_type maximum( ) 111 { 112 static instance_type max_list[] = { 100, scalar_type( 2552.3 ), scalar_type( 67.0387 ) }; 113 return max_list[index]; 114 } 115 maximumcolor::_internal::lab::bound::natural116 static /*constexpr*/ return_image_type maximum( index_input_const_type index ) 117 { 118 static instance_type max_list[] = { 100, scalar_type( 2552.3 ), scalar_type( 67.0387 ) }; 119 return max_list[index]; 120 } 121 122 template< index_instance_type index > minimumcolor::_internal::lab::bound::natural123 static /*constexpr*/ return_image_type minimum( ) 124 { 125 static instance_type min_list[] = { 0, scalar_type( -172.355 ), scalar_type( -865.984 ) }; 126 return min_list[index]; 127 } 128 minimumcolor::_internal::lab::bound::natural129 static /*constexpr*/ return_image_type minimum( index_input_const_type index ) 130 { 131 static instance_type min_list[] = { 0, scalar_type( -172.355 ), scalar_type( -865.984 ) }; 132 return min_list[index]; 133 } 134 135 template< index_instance_type index > rangecolor::_internal::lab::bound::natural136 static /*constexpr*/ return_image_type range() 137 { 138 static instance_type range_list[] = { 100, this_type::maximum(1)-this_type::minimum(1), this_type::maximum(2)-this_type::minimum(2) }; 139 return range_list[index]; 140 } 141 rangecolor::_internal::lab::bound::natural142 static /*constexpr*/ return_image_type range( index_input_const_type index ) 143 { 144 static instance_type range_list[] = { 100, this_type::maximum(1)-this_type::minimum(1), this_type::maximum(2)-this_type::minimum(2) }; 145 return range_list[index]; 146 } 147 }; 148 149 } 150 } 151 } 152 } 153 154 #endif 155