/* copy the relevant portion of the image */
BitBlt (ImageDisplayDoubleBuffer->Canvas->Handle,
Image [ImageNo].AtX, Image [ImageNo].AtY,
Image [ImageNo].ExtentX, Image [ImageNo].ExtentY,
Image [ImageNo].Bitmap->Canvas->Handle,
Image [ImageNo].FromX, Image [ImageNo].FromY, SRCCOPY);
ImageDisplayDoubleBuffer and Image [ImageNo].Bitmap are both TBitmaps.
It is copying a portion of a processed bitmap from an array into a double
buffer
for eventual copying to the screen on receipt of a Paint message.
Image [ImageNo].Bitmap is ok as I tried dumping it to a file. After the
BitBlt ImageDisplayDoubleBuffer is just white (I dumped that to a file too).
There are no errors returned from BitBlt.
The program is MASSIVE. I can't really post it all. However, here are a
few extracts:
======================================
Set up of ImageDisplayDoubleBuffer:
:
:
ImageDisplayDoubleBuffer = new Graphics::TBitmap;
ImageDisplayDoubleBuffer->Width = 0;
ImageDisplayDoubleBuffer->Height = 0;
ImageDisplayDoubleBuffer->PixelFormat = pf24bit;
:
:
check size of ImageDisplayDoubleBuffer - should be same as screen:
:
:
if ((ImageDisplayDoubleBuffer->Height != DisplayHeight ())
|| (ImageDisplayDoubleBuffer->Width != DisplayWidth ()))
{
ImageDisplayDoubleBuffer->Height = 0;
ImageDisplayDoubleBuffer->Width = DisplayWidth ();
ImageDisplayDoubleBuffer->Height = DisplayHeight ();
}
:
:
That is all of the manipulation of ImageDisplayDoubleBuffer apart from the
eventual BitBlt of it onto the screen (which, bizarrely does work - I know
as I
tested it by drawing some sqares on ImageDisplayDoubleBuffer's canvas in
code - they appear on the screen just fine):
:
:
/* blat the buffered image onto the screen */
BitBlt (ImageDisplay->Canvas->Handle, 0, 0, DisplayWidth (), DisplayHeight
(),
ImageDisplayDoubleBuffer->Canvas->Handle,
0, 0, SRCCOPY);
:
:
==========================================================
The setting up of Image [ImageNo].Bitmap is inside a class based on TBitmap:
:
:
class TPageBMP : public Graphics::TBitmap
{
:
:
The bitmap itself is loaded from a stream:
:
:
/* call base class assignment */
Graphics::TBitmap::LoadFromStream (Stream);
:
:
And given a little processing:
:
:
/* magic calls to free up gdi resources and memory */
Dormant();
FreeImage();
/* force bitmap to be 24 bit - one byte per colour - this will convert */
if (PixelFormat != pf24bit)
PixelFormat = pf24bit;
:
:
And that's it really apart from a massive amount of image manipulation
that's all bypassed at the moment for the debugging of this problem.
And as I said, it seems to be ok just before the BitBlt as I did a
->SaveToFile("temp.bmp") to check it and it looks (as far as I can
see) perfect.
And like I said, this was all fine at Builder 5.
I'd be grateful for any advice.
David
> Is there something different about the way BitBlt works?
No. BitBlt() is a Win32 API function, not a Borland function. It doesn't
matter which version of BCB you are using. It is the same function.
> Image [ImageNo].Bitmap is ok as I tried dumping it to a file. After the
> BitBlt ImageDisplayDoubleBuffer is just white (I dumped that to a file
> too).
Is BitBlt() returning TRUE or FALSE? If FALSE, what is GetLastError()
returning?
Gambit