A templated pixel type class, where the channel type and number of channels are arguments.
Supports the defined channel types and channel counts of 1, 2, 3, and 4. It can convert between any one type of pixel and any other directly, and provides constructors to achieve this. It also supports swapping the r and b channels and converting to inverse luminance. The channel types handle converting between each other, while the pixel types handle converting between each other.
#include <image.h>
Public Member Functions |
|
| PixelType< ChanType, NumChans > & | swapRB () |
| Swap the red and blue channels -- converts
RGBA to BGRA and back. |
|
| PixelType (const PixelType< uInt8Channel, 4 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< uInt8Channel, 3 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< uInt8Channel, 2 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< uInt8Channel, 1 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< uInt16Channel, 4 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< uInt16Channel, 3 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< uInt16Channel, 2 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< uInt16Channel, 1 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< float16Channel, 4 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< float16Channel, 3 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< float16Channel, 2 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< float16Channel, 1 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< float32Channel, 4 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< float32Channel, 3 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< float32Channel, 2 > &p) | |
| conversion constructor |
|
| PixelType (const PixelType< float32Channel, 1 > &p) | |
| conversion constructor |
|
| void | SetLuminance (const PixelType< uInt8Channel, 4 > &p) |
| RGBA = Luminance of input. |
|
| void | SetLuminance (const PixelType< uInt8Channel, 3 > &p) |
| RGBA = Luminance of input. |
|
| void | SetLuminance (const PixelType< uInt16Channel, 4 > &p) |
| RGBA = Luminance of input. |
|
| void | SetLuminance (const PixelType< uInt16Channel, 3 > &p) |
| RGBA = Luminance of input. |
|
| void | SetLuminance (const PixelType< float16Channel, 4 > &p) |
| RGBA = Luminance of input. |
|
| void | SetLuminance (const PixelType< float16Channel, 3 > &p) |
| RGBA = Luminance of input. |
|
| void | SetLuminance (const PixelType< float32Channel, 4 > &p) |
| RGBA = Luminance of input. |
|
| void | SetLuminance (const PixelType< float32Channel, 3 > &p) |
| RGBA = Luminance of input. |
|
| void | SetLuminance (const PixelType< float32Channel, 1 > &p) |
| RGBA = Luminance of input. |
|
| void | SetLuminance (const PixelType< float16Channel, 1 > &p) |
| RGBA = Luminance of input. |
|
| void | SetLuminance (const PixelType< uInt16Channel, 1 > &p) |
| RGBA = Luminance of input. |
|
| void | SetLuminance (const PixelType< uInt8Channel, 1 > &p) |
| RGBA = Luminance of input. |
|
| void | SetInvLuminance (const PixelType< uInt8Channel, 4 > &p) |
| RGBA = 1 - Luminance of input. |
|
| void | SetInvLuminance (const PixelType< uInt8Channel, 3 > &p) |
| RGBA = 1 - Luminance of input. |
|
| void | SetInvLuminance (const PixelType< uInt16Channel, 4 > &p) |
| RGBA = 1 - Luminance of input. |
|
| void | SetInvLuminance (const PixelType< uInt16Channel, 3 > &p) |
| RGBA = 1 - Luminance of input. |
|
| void | SetInvLuminance (const PixelType< float16Channel, 4 > &p) |
| RGBA = 1 - Luminance of input. |
|
| void | SetInvLuminance (const PixelType< float16Channel, 3 > &p) |
| RGBA = 1 - Luminance of input. |
|
| void | SetInvLuminance (const PixelType< float32Channel, 4 > &p) |
| RGBA = 1 - Luminance of input. |
|
| void | SetInvLuminance (const PixelType< float32Channel, 3 > &p) |
| RGBA = 1 - Luminance of input. |
|
| void | SetInvLuminance (const PixelType< float32Channel, 1 > &p) |
| RGBA = 1 - Luminance of input. |
|
| void | SetInvLuminance (const PixelType< float16Channel, 1 > &p) |
| RGBA = 1 - Luminance of input. |
|
| void | SetInvLuminance (const PixelType< uInt16Channel, 1 > &p) |
| RGBA = 1 - Luminance of input. |
|
| void | SetInvLuminance (const PixelType< uInt8Channel, 1 > &p) |
| RGBA = 1 - Luminance of input. |
|
Friends |
|
| class | PixelType< uInt8Channel, 1 > |
| class | PixelType< uInt8Channel, 2 > |
| class | PixelType< uInt8Channel, 3 > |
| class | PixelType< uInt8Channel, 4 > |
| class | PixelType< uInt16Channel, 1 > |
| class | PixelType< uInt16Channel, 2 > |
| class | PixelType< uInt16Channel, 3 > |
| class | PixelType< uInt16Channel, 4 > |
| class | PixelType< float16Channel, 1 > |
| class | PixelType< float16Channel, 2 > |
| class | PixelType< float16Channel, 3 > |
| class | PixelType< float16Channel, 4 > |
| class | PixelType< float32Channel, 1 > |
| class | PixelType< float32Channel, 2 > |
| class | PixelType< float32Channel, 3 > |
| class | PixelType< float32Channel, 4 > |
| PixelType | ( | const PixelType< uInt8Channel, 4 > & | p | ) | [inline] |
conversion constructor
Definition at line 405 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = p.m_pixel[3]; // intentional fall through.
case 1: m_pixel[0] = ChanType(uInt16Channel((uInt8)p.m_pixel[0]*77 +
(uInt8)p.m_pixel[1]*150 +
(uInt8)p.m_pixel[2]*28));
break;
// cppcheck mistakenly warns about array bounds here -- ignore it.
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2]; m_pixel[3] = p.m_pixel[3];
break;
}
}
| PixelType | ( | const PixelType< uInt8Channel, 3 > & | p | ) | [inline] |
conversion constructor
Definition at line 424 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = ChanType( float32Channel( 1.0f ) ); // intentional fall through.
case 1: m_pixel[0] = ChanType(uInt16Channel((uInt8)p.m_pixel[0]*77 +
(uInt8)p.m_pixel[1]*150 +
(uInt8)p.m_pixel[2]*28));
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
m_pixel[3] = ChanType(float32Channel(1.0f));
break;
}
}
| PixelType | ( | const PixelType< uInt8Channel, 2 > & | p | ) | [inline] |
conversion constructor
Definition at line 443 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 1: m_pixel[0] = p.m_pixel[0];
break;
case 2: m_pixel[0] = p.m_pixel[0];
m_pixel[1] = p.m_pixel[1];
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
m_pixel[3] = p.m_pixel[1];
break;
}
}
| PixelType | ( | const PixelType< uInt8Channel, 1 > & | p | ) | [inline] |
conversion constructor
Definition at line 462 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = ChanType( float32Channel( 1.0f ) ); // intentional fall through.
case 1: m_pixel[0] = p.m_pixel[0];
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0]; m_pixel[3] = ChanType(float32Channel(1.0f)); ;
break;
}
}
| PixelType | ( | const PixelType< uInt16Channel, 4 > & | p | ) | [inline] |
conversion constructor
Definition at line 479 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = p.m_pixel[3]; // intentional fallthrough.
case 1: m_pixel[0] = ChanType(uInt16Channel((((uInt16)p.m_pixel[0]*19660)>>16) +
(((uInt16)p.m_pixel[1]*38666)>>16) +
(((uInt16)p.m_pixel[2]*7209 )>>16)));
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2]; m_pixel[3] = p.m_pixel[3];
break;
}
}
| PixelType | ( | const PixelType< uInt16Channel, 3 > & | p | ) | [inline] |
conversion constructor
Definition at line 499 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = ChanType(float32Channel(1.0f)); // intentional fallthrough
case 1: m_pixel[0] = ChanType(uInt16Channel((((uInt16)p.m_pixel[0]*19660)>>16) +
(((uInt16)p.m_pixel[1]*38666)>>16) +
(((uInt16)p.m_pixel[2]*7209 )>>16)));
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
m_pixel[3] = ChanType(float32Channel(1.0f));
break;
}
}
| PixelType | ( | const PixelType< uInt16Channel, 2 > & | p | ) | [inline] |
conversion constructor
Definition at line 518 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 1: m_pixel[0] = p.m_pixel[0];
break;
case 2: m_pixel[0] = p.m_pixel[0];
m_pixel[1] = p.m_pixel[1];
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
m_pixel[3] = p.m_pixel[1];
break;
}
}
| PixelType | ( | const PixelType< uInt16Channel, 1 > & | p | ) | [inline] |
conversion constructor
Definition at line 537 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = ChanType(float32Channel(1.0f)); // intentional fallthrough
case 1: m_pixel[0] = p.m_pixel[0];
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0]; m_pixel[3] = ChanType(float32Channel(1.0f));
break;
}
}
| PixelType | ( | const PixelType< float16Channel, 4 > & | p | ) | [inline] |
conversion constructor
Definition at line 554 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = p.m_pixel[1];
case 1: m_pixel[0] = ChanType(float32Channel(((float)p.m_pixel[0]*0.30f) +
((float)p.m_pixel[1]*0.59f) +
((float)p.m_pixel[2]*0.11f)));
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2]; m_pixel[3] = p.m_pixel[3];
break;
}
}
| PixelType | ( | const PixelType< float16Channel, 3 > & | p | ) | [inline] |
conversion constructor
Definition at line 572 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = ChanType(float32Channel(1.0f));
case 1: m_pixel[0] = ChanType(float32Channel(((float)p.m_pixel[0]*0.30f) +
((float)p.m_pixel[1]*0.59f) +
((float)p.m_pixel[2]*0.11f)));
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
m_pixel[3] = ChanType(float32Channel(1.0f));
break;
}
}
| PixelType | ( | const PixelType< float16Channel, 2 > & | p | ) | [inline] |
conversion constructor
Definition at line 591 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 1: m_pixel[0] = p.m_pixel[0];
break;
case 2: m_pixel[0] = p.m_pixel[0];
m_pixel[1] = p.m_pixel[1];
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
m_pixel[3] = p.m_pixel[1];
break;
}
}
| PixelType | ( | const PixelType< float16Channel, 1 > & | p | ) | [inline] |
conversion constructor
Definition at line 610 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = ChanType(float32Channel(1.0f));
case 1: m_pixel[0] = p.m_pixel[0];
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0]; m_pixel[3] = ChanType(float32Channel(1.0f));
break;
}
}
| PixelType | ( | const PixelType< float32Channel, 4 > & | p | ) | [inline] |
conversion constructor
Definition at line 627 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = p.m_pixel[3];
case 1: m_pixel[0] = ChanType(float32Channel(((float)p.m_pixel[0]*0.30f) +
((float)p.m_pixel[1]*0.59f) +
((float)p.m_pixel[2]*0.11f)));
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2]; m_pixel[3] = p.m_pixel[3];
break;
}
}
| PixelType | ( | const PixelType< float32Channel, 3 > & | p | ) | [inline] |
conversion constructor
Definition at line 645 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = ChanType(float32Channel(1.0f));
case 1: m_pixel[0] = ChanType(float32Channel(((float)p.m_pixel[0]*0.30f) +
((float)p.m_pixel[1]*0.59f) +
((float)p.m_pixel[2]*0.11f)));
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1];
m_pixel[2] = p.m_pixel[2];
m_pixel[3] = ChanType(float32Channel(1.0f));
break;
}
}
| PixelType | ( | const PixelType< float32Channel, 2 > & | p | ) | [inline] |
conversion constructor
Definition at line 664 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 1: m_pixel[0] = p.m_pixel[0];
break;
case 2: m_pixel[0] = p.m_pixel[0];
m_pixel[1] = p.m_pixel[1];
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
m_pixel[3] = p.m_pixel[1];
break;
}
}
| PixelType | ( | const PixelType< float32Channel, 1 > & | p | ) | [inline] |
conversion constructor
Definition at line 683 of file image.h.
{
switch (NumChans) { // this switch gets resolved at compile time
case 2: m_pixel[1] = ChanType(float32Channel(1.0f));
case 1: m_pixel[0] = p.m_pixel[0];
break;
case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0];
break;
case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0];
m_pixel[2] = p.m_pixel[0]; m_pixel[3] = ChanType(float32Channel(1.0f));
break;
}
}
| PixelType<ChanType, NumChans>& swapRB | ( | ) | [inline] |
| void SetLuminance | ( | const PixelType< uInt8Channel, 4 > & | p | ) | [inline] |
| void SetLuminance | ( | const PixelType< uInt8Channel, 3 > & | p | ) | [inline] |
| void SetLuminance | ( | const PixelType< uInt16Channel, 4 > & | p | ) | [inline] |
RGBA = Luminance of input.
| void SetLuminance | ( | const PixelType< uInt16Channel, 3 > & | p | ) | [inline] |
RGBA = Luminance of input.
| void SetLuminance | ( | const PixelType< float16Channel, 4 > & | p | ) | [inline] |
| void SetLuminance | ( | const PixelType< float16Channel, 3 > & | p | ) | [inline] |
| void SetLuminance | ( | const PixelType< float32Channel, 4 > & | p | ) | [inline] |
| void SetLuminance | ( | const PixelType< float32Channel, 3 > & | p | ) | [inline] |
| void SetLuminance | ( | const PixelType< float32Channel, 1 > & | p | ) | [inline] |
| void SetLuminance | ( | const PixelType< float16Channel, 1 > & | p | ) | [inline] |
| void SetLuminance | ( | const PixelType< uInt16Channel, 1 > & | p | ) | [inline] |
| void SetLuminance | ( | const PixelType< uInt8Channel, 1 > & | p | ) | [inline] |
| void SetInvLuminance | ( | const PixelType< uInt8Channel, 4 > & | p | ) | [inline] |
| void SetInvLuminance | ( | const PixelType< uInt8Channel, 3 > & | p | ) | [inline] |
| void SetInvLuminance | ( | const PixelType< uInt16Channel, 4 > & | p | ) | [inline] |
RGBA = 1 - Luminance of input.
| void SetInvLuminance | ( | const PixelType< uInt16Channel, 3 > & | p | ) | [inline] |
RGBA = 1 - Luminance of input.
| void SetInvLuminance | ( | const PixelType< float16Channel, 4 > & | p | ) | [inline] |
| void SetInvLuminance | ( | const PixelType< float16Channel, 3 > & | p | ) | [inline] |
| void SetInvLuminance | ( | const PixelType< float32Channel, 4 > & | p | ) | [inline] |
| void SetInvLuminance | ( | const PixelType< float32Channel, 3 > & | p | ) | [inline] |
| void SetInvLuminance | ( | const PixelType< float32Channel, 1 > & | p | ) | [inline] |
| void SetInvLuminance | ( | const PixelType< float16Channel, 1 > & | p | ) | [inline] |
| void SetInvLuminance | ( | const PixelType< uInt16Channel, 1 > & | p | ) | [inline] |
| void SetInvLuminance | ( | const PixelType< uInt8Channel, 1 > & | p | ) | [inline] |
friend class PixelType< uInt8Channel,1 >
[friend] |
friend class PixelType< uInt8Channel,2 >
[friend] |
friend class PixelType< uInt8Channel,3 >
[friend] |
friend class PixelType< uInt8Channel,4 >
[friend] |
friend class PixelType< uInt16Channel,1 >
[friend] |
friend class PixelType< uInt16Channel,2 >
[friend] |
friend class PixelType< uInt16Channel,3 >
[friend] |
friend class PixelType< uInt16Channel,4 >
[friend] |
friend class PixelType< float16Channel, 1
> [friend] |
friend class PixelType< float16Channel, 2
> [friend] |
friend class PixelType< float16Channel, 3
> [friend] |
friend class PixelType< float16Channel, 4
> [friend] |
friend class PixelType< float32Channel, 1
> [friend] |
friend class PixelType< float32Channel, 2
> [friend] |
friend class PixelType< float32Channel, 3
> [friend] |
friend class PixelType< float32Channel, 4
> [friend] |