This template represents N-channel pixel/color. When there are more than one channel, the last channel is assumed to be an alpha(opacity) channel.
You can find more information in comments below.
template<class TYPE, size_t CHANNELS = 4>
struct TPixel
{
TYPE Data[CHANNELS]; // Elements/Channels
TYPE operator[](const size_t index) const; // Return element/channel at specified column. Allowed index range is from 0 to CHANNELS - 1. Used when TPixel is a constant object only
TYPE &operator[](const size_t index); // Return element/channel at specified column. Allowed index range is from 0 to CHANNELS - 1
};
Additionally following operators exists.
template<class TYPE, size_t CHANNELS = 4>
bool operator==(const TPixel<TYPE, CHANNELS> &a, const TPixel<TYPE, CHANNELS> &b); // Check whether pixels are equal. Can be used for non-float data types only
template<class TYPE, size_t CHANNELS = 4>
bool operator!=(const TPixel<TYPE, CHANNELS> &a, const TPixel<TYPE, CHANNELS> &b); // Check whether pixels aren't equal. Can be used for non-float data types only
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> operator+(const TPixel<TYPE, CHANNELS> &p, const TYPE val); // Add pixel and scalar
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> operator-(const TPixel<TYPE, CHANNELS> &p, const TYPE val); // Subtract pixel and scalar
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> operator*(const TPixel<TYPE, CHANNELS> &p, const TYPE val); // Multiply pixel and scalar
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> operator/(const TPixel<TYPE, CHANNELS> &p, const TYPE val); // Divide pixel and scalar
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> operator+(const TYPE val, const TPixel<TYPE, CHANNELS> &p); // Add scalar and pixel
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> operator-(const TYPE val, const TPixel<TYPE, CHANNELS> &p); // Subtract scalar and pixel
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> operator*(const TYPE val, const TPixel<TYPE, CHANNELS> &p); // Multiply scalar and pixel
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> operator/(const TYPE val, const TPixel<TYPE, CHANNELS> &p); // Divide scalar and pixel
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> &operator+=(TPixel<TYPE, CHANNELS> &p, const TYPE val); // Add scalar to pixel
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> &operator-=(TPixel<TYPE, CHANNELS> &p, const TYPE val); // Subtract scalar from pixel
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> &operator*=(TPixel<TYPE, CHANNELS> &p, const TYPE val); // Multiply pixel by scalar
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> &operator/=(TPixel<TYPE, CHANNELS> &p, const TYPE val); // Divide pixel by scalar
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> operator+(const TPixel<TYPE, CHANNELS> &a, const TPixel<TYPE, CHANNELS> &b); // Blend pixels
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> &operator+=(TPixel<TYPE, CHANNELS> &a, const TPixel<TYPE, CHANNELS> &b); // Blend pixel with the second one
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> operator*(const TPixel<TYPE, CHANNELS> &a, const TPixel<TYPE, CHANNELS> &b); // Blend pixels with the same algo renderers use
template<class TYPE, size_t CHANNELS = 4>
TPixel<TYPE, CHANNELS> &operator*=(TPixel<TYPE, CHANNELS> &a, const TPixel<TYPE, CHANNELS> &b); // Blend pixel with the second one using the same algo renderers use
Also there are some functions which can be used with TPixel template. Here they are.
Namespace: | ntl |
Include: | NTL/Core/Pixel.h |