ashstampede
Programmer
Hi I am trying to code a image transition using copyRECT with no success.
currently what is happening is a small junk of the old/current image is copied on to the new image and then just stays as the slide show continues.
here is so code i have attempting to wipe the image in from the left.
The backBuffer is the current picture and the copy is the new picture. they get the files from my main program.
img is the picture box from my form.
Help is really appreciated as i have little more than 3hrs to finish this.
currently what is happening is a small junk of the old/current image is copied on to the new image and then just stays as the slide show continues.
here is so code i have attempting to wipe the image in from the left.
Code:
//Wipe Image
void Wipe(TImage *imgDisplay,
Graphics::TBitmap *bmpNew,//copyBackBuffer
Graphics::TBitmap *bmpOld,//BackBuffer
int Direction=FROMLEFT,
int Resolution=20,
int FrameDelay=0);
//set the next image to wipe into the form over the
//top of the other picture
void C_Transition::Wipe(TImage *img,
Graphics::TBitmap *bmpNew,
Graphics::TBitmap *bmpOld,
int Direction,
int Resolution,
int FrameDelay)
{
//timing
int frame = 0;
//FrameDelay = bmpNew->Width / 100; //1/100th of the width
//SET up variables for slide transition
//integers for the new picture in COPYBackBuffer
int newStartX = 0;
int newStartY = 0;
int newEndX = 0;
int newEndY = 0;
int newCurrentX = 0;
int newCurrentY = 0;
//integers for the old picture in the OLD BackBuffer
int oldStartX = 0;
int oldStartY = 0;
int oldEndX = 0;
int oldEndY = 0;
int oldCurrentX = 0;
int oldCurrentY = 0;
//what side is the image loading from
if(Direction == FROMLEFT)
{
newStartX = -bmpNew->Width; //negative x
newEndX = newStartX + bmpNew->Width;
newCurrentX = newEndX; //current X moves with the resolution
//increments for the copy rect to get from start
//to current
oldEndX = bmpOld->Width;
oldStartX = oldEndX - bmpOld->Width;
oldCurrentX = oldStartX;
//moving from the left side of the screen
//start the new image the width of the image box
//increment newStartX to coordinates 0,0
//loop counter
int i = 0;
while(i > newStartX)
{
//FRAME DELAY LOOP
while(frame != FrameDelay)
{
frame++;
}
frame = 0;
//increment
newCurrentX -= Resolution;
oldCurrentX += Resolution;
//x,y,right,bottom
//start at the end of the rect and move <-----
img->Canvas->CopyRect(Rect(newCurrentX,newCurrentY,newEndX,newEndY),img->Canvas,
Rect(oldStartX,oldStartY,oldCurrentX,oldCurrentY));
//start at 0,0 and overright ---->
i-= Resolution;
//<-----decrement
}
}//END DIRECTION LEFT
}
The backBuffer is the current picture and the copy is the new picture. they get the files from my main program.
img is the picture box from my form.
Help is really appreciated as i have little more than 3hrs to finish this.