vigra - Numeric and Promote Traits of RGBValue

[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

Numeric and Promote Traits of RGBValue |

The numeric and promote traits for RGBValues follow the general specifications for Numeric and Promotion Traits. They are implemented in terms of the traits of the basic types by partial template specialization. Note that PromoteTraits are only defined for the case that the color indices are the same in both RGBValues.

        template <class T, unsigned int R, unsigned int G, unsigned int B>
        struct NumericTraits<RGBValue<T, R, G, B> >
        {
            typedef RGBValue<T, R, G, B> Type;
            typedef RGBValue<typename NumericTraits<T>::Promote, R, G, B> Promote;
            typedef RGBValue<typename NumericTraits<T>::RealPromote, R, G, B> RealPromote;
            typedef RGBValue<typename NumericTraits<T>::ComplexPromote, R, G, B> ComplexPromote;
            typedef T ValueType;

            typedef typename NumericTraits<T>::isIntegral isIntegral;
            typedef VigraFalseType isScalar;
            typedef typename NumericTraits<T>::isSigned isSigned;

            // etc.
        };

        template <class T, unsigned int R, unsigned int G, unsigned int B>
        struct NormTraits<RGBValue<T, R, G, B> >
        {
            typedef RGBValue<T, R, G, B> Type;
            typedef typename Type::SquaredNormType    SquaredNormType;
            typedef typename Type::NormType           NormType;
        };

        template <class T1, unsigned int R, unsigned int G, unsigned int B, class T2>
        struct PromoteTraits<RGBValue<T1, R, G, B>, RGBValue<T2, R, G, B> >
        {
            typedef RGBValue<typename PromoteTraits<T1, T2>::Promote, R, G, B> Promote;
        };

        template <class T, unsigned int R, unsigned int G, unsigned int B>
        struct PromoteTraits<RGBValue<T, R, G, B>, double >
        {
            typedef RGBValue<typename NumericTraits<T>::RealPromote, R, G, B> Promote;
        };

        template <class T, unsigned int R, unsigned int G, unsigned int B>
        struct PromoteTraits<double, RGBValue<T, R, G, B> >
        {
            typedef RGBValue<typename NumericTraits<T>::RealPromote, R, G, B> Promote;
        };

#include <vigra/rgbvalue.hxx>
Namespace: vigra

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.9.0 (Tue Nov 6 2012)