30 #ifndef __CLAW_BITMAP_HPP__ 31 #define __CLAW_BITMAP_HPP__ 67 BMP_COMPRESSION_RGB = 0,
68 BMP_COMPRESSION_RLE8 = 1,
69 BMP_COMPRESSION_RLE4 = 2,
70 BMP_COMPRESSION_BITFIELDS = 3
152 template <
bool Coded4bits>
153 class rle_bitmap_output_buffer
159 void fill(
unsigned int n,
unsigned char pattern);
163 void delta_move(
unsigned char x,
unsigned char y);
196 template <
typename OutputBuffer>
197 class rle_bitmap_decoder
198 :
public rle_decoder<char, file_input_buffer, OutputBuffer>
202 typedef OutputBuffer output_buffer_type;
206 output_buffer_type& output);
210 typedef rle_bitmap_decoder<rle_bitmap_output_buffer<true> >
214 typedef rle_bitmap_decoder<rle_bitmap_output_buffer<false> >
220 class pixel1_to_pixel32
223 void operator()(
scanline& dest,
const char* src,
230 class pixel4_to_pixel32
233 void operator()(
scanline& dest,
const char* src,
240 class pixel8_to_pixel32
243 void operator()(
scanline& dest,
const char* src,
250 class pixel24_to_pixel32
253 void operator()(
scanline& dest,
const char* src,
261 void load(std::istream& f);
264 void load_palette(
const header& h, std::istream& f,
267 void load_1bpp(
const header& h, std::istream& f);
268 void load_4bpp(
const header& h, std::istream& f);
269 void load_8bpp(
const header& h, std::istream& f);
270 void load_24bpp(
const header& h, std::istream& f);
272 void load_4bpp_rle(
const header& h, std::istream& f,
274 void load_4bpp_rgb(
const header& h, std::istream& f,
276 void load_8bpp_rle(
const header& h, std::istream& f,
278 void load_8bpp_rgb(
const header& h, std::istream& f,
281 template <
typename Convert>
282 void load_rgb_data(std::istream& f,
unsigned int buffer_size,
284 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);
322 void save(std::ostream& f)
const;
328 #include <claw/graphic/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.
reader(image &img)
Constructor.
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 save(std::ostream &f) const
Save the bitmap in a file.
A class to help decoding run-length encoded (RLE) streams.
void save(std::ostream &f) const
Save the bitmap in a file.
void load(std::istream &f)
Load the image data from a stream.
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.
writer(const image &img)
Constructor.
A class to deal with images.
This is the main namespace.
A class to deal with images.