++ed by:
GRANTM ANTIPASTA MARKELLIS GARU NEYASOV

32 PAUSE user(s)
17 non-PAUSE user(s).

Tony Cook

NAME

bmp.c - read and write windows BMP files

SYNOPSIS

  i_img *im;
  io_glue *ig;

  if (!i_writebmp_wiol(im, ig)) {
    ... error ...
  }
  im = i_readbmp(ig);

DESCRIPTION

Reads and writes Windows BMP files.

i_writebmp_wiol(im, io_glue)

Writes the image as a BMP file. Uses 1-bit, 4-bit, 8-bit or 24-bit formats depending on the image.

Never compresses the image.

i_readbmp_wiol(ig)

Reads a Windows format bitmap from the given file.

Handles BI_RLE4 and BI_RLE8 compressed images. Attempts to handle BI_BITFIELDS images too, but I need a test image.

IMPLEMENTATION FUNCTIONS

Internal functions used in the implementation.

read_packed(ig, format, ...)

Reads from the specified "file" the specified sizes. The format codes match those used by perl's pack() function, though only a few are implemented. In all cases the vararg arguement is an int *.

Returns non-zero if all of the arguments were read.

write_packed(ig, format, ...)

Writes packed data to the specified io_glue.

Returns non-zero on success.

write_bmphead(ig, im, bit_count, data_size)

Writes a Windows BMP header to the file.

Returns non-zero on success.

write_1bit_data(ig, im)

Writes the image data as a 1-bit/pixel image.

Returns non-zero on success.

write_4bit_data(ig, im)

Writes the image data as a 4-bit/pixel image.

Returns non-zero on success.

write_8bit_data(ig, im)

Writes the image data as a 8-bit/pixel image.

Returns non-zero on success.

write_24bit_data(ig, im)

Writes the image data as a 24-bit/pixel image.

Returns non-zero on success.

read_bmp_pal(ig, im, count)

Reads count palette entries from the file and add them to the image.

Returns non-zero on success.

read_1bit_bmp(ig, xsize, ysize, clr_used, compression, offbits)

Reads in the palette and image data for a 1-bit/pixel image.

Returns the image or NULL.

read_4bit_bmp(ig, xsize, ysize, clr_used, compression)

Reads in the palette and image data for a 4-bit/pixel image.

Returns the image or NULL.

Hopefully this will be combined with the following function at some point.

read_8bit_bmp(ig, xsize, ysize, clr_used, compression, allow_incomplete)

Reads in the palette and image data for a 8-bit/pixel image.

Returns the image or NULL.

read_direct_bmp(ig, xsize, ysize, bit_count, clr_used, compression, allow_incomplete)

Skips the palette and reads in the image data for a direct colour image.

Returns the image or NULL.

SEE ALSO

Imager(3)

AUTHOR

Tony Cook <tony@develop-help.com>

RESTRICTIONS

Cannot save as compressed BMP.

BUGS

Doesn't handle OS/2 bitmaps.

16-bit/pixel images haven't been tested. (I need an image).

BI_BITFIELDS compression hasn't been tested (I need an image).

The header handling for paletted images needs to be refactored

1 POD Error

The following errors were encountered while parsing the POD:

Around line 1492:

You forgot a '=back' before '=head1'