Simple++
Powerfull and lightning fast C++ Library
Public Member Functions | Protected Member Functions | List of all members
Graphic::Gradient< C, InterFunc > Class Template Reference

Represent a 2D Gradient for 2D image processing. More...

#include <Gradient.h>

Inheritance diagram for Graphic::Gradient< C, InterFunc >:
Graphic::GradientHorizontal< C, InterFunc > Graphic::GradientLinear< C, InterFunc > Graphic::GradientRadial< C, InterFunc > Graphic::GradientVertical< C, InterFunc >

Public Member Functions

 ~Gradient ()
 destructor More...
 
void addPoint (float position, const C &color)
 add a point to this gradient. More...
 
Vector< GradientPoint< C > * >::Size getNumPoints () const
 get the number of points of this gradient. More...
 
GradientPoint< C > & operator[] (typename Vector< GradientPoint< C > * >::Size i)
 Operator [] to direct access points inside this gradient. More...
 
const GradientPoint< C > & operator[] (typename Vector< GradientPoint< C > * >::Size i) const
 Operator [] to direct access points inside this gradient. More...
 
template<size_t N, typename InterFunc2 = InterFunc>
void computeInterpolation (C(&buffer)[N], const InterFunc2 &functor=InterFunc(), float begin=0.0f, float end=1.0f) const
 Compute the interpolation of every color of this gradient in an 1D array. More...
 
template<typename InterFunc2 = InterFunc>
void computeInterpolation (C *buffer, size_t size, const InterFunc2 &functor=InterFunc(), float begin=0.0f, float end=1.0f) const
 Compute the interpolation of every color of this gradient in an 1D array. More...
 
void computeInterpolation (C *buffer, size_t size, float begin=0.0f, float end=1.0f) const
 Compute the interpolation of every color of this gradient in an 1D array. More...
 

Protected Member Functions

 Gradient (const InterFunc &functor=InterFunc())
 Create a new gradient. More...
 

Detailed Description

template<typename C, typename InterFunc = InterpolationFunc::Linear>
class Graphic::Gradient< C, InterFunc >

Represent a 2D Gradient for 2D image processing.

Constructor & Destructor Documentation

template<typename C , typename InterFunc >
Graphic::Gradient< C, InterFunc >::~Gradient ( )

destructor

template<typename C , typename InterFunc >
Graphic::Gradient< C, InterFunc >::Gradient ( const InterFunc &  functor = InterFunc())
protected

Create a new gradient.

Parameters
functorFunctor used to interpolate the colors overloaded with : template<typename C> inline C operator()(const C & color1, const C & color2, float x) const;

Member Function Documentation

template<typename C , typename InterFunc >
void Graphic::Gradient< C, InterFunc >::addPoint ( float  position,
const C &  color 
)

add a point to this gradient.

template<typename C , typename InterFunc >
template<size_t N, typename InterFunc2 >
void Graphic::Gradient< C, InterFunc >::computeInterpolation ( C(&)  buffer[N],
const InterFunc2 &  functor = InterFunc(),
float  begin = 0.0f,
float  end = 1.0f 
) const

Compute the interpolation of every color of this gradient in an 1D array.

Parameters
outkernel Already allocated buffer to be filled with the interpolation of this gradient.
functorFunctor used to interpolate the colors overloaded with : template<typename C> inline C operator()(const C & color1, const C & color2, float x) const;
beginbeginning of the interpolation (between 0.0 and 1.0)
endending of the interpolation (between 0.0 and 1.0)
template<typename C , typename InterFunc >
template<typename InterFunc2>
void Graphic::Gradient< C, InterFunc >::computeInterpolation ( C *  buffer,
size_t  size,
const InterFunc2 &  functor = InterFunc(),
float  begin = 0.0f,
float  end = 1.0f 
) const

Compute the interpolation of every color of this gradient in an 1D array.

Parameters
outkernel Already allocated buffer to be filled with the interpolation of this gradient.
functorFunctor used to interpolate the colors overloaded with : template<typename C> inline C operator()(const C & color1, const C & color2, float x) const;
beginbeginning of the interpolation (between 0.0 and 1.0)
endending of the interpolation (between 0.0 and 1.0)
template<typename C , typename InterFunc >
void Graphic::Gradient< C, InterFunc >::computeInterpolation ( C *  buffer,
size_t  size,
float  begin = 0.0f,
float  end = 1.0f 
) const

Compute the interpolation of every color of this gradient in an 1D array.

Parameters
outkernel Already allocated buffer to be filled with the interpolation of this gradient.
beginbeginning of the interpolation (between 0.0 and 1.0)
endending of the interpolation (between 0.0 and 1.0)
template<typename C , typename InterFunc >
Vector< GradientPoint< C > * >::Size Graphic::Gradient< C, InterFunc >::getNumPoints ( ) const

get the number of points of this gradient.

Returns
Number of points of this gradient.
template<typename C , typename InterFunc >
GradientPoint< C > & Graphic::Gradient< C, InterFunc >::operator[] ( typename Vector< GradientPoint< C > * >::Size  i)

Operator [] to direct access points inside this gradient.

Parameters
iindex of the points (in the order added first is 0)
template<typename C , typename InterFunc >
const GradientPoint< C > & Graphic::Gradient< C, InterFunc >::operator[] ( typename Vector< GradientPoint< C > * >::Size  i) const

Operator [] to direct access points inside this gradient.

Parameters
iindex of the points (in the order added first is 0)

The documentation for this class was generated from the following files: