Functor converting a 1bpp buffer to a 32bpp buffer. More...
Public Member Functions | |
void | operator() (scanline &dest, const char *src, const color_palette_type &palette) const |
Convert a bitset array to a pixel32 scanline. |
Functor converting a 1bpp buffer to a 32bpp buffer.
Definition at line 219 of file bitmap.hpp.
void claw::graphic::bitmap::reader::pixel1_to_pixel32::operator() | ( | scanline & | dest, | |
const char * | src, | |||
const color_palette_type & | palette | |||
) | const |
Convert a bitset array to a pixel32 scanline.
dest | (out) Filled scanline. | |
src | Pixel array to convert. | |
palette | Color palette. |
Definition at line 186 of file bitmap_reader.cpp.
References claw::graphic::image::scanline::begin(), and claw::graphic::image::scanline::size().
{ assert(palette.size() == 2); scanline::iterator it( dest.begin() ); const unsigned int n = dest.size(); const unsigned int byte_size = 8; // 8 bits per byte const unsigned int upper_bound = n / byte_size; for (unsigned int i=0; i!=upper_bound; ++i) for (unsigned int j=0; j!=byte_size; ++j, ++it) if ( src[i] & (0x80 >> j) ) *it = palette[1]; else *it = palette[0]; for (unsigned int j = 0; j != (n % byte_size); ++j, ++it) if ( src[upper_bound] & (0x80 >> j) ) *it = palette[1]; else *it = palette[0]; } // bitmap::reader::pixel1_to_pixel32()