1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| void TDiaporama::transition (AnsiString ndf)
{
int tr , cx, cy, x,y ;
//determine le centre de l'image
// plus efficasse si width et height sont impair
cx = LaPhoto->Width / 2 + 1 ;
cy = LaPhoto->Height / 2 + 1;
TJPEGImage *LImageJPEG ;
LImageJPEG = new TJPEGImage ;
LImageJPEG->LoadFromFile(ndf) ;
Graphics::TBitmap *source = new Graphics::TBitmap();
source->Width = LaPhoto->Width ;
source->Height = LaPhoto->Height ;
source->Canvas->StretchDraw(source->Canvas->ClipRect,LImageJPEG) ;
LaPhoto->Canvas->Pixels[cx][cy] = source->Canvas->Pixels[cx][cy] ;
for( tr = 1 ; tr < cx ; tr ++)
{
Sleep(5) ;
x = cx -tr ; //fixe x gauche du cente
for( y = cy + tr - 1 ; y >= cy - tr ; y --)
//colorie le cotes gauche
LaPhoto->Canvas->Pixels[x][y] = source->Canvas->Pixels[x][y] ;
y = cy - tr ;//fixe y au dessus du centre
for( x = cx -tr + 1 ; x <= cx + tr ; x++)
//colorie le haut
LaPhoto->Canvas->Pixels[x][y] = source->Canvas->Pixels[x][y] ;
x = cx + tr ;//fixe x apres le centre
for( y = cy - tr + 1 ; y <= cy + tr ; y ++ )
//colorie le cotes droit
LaPhoto->Canvas->Pixels[x][y] = source->Canvas->Pixels[x][y] ;
y = cy + tr ;//fixe y sous le centre
for( x = cx + tr - 1 ; x >= cx - tr ; x-- )
//colorie le bas
LaPhoto->Canvas->Pixels[x][y] = source->Canvas->Pixels[x][y] ;
//affiche l'image
LaPhoto->Refresh() ;
}
delete LImageJPEG ;
delete source ;
} |
Partager