module Bmp:sig
..end
val check_header : bytes -> Images.header
val load : bytes -> Images.load_option list -> Images.t
val save : bytes -> Images.save_option list -> Images.t -> unit
type
bmp = {
|
bmpFileHeader : |
(* |
Bytes <0 14<
| *) |
|
bmpInfoHeader : |
(* |
Bytes <14 54<
| *) |
|
bmpRgbQuad : |
(* |
Bytes <54 ...
| *) |
|
bmpBytes : |
(* |
Bytes <bfOffBits ...
| *) |
Structure of bitmaps files on disk :
type
bitmapfileheader = {
|
bfType : |
(* |
Bytes <0 2<
| *) |
|
bfSize : |
(* |
Bytes <2 6<
| *) |
|
bfReserved1 : |
(* |
Bytes <6 8<
| *) |
|
bfReserved2 : |
(* |
Bytes <8 10<
| *) |
|
bfOffBits : |
(* |
Bytes <10 14<
| *) |
type
bitmapinfoheader = {
|
biSize : |
(* |
Bytes <14 18<
| *) |
|
biWidth : |
(* |
Bytes <18 22<
| *) |
|
biHeight : |
(* |
Bytes <22 26<
| *) |
|
biPlanes : |
(* |
Bytes <26 28<
| *) |
|
biBitCount : |
(* |
Bytes <28 30<
| *) |
|
biCompression : |
(* |
Bytes <30 34<
| *) |
|
biSizeImage : |
(* |
Bytes <34 38<
| *) |
|
biXPelsPerMeter : |
(* |
Bytes <38 42<
| *) |
|
biYPelsPerMeter : |
(* |
Bytes <42 46<
| *) |
|
biClrUsed : |
(* |
Bytes <46 50<
| *) |
|
biClrImportant : |
(* |
Bytes <50 54<
| *) |
type
bicompression =
| |
BI_RGB |
(* |
Specifies that the bitmap is not compressed.
| *) |
| |
BI_RLE8 |
(* |
Specifies a run-length encoded format for bitmaps with 8 bits
per pixel. The compression format is a two-bytes format
consisting of a count byte followed by a byte containing a color
index.
| *) |
| |
BI_RLE4 |
(* |
Specifies a run-length encoded format for bitmaps with 4 bits
per pixel. The compression format is a two-byte format consisting of
a count byte followed by two word-length color indexes.
| *) |
type
bibitcount =
| |
Monochrome |
(* |
1 The bitmap is monochrome, and the bmiColors field must
contain two entries. Each bit in the bitmap array represents a
pixel. If the bit is clear, the pixel is displayed with the
color of the first entry in the bmiColors table; if the bit is
set, the pixel has the color of the second entry in the
table.
| *) |
| |
Color16 |
(* |
4 The bitmap has a maximum of 16 colors, and the bmiColors
field contains up to 16 entries. Each pixel in the bitmap is
represented by a four-bit index into the color table.
For example, if the first byte in the bitmap is 0x1F, then the
byte represents two pixels. The first pixel contains the color
in the second table entry, and the second pixel contains the
color in the 16th table entry.
| *) |
| |
Color256 |
(* |
8 The bitmap has a maximum of 256 colors, and the bmiColors
field contains up to 256 entries. In this case, each byte in the
array represents a single pixel.
| *) |
| |
ColorRGB |
(* |
24 The bitmap has a maximum of 2^24 colors. The bmiColors
field is NULL, and each three bytes in the bitmap array
represents the relative intensities of red, green, and blue,
respectively, of a pixel.
| *) |
| |
ColorRGBA |
(* |
32 The bitmap
| *) |
val load_bmp : bytes -> bmp
val save_bmp : bytes -> bmp -> unit