refinery
RAW file processor
Public Types | Public Member Functions | Public Attributes | Static Public Attributes

refinery::Pixel< T, N > Struct Template Reference

A pixel, consisting of one or more color values. More...

#include <refinery/image.h>

Inheritance diagram for refinery::Pixel< T, N >:
Inheritance graph
[legend]
Collaboration diagram for refinery::Pixel< T, N >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef unsigned int ColorType
 Datatype to access a color with at().
typedef T ValueType
 Value type of each color (e.g. unsigned short).
typedef T ArrayType [NColors]
 Type returned from array().

Public Member Functions

 Pixel ()
 Empty constructor.
template<typename U >
 Pixel (const U(&rhs)[N])
 Constructor.
template<typename U >
 Pixel (const Pixel< U, N > &rhs)
 Copy constructor.
ArrayTypearray ()
 The Pixel as an array.
const ArrayTypeconstArray () const
 The Pixel as an const array.
T & operator[] (const ColorType &index)
 A mutable reference to a single color value.
const T & at (const ColorType &index) const
 A single color value.

Public Attributes

ArrayType colors
 Raw data.

Static Public Attributes

static const ColorType NColors = N
 Number of colors.

Detailed Description

template<typename T, unsigned int N>
struct refinery::Pixel< T, N >

A pixel, consisting of one or more color values.

Template Parameters:
TType of each color value.
NNumber of colors.

Definition at line 89 of file image.h.


Member Typedef Documentation

template<typename T, unsigned int N>
typedef T refinery::Pixel< T, N >::ArrayType[NColors]

Type returned from array().

Definition at line 93 of file image.h.

template<typename T, unsigned int N>
typedef unsigned int refinery::Pixel< T, N >::ColorType

Datatype to access a color with at().

Definition at line 90 of file image.h.

template<typename T, unsigned int N>
typedef T refinery::Pixel< T, N >::ValueType

Value type of each color (e.g. unsigned short).

Definition at line 92 of file image.h.


Constructor & Destructor Documentation

template<typename T, unsigned int N>
template<typename U >
refinery::Pixel< T, N >::Pixel ( const U(&)  rhs[N]) [inline]

Constructor.

Parameters:
[in]rhsN-element array to copy into this type.
Template Parameters:
UType of the input array (usually inferred).

Definition at line 110 of file image.h.

template<typename T, unsigned int N>
template<typename U >
refinery::Pixel< T, N >::Pixel ( const Pixel< U, N > &  rhs) [inline]

Copy constructor.

Parameters:
[in]rhsAnother N-color Pixel.
Template Parameters:
UValueType from the input Pixel (usually inferred).

Definition at line 121 of file image.h.


Member Function Documentation

template<typename T, unsigned int N>
ArrayType& refinery::Pixel< T, N >::array ( ) [inline]

The Pixel as an array.

Changes to this array will modify the underlying Pixel.

This method is inlined, so it usually takes 0 CPU instructions.

Returns:
An N-element array.

Definition at line 135 of file image.h.

template<typename T, unsigned int N>
const T& refinery::Pixel< T, N >::at ( const ColorType index) const [inline]

A single color value.

This is like operator[] but works for a const Pixel.

Parameters:
[in]indexColor to access.
Returns:
The color value.

Definition at line 159 of file image.h.

template<typename T, unsigned int N>
const ArrayType& refinery::Pixel< T, N >::constArray ( ) const [inline]

The Pixel as an const array.

This method is inlined, so it usually takes 0 CPU instructions.

Returns:
A 3-element const array.

Definition at line 143 of file image.h.

template<typename T, unsigned int N>
T& refinery::Pixel< T, N >::operator[] ( const ColorType index) [inline]

A mutable reference to a single color value.

Parameters:
[in]indexColor to access.
Returns:
A mutable reference to the color value.

Definition at line 150 of file image.h.


Member Data Documentation

template<typename T, unsigned int N>
ArrayType refinery::Pixel< T, N >::colors

Raw data.

Definition at line 94 of file image.h.

template<typename T, unsigned int N>
const ColorType refinery::Pixel< T, N >::NColors = N [static]

Number of colors.

Definition at line 91 of file image.h.


The documentation for this struct was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator