#include <kino_plugin_types.h>
Public Types | |
| typedef double | sample_type |
| typedef color_traits< sample_type > | sample_traits |
| typedef basic_hsv | this_type |
Public Member Functions | |
| basic_hsv () | |
| Default constructor sets all samples to zero. | |
| basic_hsv (const sample_type Hue, const sample_type Saturation, const sample_type Value) | |
| Constructor that takes hue, saturation, and value samples. | |
| template<typename ForeignType, typename ForeignTraits> | |
| basic_hsv (const basic_luma< ForeignType, ForeignTraits > &RHS) | |
| template<typename ForeignType> | |
| basic_hsv (const ForeignType &RHS) | |
Public Attributes | |
| sample_type | hue |
| sample_type | saturation |
| sample_type | value |
Friends | |
| std::ostream & | operator<< (std::ostream &Stream, const basic_hsv &RHS) |
| Serialization. | |
| std::istream & | operator>> (std::istream &Stream, basic_hsv &RHS) |
| Deserialization. | |
Definition at line 150 of file kino_plugin_types.h.
|
|
Definition at line 154 of file kino_plugin_types.h. |
|
|
Definition at line 153 of file kino_plugin_types.h. |
|
|
Definition at line 155 of file kino_plugin_types.h. |
|
|
Default constructor sets all samples to zero.
Definition at line 158 of file kino_plugin_types.h. 00158 : 00159 hue(sample_traits::minimum()), 00160 saturation(sample_traits::minimum()), 00161 value(sample_traits::minimum()) 00162 { 00163 }
|
|
||||||||||||||||
|
Constructor that takes hue, saturation, and value samples.
Definition at line 166 of file kino_plugin_types.h. 00166 : 00167 hue(Hue), 00168 saturation(Saturation), 00169 value(Value) 00170 { 00171 }
|
|
||||||||||
|
Definition at line 174 of file kino_plugin_types.h. 00174 : 00175 hue(sample_traits::minimum()), 00176 saturation(sample_traits::minimum()), 00177 value(sample_traits::convert(RHS.luma)) 00178 { 00179 }
|
|
||||||||||
|
Definition at line 182 of file kino_plugin_types.h. References hue, kino::color_traits< SampleType >::minimum(), saturation, and value. 00183 {
00184 const sample_type red = sample_traits::convert(RHS.red);
00185 const sample_type green = sample_traits::convert(RHS.green);
00186 const sample_type blue = sample_traits::convert(RHS.blue);
00187
00188 const sample_type maxcomponent = std::max(std::max(red, green), blue);
00189 const sample_type mincomponent = std::min(std::min(red, green), blue);
00190 const sample_type difference = maxcomponent - mincomponent;
00191
00192 value = maxcomponent;
00193
00194 saturation = maxcomponent ? difference / maxcomponent : sample_traits::minimum();
00195
00196 if(saturation != sample_traits::minimum())
00197 {
00198 const sample_type reddistance = (maxcomponent - red) / difference;
00199 const sample_type greendistance = (maxcomponent - green) / difference;
00200 const sample_type bluedistance = (maxcomponent - blue) / difference;
00201
00202 if (RHS.red == std::max(std::max(RHS.red, RHS.green), RHS.blue))
00203 {
00204 hue = bluedistance - greendistance;
00205 }
00206 else if (RHS.green == std::max(std::max(RHS.red, RHS.green), RHS.blue))
00207 {
00208 hue = 2 + reddistance - bluedistance;
00209 }
00210 else
00211 {
00212 hue = 4 + greendistance - reddistance;
00213 }
00214
00215 hue *= 60;
00216 while(hue < 0)
00217 hue += 360;
00218 while(hue >= 360)
00219 hue -= 360;
00220 }
00221 else
00222 {
00223 hue = sample_traits::minimum();
00224 }
00225 }
|
|
||||||||||||
|
Serialization.
Definition at line 228 of file kino_plugin_types.h. 00229 {
00230 Stream << RHS.hue << " " << RHS.saturation << " " << RHS.value;
00231 return Stream;
00232 }
|
|
||||||||||||
|
Deserialization.
Definition at line 235 of file kino_plugin_types.h. 00236 {
00237 Stream >> RHS.hue >> RHS.saturation >> RHS.value;
00238 return Stream;
00239 }
|
|
|
Definition at line 241 of file kino_plugin_types.h. Referenced by basic_hsv(), and kino::basic_rgb< SampleType, SampleTraits >::basic_rgb(). |
|
|
Definition at line 242 of file kino_plugin_types.h. Referenced by basic_hsv(), and kino::basic_rgb< SampleType, SampleTraits >::basic_rgb(). |
|
|
Definition at line 243 of file kino_plugin_types.h. Referenced by basic_hsv(), and kino::basic_rgb< SampleType, SampleTraits >::basic_rgb(). |
1.4.2