Skip to main content
gamedev.net
🔒 Locked

Using custom bitmap structure

Started by p4n1c 0 replies 300+ views
Original Post
p4n1c
p4n1c
Hi all, I''m using a custom bitmap structure to load in my PCX files for a library I''m working on. The idea is to keep the library as portable as possible. Here is the code for the structure:
struct oeBMP {
	int	width;
	int	height;
	unsigned short	bpp; // Bits per pixel

	void	*image;	// Pointer to image data
	oepalette_s palette[256];	// Palette for 8-bit images
};
 
Now my question is, how would I take my custom structure and say load it into the windows BITMAP structure for display? I tried using CreateBitmap(width, height, planes, bpp, image). But it won''t display anything. I know it is loading at least the header properly from the PCX, as it returns the proper dimensions, bits per pixel, etc. Anyone have experience with this they can share? Thanks ----- For I have seen the face of evil and it will not soon be forgotten.
-----For I have seen the face of evil and it will not soon be forgotten.
niyaw
niyaw
try CreateDIBSection. fill out the header using your width/height/format, copy your palette to bitmapinfo struct, create the bitmap, then copy your image data over to bitmap''s bits.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.