Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

kino::basic_rgb< SampleType, SampleTraits > Class Template Reference

Encapsulates storage for an RGB color sample. More...

#include <kino_plugin_types.h>

Collaboration diagram for kino::basic_rgb< SampleType, SampleTraits >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef SampleType sample_type
typedef SampleTraits sample_traits
typedef basic_rgb< sample_type,
sample_traits
this_type

Public Member Functions

 basic_rgb ()
 Default constructor sets all samples to zero.
 basic_rgb (const sample_type Red, const sample_type Green, const sample_type Blue)
 Constructor that takes red, green, and blue samples.
template<typename ForeignType, typename ForeignTraits>
 basic_rgb (const basic_luma< ForeignType, ForeignTraits > &RHS)
template<typename ForeignType, typename ForeignTraits>
 basic_rgb (const basic_rgb< ForeignType, ForeignTraits > &RHS)
template<typename ForeignType, typename ForeignTraits>
 basic_rgb (const basic_rgba< ForeignType, ForeignTraits > &RHS)
 basic_rgb (const basic_hsv &RHS)

Public Attributes

sample_type red
sample_type green
sample_type blue

Friends

std::ostream & operator<< (std::ostream &Stream, const basic_rgb< sample_type, sample_traits > &RHS)
 Serialization.
std::istream & operator>> (std::istream &Stream, basic_rgb< sample_type, sample_traits > &RHS)
 Deserialization.

Detailed Description

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
class kino::basic_rgb< SampleType, SampleTraits >

Encapsulates storage for an RGB color sample.

Definition at line 317 of file kino_plugin_types.h.


Member Typedef Documentation

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
typedef SampleTraits kino::basic_rgb< SampleType, SampleTraits >::sample_traits
 

Definition at line 321 of file kino_plugin_types.h.

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
typedef SampleType kino::basic_rgb< SampleType, SampleTraits >::sample_type
 

Definition at line 320 of file kino_plugin_types.h.

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
typedef basic_rgb<sample_type, sample_traits> kino::basic_rgb< SampleType, SampleTraits >::this_type
 

Definition at line 322 of file kino_plugin_types.h.


Constructor & Destructor Documentation

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
kino::basic_rgb< SampleType, SampleTraits >::basic_rgb  )  [inline]
 

Default constructor sets all samples to zero.

Definition at line 325 of file kino_plugin_types.h.

00325                 :
00326         red(sample_traits::minimum()),
00327         green(sample_traits::minimum()),
00328         blue(sample_traits::minimum())
00329     {
00330     }
    

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
kino::basic_rgb< SampleType, SampleTraits >::basic_rgb const sample_type  Red,
const sample_type  Green,
const sample_type  Blue
[inline]
 

Constructor that takes red, green, and blue samples.

Definition at line 333 of file kino_plugin_types.h.

00333                                                                                       :
00334         red(Red),
00335         green(Green),
00336         blue(Blue)
00337     {
00338     }

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
template<typename ForeignType, typename ForeignTraits>
kino::basic_rgb< SampleType, SampleTraits >::basic_rgb const basic_luma< ForeignType, ForeignTraits > &  RHS  )  [inline]
 

Definition at line 341 of file kino_plugin_types.h.

00341                                                                  :
00342         red(sample_traits::convert(RHS.luma)),
00343         green(sample_traits::convert(RHS.luma)),
00344         blue(sample_traits::convert(RHS.luma))
00345     {
00346     }

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
template<typename ForeignType, typename ForeignTraits>
kino::basic_rgb< SampleType, SampleTraits >::basic_rgb const basic_rgb< ForeignType, ForeignTraits > &  RHS  )  [inline]
 

Definition at line 349 of file kino_plugin_types.h.

00349                                                                 :
00350         red(sample_traits::convert(RHS.red)),
00351         green(sample_traits::convert(RHS.green)),
00352         blue(sample_traits::convert(RHS.blue))
00353     {
00354     }

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
template<typename ForeignType, typename ForeignTraits>
kino::basic_rgb< SampleType, SampleTraits >::basic_rgb const basic_rgba< ForeignType, ForeignTraits > &  RHS  )  [inline]
 

Definition at line 357 of file kino_plugin_types.h.

00357                                                                  :
00358         red(sample_traits::convert(RHS.red)),
00359         green(sample_traits::convert(RHS.green)),
00360         blue(sample_traits::convert(RHS.blue))
00361     {
00362     }

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
kino::basic_rgb< SampleType, SampleTraits >::basic_rgb const basic_hsv RHS  )  [inline]
 

Definition at line 364 of file kino_plugin_types.h.

References kino::basic_rgb< SampleType, SampleTraits >::blue, kino::basic_rgb< SampleType, SampleTraits >::green, kino::basic_hsv::hue, kino::basic_rgb< SampleType, SampleTraits >::red, kino::basic_hsv::saturation, and kino::basic_hsv::value.

00365     {
00366         // Easiest case - saturation is zero
00367         if(0 == RHS.saturation)
00368             {
00369                 red = green = blue = sample_traits::convert(RHS.value);
00370                 return;
00371             }
00372             
00373         const double h = RHS.hue / 60;
00374         const double i = floor(h);
00375         const double f = h - i;
00376         const double p = RHS.value * (1 - RHS.saturation);
00377         const double q = RHS.value * (1 - (RHS.saturation * f));
00378         const double t = RHS.value * (1 - (RHS.saturation * (1 - f)));
00379 
00380         if(0.0 == i)
00381             {
00382                 red = sample_traits::convert(RHS.value);
00383                 green = sample_traits::convert(t);
00384                 blue = sample_traits::convert(p);
00385             }
00386         else if(1.0 == i)
00387             {
00388                 red = sample_traits::convert(q);
00389                 green = sample_traits::convert(RHS.value);
00390                 blue = sample_traits::convert(p);
00391             }
00392         else if(2.0 == i)
00393             {
00394                 red = sample_traits::convert(p);
00395                 green = sample_traits::convert(RHS.value);
00396                 blue = sample_traits::convert(t);
00397             }
00398         else if(3.0 == i)
00399             {
00400                 red = sample_traits::convert(p);
00401                 green = sample_traits::convert(q);
00402                 blue = sample_traits::convert(RHS.value);
00403             }
00404         else if(4.0 == i)
00405             {
00406                 red = sample_traits::convert(t);
00407                 green = sample_traits::convert(p);
00408                 blue = sample_traits::convert(RHS.value);
00409             }
00410         else if(5.0 == i)
00411             {
00412                 red = sample_traits::convert(RHS.value);
00413                 green = sample_traits::convert(p);
00414                 blue = sample_traits::convert(q);
00415             }
00416     }


Friends And Related Function Documentation

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
std::ostream& operator<< std::ostream &  Stream,
const basic_rgb< sample_type, sample_traits > &  RHS
[friend]
 

Serialization.

Definition at line 419 of file kino_plugin_types.h.

00420     {
00421         Stream << RHS.red << " " << RHS.green << " " << RHS.blue;
00422         return Stream;
00423     }

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
std::istream& operator>> std::istream &  Stream,
basic_rgb< sample_type, sample_traits > &  RHS
[friend]
 

Deserialization.

Definition at line 426 of file kino_plugin_types.h.

00427     {
00428         Stream >> RHS.red >> RHS.green >> RHS.blue;
00429         return Stream;
00430     }


Member Data Documentation

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
sample_type kino::basic_rgb< SampleType, SampleTraits >::blue
 

Definition at line 434 of file kino_plugin_types.h.

Referenced by kino::basic_rgb< SampleType, SampleTraits >::basic_rgb().

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
sample_type kino::basic_rgb< SampleType, SampleTraits >::green
 

Definition at line 433 of file kino_plugin_types.h.

Referenced by kino::basic_rgb< SampleType, SampleTraits >::basic_rgb().

template<typename SampleType, typename SampleTraits = color_traits<SampleType>>
sample_type kino::basic_rgb< SampleType, SampleTraits >::red
 

Definition at line 432 of file kino_plugin_types.h.

Referenced by kino::basic_rgb< SampleType, SampleTraits >::basic_rgb().


The documentation for this class was generated from the following file:
Generated on Sun Mar 11 22:13:29 2007 for Kino by  doxygen 1.4.2