Formats

TOC

Description

The way how specific color model will be present in memory.
Each format is uniquely presented by specific type.
In here are listed those type and it has to be used as template parameters for every color model.

See also

Memory consumptions for specific combination of model-format.

List of formats

bool

Component
Type is: bool
Container
Type is: std::array< bool, _size_ >. Where _size_ depends of color model.
Note
  • First component is denoted by first letter of its abbreviation.
  • First component occupy position with index 0, etc. .
  • Size of instance is equal to: sizeof( std::array< bool, _size_ > )
Note
Not supported by all formats.
Example
color::gray< bool > r;

std::uint8_t

Component
Type is: std::uint8_t
Container
Type is: std::array< std::uint8_t, _size_ >. Where _size_ depends of color model.
Note
  • First component is denoted by first letter of its abbreviation.
  • First component occupy position with index 0, etc. .
  • Size of instance is equal to: _size_ * sizeof( std::uint8_t ) .
Example
color::rgb< std::uint8_t > r;
red is first component in memory, second is blue, third is green.

std::uint16_t

Component
Type is: std::uint16_t
Container
Type is: std::array< std::uint16_t, _size_ >. Where _size_ depends of color model.
Note
  • First component is denoted by first letter of its abbreviation.
  • First component occupy position with index 0, etc. .
  • Size of instance is equal to: _size_ * sizeof( std::uint16_t ) .
Example
color::rgb< std::uint16_t > r; red is first component in memory, second is blue, third is green.

std::uint32_t

Component
Type is: std::uint32_t
Container
Type is: std::array< std::uint32_t, _size_ >. Where _size_ depends of color model.
Note
  • First component is denoted by first letter of its abbreviation.
  • First component occupy position with index 0, etc. .
  • Size of instance is equal to: _size_ * sizeof( std::uint32_t ) .
Example
color::rgb< std::uint32_t > r;

std::uint64_t

Component
Type is: std::uint64_t
Container
Type is: std::array< std::uint64_t, _size_ >. Where _size_ depends of color model.
Note
  • First component is denoted by first letter of its abbreviation.
  • First component occupy position with index 0, etc. .
  • Size of instance is equal to: _size_ * sizeof( std::uint64_t ) .
Example
color::rgb< std::uint64_t > r;

float

Component
Type is: float
Container
Type is: std::array< float, _size_ >. Where _size_ depends of color model.
Note
  • First component is denoted by first letter of its abbreviation.
  • First component occupy position with index 0, etc. .
  • Size of instance is equal to: _size_ * sizeof( float ) .
Example
color::rgb< float > r;

double

Component
Type is: double
Container
Type is: std::array< double, _size_ >. Where _size_ depends of color model.
Note
  • First component is denoted by first letter of its abbreviation.
  • First component occupy position with index 0, etc. .
  • Size of instance is equal to: _size_ * sizeof( double ) .
Example
color::rgb< double > r;

long double

Component
Type is: long double
Container
Type is: std::array< long double, _size_ >. Where _size_ depends of color model.
Note
  • First component is denoted by first letter of its abbreviation.
  • First component occupy position with index 0, etc. .
  • Size of instance is equal to: _size_ * sizeof( long double ) .
Example
color::rgb< long double > r;

::color::type::pack3< first_size, second_size, third_size >

Component
Type is:
template< unsigned first_size, unsigned second_size, unsigned third_size >
    struct ::color::type::pack3< first_size, second_size, third_size >
Container
std::uint8_t if 8 == ( first_size + second_size + third_size)
std::uint16_t if 16 == ( first_size + second_size + third_size)
std::uint32_t if 32 == ( first_size + second_size + third_size)
std::uint64_t if 64 == ( first_size + second_size + third_size)
Memory Order
First first_size insignificant bits is used for first component, next second_size bits for second component and last significant third_size for third component.
Example
color::rgb< ::color::type::pack3< 4, 4, 2 > > r;
4 bits for red, 4 bits for green and 2 bits for blue
Note
Only rgb and bgr can handle this type.
WARNING Memory representation for this type heavily depends of endianness!!!

::color::type::pack4< first_size, second_size, third_size, fourth_size >

Component
Type is:
template< unsigned first_size, unsigned second_size, unsigned third_size , unsigned fourth_size >
    struct ::color::type::pack3< first_size, second_size, third_size, fourth_size >
Container
std::uint8_t if 8 == ( first_size + second_size + third_size + fourth_size )
std::uint16_t if 16 == ( first_size + second_size + third_size + fourth_size )
std::uint32_t if 32 == ( first_size + second_size + third_size + fourth_size )
std::uint64_t if 64 == ( first_size + second_size + third_size + fourth_size )
Memory Order
First first_size insignificant bits is used for first component, next second_size bits for second component, next significant third_size for third and last fourth_size for fourth component.
Example
color::rgba< ::color::type::pack4< 4, 4, 4, 4 > > r; //4 bits for red, 4 bits for green, 4 bits for blue and 4 bits for alpha
Note
Only rgba, argb, abgr and bgra, can handle this type.
WARNING Memory representation for this type heavily depends of endianness!!!

::color::type::split233_t

Definition
typedef ::color::type::pack3< 2, 3, 3 > split233_t;
Component
Type is: std::uint8_t
Container
Type is: std::uint8_t.
Memory Order
First 2 insignificant bits is used for first component, next 3 for second and last 3 for third component.
Example
::color::rgb< color::type::split233_t > r;
red take first 2 insignificant bits, green next 3, and last significant 3 bits belong to blue.
Note
Size of container is fixed and equal to 1 byte.

::color::type::split332_t

Definition
typedef ::color::type::pack3< 3, 3, 2 > split332_t;
Component
Type is: std::uint8_t
Container
Type is: std::uint8_t.
Memory Order
First 3 insignificant bits is used for first component, next 3 for second and last 2 for third component.
Example
::color::rgb< color::type::split332_t > r;
Note
Size of container is fixed and equal to 1 byte.

::color::type::split422_t

Definition
typedef ::color::type::pack3< 4, 4, 2 > split422_t;
Component
Type is: std::uint8_t
Container
Type is: std::uint8_t.
Memory Order
First 4 insignificant bits is used for first component, next 2 for second and last 2 for third component.
Example
::color::rgb< color::type::split422_t > r;
Note
Size of container is fixed and equal to 1 byte.

color::type::split556_t

Definition
typedef ::color::type::pack3< 5, 5, 6 > split556_t;
Component
Type is: std::uint8_t
Container
Type is: std::uint16_t.
Memory Order
First 5 insignificant bits is used for first component, next 5 for second and last 6 for third component.
Example
::color::rgb< color::type::split556_t > r;
Note
Size of container is fixed and equal to 2 byte.

color::type::split565_t

Definition
typedef ::color::type::pack3< 5, 6, 5 > split565_t;
Component
Type is: std::uint8_t
Container
Type is: std::uint16_t.
Memory Order
First 5 insignificant bits is used for first component, next 6 for second and last 5 for third component.
Example
::color::rgb< color::type::split565_t > r;
Note
Size of container is fixed and equal to 2 bytes.

color::type::split655_t

Definition
typedef ::color::type::pack3< 6, 5, 5 > split655_t;
Component
Type is: std::uint8_t
Container
Type is: std::uint16_t.
Memory Order
First 6 insignificant bits is used for first component, next 5 for second and last 5 for third component.
Example
::color::rgb< color::type::split655_t > r;
Note
Size of container is fixed and equal to 2 bytes.

color::type::split5551_t

Definition
typedef ::color::type::pack4< 5, 5, 5, 1 > split5551_t;
Component
Type is: std::uint8_t
Container
Type is: std::uint16_t.
Memory Order
First 5 insignificant bits is used for first component, next 5 for second, 5 for third component and 1 for fourth..
Example
::color::rgba< color::type::split5551_t > r;
Note
Size of container is fixed and equal to 2 bytes.

::color::type::splitAAA2_t

Definition
typedef ::color::type::pack4< 10, 10, 10, 2 > splitAAA2_t;
Component
Type is: std::uint16_t
Container
Type is: std::uint32_t.
Memory Order
First 10 insignificant bits is used for first component, next 10 for second, next 10 for third component and last 2 for fourth .
Example
::color::rgba< color::type::splitAAA2_t > r;
Note
Size of container is fixed and equal to 4 bytes.

color::type::splitGGGG_t

Definition
typedef ::color::type::pack4< 16, 16, 16, 16 > splitGGGG_t;
Component
Type is: std::uint16_t
Container
Type is: std::uint64_t.
Memory Order
First 16 insignificant bits is used for first component, next 16 for second, next 16 for third component and last 16 for fourth .
Example
::color::rgba< color::type::spliGGGG_t > r;
Note
Size of container is fixed and equal to 8 bytes.