Re: BMP



On 2008-08-29, vicky <vikrant.pandey@xxxxxxxxx> wrote:

I've a code in which the structure of Bitmap is given as ----


typedef struct
{
U8 uFlags; // combination of flags above
U8 uBitsPix; // 1, 2, 4, 8, 16, or 24
U16 wWidth; // in pixels
U16 wHeight; // in pixels
U16 dTransColor; // transparent color for > 8bpp
bitmaps
U8 *pStart; // bitmap data pointer

}GfxBitmap;

an example for this structure is...

GfxBitmap gbHighlightOptionBitmap = { 0x11, 8, 250, 38, 0x00000000,
(UCHAR *) ucHighlightOptionBitmap };

now my query is that if this is a complete header for bmp file then
what about the header for window which is above 50 bytes

That's definitely not a bmp header. That's apparently just a structure
used by the author of the code you were given, used to hold information
about a bitmap after it's loaded.

Going through some *really* old code of mine that used to load 8bpp bmp
files under dos once upon a time, it seems that the bitmap header is
more like the following:

sz | content
2 | identifier (BM)
4 | filesize
4 | reserved/unknown
4 | data offset (offset to the first scanline probably)
4 | header size
4 | image width
4 | image height
8 | ?
4 | data size
.... then there's like 16 more bytes before the palette which is probably
optional.

So anyway the above was just to get an idea, if you need to write a bmp
loader there are probably a lot of references for the file format
around. However I'd suggest you reconsider. If you need a simple
uncompressed 24bit fileformat, take a look at ppm (portable pixmap).

--
John Tsiombikas (Nuclear / Mindlapse)
http://nuclear.sdf-eu.org/
.



Relevant Pages

  • Re: BMP
    ... That's definitely not a bmp header. ... about a bitmap after it's loaded. ...  4 | data offset ...
    (comp.graphics.algorithms)
  • Re: BMP pixel array
    ... Is this a .BMP file or a Bitmap data array? ... is it using some kind of compression such as RLE or Bit-fields or is the data uncompressed? ... > files with an Info Header of 40 byte. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Storing/Saving a BMP in ASM
    ... To save a BMP in any language, assuming you have access to the pixel's ... values on screen (you can read the bitmap from screen), ... Info on how to store the lines and what the header should ...
    (comp.lang.asm.x86)
  • Re: copy image to windows clipboard?
    ... Your assumption about lacks in the Img BMP parser are correct. ... I've implemented the missing 16 and 32 bit format parser ... the offset to the bitmap was the offset to the bitmap header. ...
    (comp.lang.tcl)
  • Re: bitmap
    ... > bytes(the bitmap header and everything that is in a bmp ... Bitmap headers from the data stream to get the offset to the data and format of colour values used by the file. ... You can now grab a pixel from the data stream by working out it's offset from the start of the data, however in most cases the DIB ...
    (microsoft.public.vb.winapi.graphics)