###  | #  |

bit_aligned_pixel_reference
Pixel » Models | ColorBase » Models » bit_aligned_pixel_reference | PixelBased » Models

A heterogeneous pixel reference used to represent non-byte-aligned pixels. Models PixelConcept.

A heterogeneous pixel reference used to represent non-byte-aligned pixels. Models PixelConcept.

Example:

unsigned char data=0;
// A mutable reference to a 6-bit BGR pixel in "123" format (1 bit for red, 2 bits for green, 3 bits for blue)
using rgb123_ref_t = bit_aligned_pixel_reference<unsigned char, mp11::mp_list_c<int,1,2,3>, rgb_layout_t, true> const;
// create the pixel reference at bit offset 2
// (i.e. red = [2], green = [3,4], blue = [5,6,7] bits)
rgb123_ref_t ref(&data, 2);
get_color(ref, red_t()) = 1;
assert(data == 0x04);
get_color(ref, green_t()) = 3;
assert(data == 0x1C);
get_color(ref, blue_t()) = 7;
assert(data == 0xFC);
boost::gil::get_color
auto get_color(ColorBase &cb, Color=Color()) -> typename color_element_reference_type< ColorBase, Color >::type
Mutable accessor to the element associated with a given color name.
Definition: color_base_algorithm.hpp:190

Heterogeneous pixel reference corresponding to non-byte-aligned bit range. Models ColorBaseConcept, PixelConcept, PixelBasedConcept

Template Parameters

  BitField |
  ChannelBitSizes | Boost.MP11-compatible list of integral types defining the number of bits for each channel. For example, for 565RGB, mp_list_c<int,5,6,5>
  Layout |
  IsMutable |