// Defining bit aligned images

// 1-bit black/white image
typedef bit_aligned_image1_type< 1, gray_layout_t >::type gray1_image_t;

// 4-bit gray image
typedef bit_aligned_image1_type< 4, gray_layout_t >::type gray4_image_t;

// 2-bits per channel rgb image
typedef bit_aligned_image3_type< 2, 2, 2, rgb_layout_t >::type rgb2_image_t;

// rgb332 image
typedef bit_aligned_image3_type< 3, 3, 2, rgb_layout_t >::type rgb332_image_t;


// Useful metafunctions

// Please note, for bit_aligned images we use view_t::reference type and 
// not view_t::value_type ( pixel_t ).

typedef gray1_image_t::view_t::reference  gray1_ref_t;
typedef gray4_image_t::view_t::reference  gray4_ref_t;
typedef rgb2_image_t::view_t::reference   rgb2_ref_t;
typedef rgb332_image_t::view_t::reference rgb332_ref_t;


// num_channels< Reference >
BOOST_STATIC_ASSERT( num_channels< gray1_ref_t  >::value == 1 );
BOOST_STATIC_ASSERT( num_channels< gray4_ref_t  >::value == 1 );
BOOST_STATIC_ASSERT( num_channels< rgb2_ref_t   >::value == 3 );
BOOST_STATIC_ASSERT( num_channels< rgb332_ref_t >::value == 3 );
Advertisements