30 #ifndef __CLAW_BITMAP_HPP__ 31 #define __CLAW_BITMAP_HPP__ 65 BMP_COMPRESSION_RGB = 0,
66 BMP_COMPRESSION_RLE8 = 1,
67 BMP_COMPRESSION_RLE4 = 2,
68 BMP_COMPRESSION_BITFIELDS = 3
71 # pragma pack (push,2) 151 template<
bool Coded4bits >
152 class rle_bitmap_output_buffer
158 void fill(
unsigned int n,
unsigned char pattern );
159 void copy(
unsigned int n, file_input_buffer& buffer );
162 void delta_move(
unsigned char x,
unsigned char y);
195 template<
typename OutputBuffer >
196 class rle_bitmap_decoder
197 :
public rle_decoder< char, file_input_buffer, OutputBuffer >
201 typedef OutputBuffer output_buffer_type;
204 virtual void read_mode( file_input_buffer& input,
205 output_buffer_type& output );
210 rle_bitmap_decoder< rle_bitmap_output_buffer<true> > rle4_decoder;
213 typedef rle_bitmap_decoder< rle_bitmap_output_buffer<false> >
219 class pixel1_to_pixel32
222 void operator()(
scanline& dest,
const char* src,
229 class pixel4_to_pixel32
232 void operator()(
scanline& dest,
const char* src,
239 class pixel8_to_pixel32
242 void operator()(
scanline& dest,
const char* src,
249 class pixel24_to_pixel32
252 void operator()(
scanline& dest,
const char* src,
260 void load( std::istream& f );
263 void load_palette(
const header& h, std::istream& f,
266 void load_1bpp(
const header& h, std::istream& f );
267 void load_4bpp(
const header& h, std::istream& f );
268 void load_8bpp(
const header& h, std::istream& f );
269 void load_24bpp(
const header& h, std::istream& f );
271 void load_4bpp_rle(
const header& h, std::istream& f,
273 void load_4bpp_rgb(
const header& h, std::istream& f,
275 void load_8bpp_rle(
const header& h, std::istream& f,
277 void load_8bpp_rgb(
const header& h, std::istream& f,
280 template<
typename Convert>
281 void load_rgb_data( std::istream& f,
unsigned int buffer_size,
283 const Convert& pixel_convert );
302 void save( std::ostream& f )
const;
305 void save_data( std::ostream& f )
const;
307 void pixel32_to_pixel24(
char* dest,
const scanline& src )
const;
309 void init_header(
header& h )
const;
313 const image& m_image;
318 bitmap(
unsigned int w,
unsigned int h );
320 bitmap( std::istream& f );
322 void save( std::ostream& f )
const;
328 #include <claw/impl/bitmap_reader.tpp> 330 #endif // __CLAW_BITMAP_HPP__
A class for bitmap images.
This class read data from a bitmap file and store it in an image.
This class write an image in a bitmap file.
A palette of color, for palettized images.
void fill(const math::rectangle< int > r, const pixel_type &c)
Fill an area of the image with a given color.
void load(std::istream &f)
Read the image from a stream.
A class to help decoding run-length encoded (RLE) streams.
void save(std::ostream &f) const
Save the bitmap in a file.
A palette of colors, for palettized images.
A class to help decoding run-length encoded (RLE) streams.
This class is made to help reading istreams with a buffer.
bitmap(unsigned int w, unsigned int h)
Constructor. Creates an empty image.
A class to deal with images.
This is the main namespace.
A class to deal with images.