Original Post
🔒 Locked
bitmap padded data help????
Advertisement
I do something like this.
Its something along those lines (cant remember it exactly). You basically have to read in a line of data into a buffer that has room for the padding (with the padding bits set to 0).
Im not really explaining this very well am i?
Tell you what post your bitmap loading code, or send it to Ezekiel0000000@aol.com and ill have a look at it and figure it out.
|
Its something along those lines (cant remember it exactly). You basically have to read in a line of data into a buffer that has room for the padding (with the padding bits set to 0).
Im not really explaining this very well am i?
Tell you what post your bitmap loading code, or send it to Ezekiel0000000@aol.com and ill have a look at it and figure it out.
here it is it''s not the best but it works 
here''s the stuct i use to hold varibles
struct
{
LPDIRECTDRAW7 lpdd;
LPDIRECTDRAWSURFACE7 primary;
LPDIRECTDRAWSURFACE7 back;
LPDIRECTDRAWCLIPPER clip;
HWND hwnd;
}gdx;
and i use this to convert from 24bit to 16bit color
#define _24to16bit( r, g, b) (((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3))
all the other code is pretty simple
here''s the stuct i use to hold varibles
struct
{
LPDIRECTDRAW7 lpdd;
LPDIRECTDRAWSURFACE7 primary;
LPDIRECTDRAWSURFACE7 back;
LPDIRECTDRAWCLIPPER clip;
HWND hwnd;
}gdx;
and i use this to convert from 24bit to 16bit color
#define _24to16bit( r, g, b) (((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3))
all the other code is pretty simple
|
if you read the docs about bmps, (msdn, wotsit.org, anywhere they explain the bmp file format) you would know that each scanline of a bmp must be padded to a DWORD (32 bits). a simple macro that gives you the width DWORD aligned
#define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)
usage WIDTHBYTES(widthOfBitmap*colorDepthInBits)
24bit colordepth width of 320.
WIDTHBYTES(320*24);
you then use that value as your stride instead of width*numberOfBytesPerPixel like you normally do.
#define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)
usage WIDTHBYTES(widthOfBitmap*colorDepthInBits)
24bit colordepth width of 320.
WIDTHBYTES(320*24);
you then use that value as your stride instead of width*numberOfBytesPerPixel like you normally do.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement