|
-
December 5th, 2011, 01:10 PM
#1
My DIBs are 2 Bytes Short
Hi guys,
I noticed that my DIBs, both saved and copied to the clipboard, are 2 bytes short.
Code:
DWORD dwSize=sizeof(BITMAPINFO)+height*span;
HGLOBAL hGlobal=GlobalAlloc(GMEM_MOVEABLE,dwSize);
LPBYTE mem=(LPBYTE)GlobalLock(hGlobal);
...
// fill in BITMAPINFO
BITMAPINFO* bmi=(BITMAPINFO*)mem;
...
// copy bits
LPBYTE bits=mem+sizeof(BITMAPINFO)+2;
// if I don't add the +2 the colors are shifted
...
Where are those 2 bytes coming from ?
My filesize is always 2 bytes smaller than the same bitmap saved in Photoshop, and if I copy to clipboard the colors are shifted by two bytes (red is blue, green is red, blue is green.)
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|