Board index » cppbuilder » BitBlt problems.

BitBlt problems.


2008-08-06 03:44:43 PM
cppbuilder103
Hi.
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
 
 

Re:BitBlt problems.

After posting I realised that I wasn't giving a lot of info. The thing is,
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
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" < XXXX@XXXXX.COM >wrote in message
Quote
Hi.

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

 

Re:BitBlt problems.

Oh, and the BitBlt is not returning an error code. I checked :(
David
"dvd8n" < XXXX@XXXXX.COM >wrote in message
Quote
After posting I realised that I wasn't giving a lot of info. The thing
is, 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
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" < XXXX@XXXXX.COM >wrote in message
news:KDcmk.410836$ XXXX@XXXXX.COM ...
>Hi.
>
>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
>


 

{smallsort}