refinery
RAW file processor
Public Member Functions

refinery::ColorConverter< T, NFrom, NTo > Class Template Reference

Converts from one color space to another. More...

#include <refinery/color.h>

Collaboration diagram for refinery::ColorConverter< T, NFrom, NTo >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

template<typename U >
 ColorConverter (const U(&matrix)[NTo][NFrom])
 Constructor.
template<typename U , typename V >
void convert (const U(&in)[NFrom], V(&out)[NTo])
 Convert an input vector to an output one.
template<typename U , typename V >
void convert (const U(&in)[NFrom-1], V(&out)[NTo])
 Convert an undersized input vector to an output one.

Detailed Description

template<typename T, std::size_t NFrom, std::size_t NTo>
class refinery::ColorConverter< T, NFrom, NTo >

Converts from one color space to another.

Example:

 float conversionMatrix[3][4]; // e.g. CMYK to RGB
 // ... fill in conversionMatrix ...
 ColorConverter<float, 4, 3> converter(conversionMatrix);
 CMYKPixel<float>* in;
 RGBPixel<float>* out;

 for (in = firstPixel; in < lastPixel; in++, out++) {
   converter.convert(in->constArray(), out->array());
 }
Template Parameters:
TType of conversion matrix (usually float or double).
NFromArity of source arrays.
NToArity of destination arrays.

Definition at line 32 of file color.h.


Constructor & Destructor Documentation

template<typename T , std::size_t NFrom, std::size_t NTo>
template<typename U >
refinery::ColorConverter< T, NFrom, NTo >::ColorConverter ( const U(&)  matrix[NTo][NFrom]) [inline]

Constructor.

Template Parameters:
UDatatype of the conversion matrix (usually inferred).
Parameters:
[in]matrixThe conversion matrix (will be copied).

Definition at line 42 of file color.h.


Member Function Documentation

template<typename T , std::size_t NFrom, std::size_t NTo>
template<typename U , typename V >
void refinery::ColorConverter< T, NFrom, NTo >::convert ( const U(&)  in[NFrom],
V(&)  out[NTo] 
) [inline]

Convert an input vector to an output one.

Template Parameters:
UDatatype of input vector (usually inferred).
VDatatype of output vector (usually inferred).
Parameters:
[in]inVector with NFrom input colors.
[out]outVector with NTo output colors.

Definition at line 59 of file color.h.

template<typename T , std::size_t NFrom, std::size_t NTo>
template<typename U , typename V >
void refinery::ColorConverter< T, NFrom, NTo >::convert ( const U(&)  in[NFrom-1],
V(&)  out[NTo] 
) [inline]

Convert an undersized input vector to an output one.

We need this special case, because we sometimes treat all cameras as having 4-color sensor arrays when they actually have 3, but at other times we optimize away the final element. Usually users won't need to directly specify this method.

Template Parameters:
UDatatype of input vector (usually inferred).
VDatatype of output vector (usually inferred).
Parameters:
[in]inVector with NFrom input colors.
[out]outVector with NTo output colors.

Definition at line 85 of file color.h.


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