The 'nColors' may be not right if 'bi.biBitCount == 32': ------------------------------------------------------- int nColors = (1 << bi.biBitCount); if( nColors > 256 ) nColors = 0; ------------------------------------------------------- If 'bi.biBitCount == 32', the 'nColors' is '1' again. But the 'nColors' should be '0'. It should be: 'if( nColors > 256 )' => 'if( bi.biBitCount > 8 )', isn't it?
The 'nColors' may be not right if 'bi.biBitCount == 32': ------------------------------------------------------- int nColors = (1 << bi.biBitCount); if( nColors > 256 ) nColors = 0; ------------------------------------------------------- If 'bi.biBitCount == 32', the 'nColors' is '1' again. But the 'nColors' should be '0'. It should be: 'if( bi.biBitCount > 8 )' instead of 'if( nColors > 256 )', isn't it?Reply
After you reallocate the buffer to GMEM_MOVEABLE you cast it as if it is a fixed block of memory. After you reallocate it as moveable you should lock/unlock the memory to get a raw pointer. -Mike Luongo luongomi@ (big ten college "msu.edu") From msdn: If GlobalReAlloc reallocates a movable object, the return value is a handle to the memory object. To convert the handle to a pointer, use the GlobalLock function.
ReplyI have a Bitmap handle and I need access to the RGB data, I have the bitmap handle (HBITMAP) but I cannot work out how to get the pointer to the RGB data. I would normally use GetDIBits but it looks like its unsupported. I have to capture the screen od pocket pc.. Pls give me any ideas?Reply
Hi,this can scan a bitmap from bottom to top, and writes it out, but how to make it scan from top to bottom? I try to do as this :bi.biHeight = -bm.bmHeight; but failed, so can you help me ?Reply
Originally posted by: saifi
sir
plz send me the code forto access a BMP file through C program
Originally posted by: Jayam
Sir,
I have completed haar transform as the first step in the wavelet compression of gray level images. Will you please guide me what is the next step?
i would like to add haar transform to my project . would you send me haar transformation source code?Reply
Originally posted by: Pete
this area is very interesting, I am
Cheers Pete.
Hello everyone,
looking to save an image drawn in a vb.net for CE
application as a DIB so that it can be copied over to the
PC. Idealy i would like to save it to the SQL CE database.
Does anyone out there know how to do this. I can use C# to
create a dll if I have to.
Originally posted by: Sunil
I am trying to call GetDIBits from my C# code and it simply returns me a 0, GetLastError() also returns a 0 i dont understand what is the problem. as of now i am trying to write a wrapper fr it in VC++ but the native API should resolve.
Help me if you have done this....using C# is imortant and the operatin has t be time cretical as i am using it for a screen capture software i am writing..
regards Sunil
ReplyOriginally posted by: Trond78
Hi i got a 16 bit grayscale DDB i want to make a DIB. I set the folowing parameters:
bi.biPlanes = 1;
bi.biBitCount = 16;
What must hPal be??
Reply
Originally posted by: Tom Hanks
Great looking function DDBToDIB, thanks to Zafir for providing it. But for me (and several of others) it is not working due a NULL return from GetDIBits().
Actually GetDIBits does work if I am using a monchrome bitmap. Not good enough for me - but maybe a clue to someone knowledgable?
bmp.CreateBitmap(w, h, 1, 8, NULL); // DDBToDIB fails in GetDIBits on 8 bit bmp
bmp.CreateBitmap(w, h, 1, 24, NULL); // DDBToDIB fails in GetDIBits on 24 bit bmp
bmp.CreateBitmap(w, h, 1, 1, NULL); // DDBToDIB *doesn't* fail in GetDIBits on 1 bit bmp
My environment is XP and VC++6 (SP3)