I'm migrating a program from Builder 5 to Builder 6 (don't ask). Is there
something figfferent about the way BitBlt works? This line of code works in
Builder 5 but does nothing in Builder 6.
/* 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.
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).
Like I say, it was fine in Builder 5.
Any advice appreciated.
Thanks, David
======================================
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
BitBlt of it onto the screen (which, bizarrely does work - I know as I drew
some sqares on ImageDisplayDoubleBuffer's canvas in code and they appear on
the screen 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. 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.
David
"dvd8n" <No...@Home.com> wrote in message
news:KDcmk.410836$I42.2...@fe04.news.easynews.com...
David
"dvd8n" <No...@Home.com> wrote in message
news:Fpemk.209397$bC5....@fe07.news.easynews.com...