// //------------------ DOK FILE -------------------------------------------------- +Header core.2d.bmp =pkg core.2d.bmp =title core.2d.bmp =short BMP files (*.bmp) =desc This package contains function to encode and decode the BMP file format (*.bmp files). - it encodes in 24bits and 32 bits BMP format - it decodes from 1, 8, 24, 32 bits BMP format - it runs in memory only: the encoding returns a binary string which is the content of a *.bmp file. The decoding starts from a string which is the content of a *.bmp file, not a file name. // // //------------------ PROTO ----------------------------------------------------- bitmapFromBmp +Proto bitmapFromBmp =type fun Str -> Bitmap =mode function =pkg core.2d.bmp =impl mcy =link =desc This function decodes a binary string with the BMP format and returns a [[Bitmap]], or nil when the input string has a wrong format. // +arg data =type Str =desc A binary string // +arg result =type Bitmap =desc A bitmap // // //------------------ PROTO ----------------------------------------------------- bmpFromBitmap +Proto bmpFromBitmap =type fun Bitmap Int -> Str =mode function =pkg core.2d.bmp =impl mcy =link =desc This function encodes a [[Bitmap]] into a string with the BMP format, 24 of 32 bits. // +arg bmp =type Bitmap =desc Any bitmap // +arg bpp =type Int =desc The bit depth: [[BMP_32]] or [[BMP_24]] // +arg result =type Str =desc A binary string // // //------------------ PROTO ----------------------------------------------------- BMP_32 +Proto BMP_32 =type Int =mode constant =pkg core.2d.bmp =impl mcy =link =desc A constant for the 32 bits BMP file format // // //------------------ PROTO ----------------------------------------------------- BMP_24 +Proto BMP_24 =type Int =mode constant =pkg core.2d.bmp =impl mcy =link =desc A constant for the 24 bits BMP file format