Board index » cppbuilder » fading from picture to picture

fading from picture to picture


2006-01-08 04:48:37 PM
cppbuilder12
I ll try to fade from one picture to the other picture,
with a Graphics::TBitmap *memBMP1; it goes nice and fast
but if I use the Image1->Picture->Bitmap from the gui it is very slow,
can anybody give me a better solution so that
I can still use the Image from the gui because I want to use the StretchDraw
but still can have a fast fading picture so I can fade from one picture to
an other.
regards Jacob Baartse
using some code like:
Graphics::TBitmap *memBMP1;
Graphics::TBitmap *memBMP2;
Byte *ptrOld ;
Byte *ptrNew;
int x, y;
for (y = 0; y < memBMP1->Height; y++)
{
ptrOld = (Byte *)memBMP1->ScanLine[y];
ptrNew = (Byte *)memBMP2->ScanLine[y];
for (x = 0; x < memBMP1->Width *3; x++)
ptrNew[x] = (byte)((ptrOld[x] + ptrNew[x])/2);
}
if I apply this code to it goes nice and fast
but if i apply this type of code to
two images that are in the gui it takes ages.
TImage *Image1;
TImage *Image2;
Byte *ptrOld ;
Byte *ptrNew;
int x, y;
for (y = 0; y < memBMP1->Height; y++)
{
ptrOld = (Byte *)Image1->Picture->Bitmap->ScanLine[y];
ptrNew = (Byte *)Image1->Picture->Bitmap->ScanLine[y];
for (x = 0; x < memBMP1->Width *3; x++)
ptrNew[x] = (byte)((ptrOld[x] + ptrNew[x])/2);
}
 
 

Re:fading from picture to picture

Quote
I ll try to fade from one picture to the other picture,
with a Graphics::TBitmap *memBMP1; it goes nice and fast
but if I use the Image1->Picture->Bitmap from the gui it is
very slow,
I think it's absolutely normal. You should do in-memory
processing of the image and draw it on the GUI at each step (or
when needed). Have a look at the following, it's Delphi code,
but easy to move to BCB:
www.efg2.com/Lab/ImageProcessing/Tween.htm
HTH,
Steve.