Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BitBlt problems in Builder 6

18 views
Skip to first unread message

David Ayton

unread,
Aug 7, 2008, 1:24:26 PM8/7/08
to
I'm migrating a program from Builder 5 to Builder 6 (don't ask). Is there
something different 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.

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


Remy Lebeau (TeamB)

unread,
Aug 7, 2008, 4:31:50 PM8/7/08
to

"David Ayton" <No...@Home.com> wrote in message
news:489b...@newsgroups.borland.com...

> 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


Phongphan

unread,
Feb 13, 2016, 10:47:02 PM2/13/16
to
Could you read detail on all BitBlt functions, what's usually the name of be saved file or asignning to new variable in the true same size.
Message has been deleted
Message has been deleted
0 new messages