bitmap_t

Declaration

struct bitmap_t {
int width;
int height;
int bitsPerPixel;
int bytesPerLine;
void *surface;
palette_t *pal;
pixel_format_t *pf;
}

Prototype In

mgraph.h

Description

Structure representing a loaded lightweight bitmap image. This is the structure of Windows .BMP files after they have been loaded from disk with the MGL_loadBitmap function. Lightweight bitmaps have very little memory overhead once loaded from disk, since the entire bitmap information is storeds in a single contiguous block of memory (although this is not necessary; see below). However the only thing you can do with a lightweight bitmap is display it to any MGL device context, using either stretching or transparency (MGL_putBitmap, MGL_stretchBitmap, MGL_putSrcBitmapTransparent). If you need to be able to draw on the bitmap surface, then you should load the bitmap into an MGL memory device context where you can call any of the standard MGL drawing functions and BitBlt operations on the bitmap. The only disadvantage of doing this is that a memory device context has a lot more memory overhead involved in maintaining the device context information.

You can build you own lightweight bitmap loading routines by creating the proper header information and loading the bitmap information into this structure. Note that although the MGL loads the bitmap files from disk with the bitmap surface, pixel format information and palette information all loaded into a single memory block, this is not necessary. If you wish you can create your own lightweight bitmaps with the bitmap surface allocated in a separate memory block and then use this bitmap header to blast information from this memory block to a device context as fast as possible.

Members

width | Width of the bitmap in pixels
height | Height of the bitmap in pixels
bitsPerPixel | Pixel depth of the bitmap
bytesPerLine | Scanline width for the bitmap. The scanline width must always be aligned to a DWORD boundary, so the minimum scanline width is 4 bytes.
surface | Pointer to the bitmap surface.
pal | Pointer to the bitmap palette. If this field is NULL, the bitmap does not have an associated palette.
pf | Pointer to the bitmap pixel format info. This field will be NULL for all bitmaps with 8 or less bits per pixel, but will always be properly filled in for bitmaps with 15 or more bits per pixel.

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com