Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Oct : CreateDIBSection and BitBlt problem...
| Subject: | CreateDIBSection and BitBlt problem... |
| Posted by: | "chrisj" (a@b.c) |
| Date: | Wed, 4 Oct 2006 00:41:58 |
Hi, i have a custom canvas that draws into 32 bit pixel buffer. Curently
i've been creating the pixel buffer using GetMem, and bliting using
SetDIBitsToDevice. However that seems to be very slow, it takes 2x as long
to do the SetDIBitsToDevice as it does for all my drawing code. So i read
around a bit and i decided to try using CreateDIBSection and BitBlt, but i
am having trouble getting it to work. Here's what i do curently...
CreateCanvas.........
ftmpdc := GetDC(0);
fhandle := CreateDIBSection(ftmpdc,fheader,DIB_RGB_COLORS,fpixels,0,0);
which works ok, fhandle is non zero, and writing to the pixel buffer doesn't
cause any AVs.
Paint to HDC........
err = Bitblt(dc,x,y,fwidth,fheight,fhandle,0,0,SRCCOPY));
if (err = false) then logWindowsErr();
which gives me the following error message...
"Not enough storage is available to process this command."
Im not sure if i should be selecting the bitmap into a device context
somewhere?
Also i'd like to ask Microsoft why i need to have a device context if i am
creating a device independant bitmap?
many thanks,
chris