// Prepare
ImageTrackBar.Position := 0;
SourceImage.Bitmap.Assign(SecondImage2.Bitmap);
SourceImage.Update;
SecondImage2.IO.LoadFromFileAuto(DataDir[Ord(ETC) - $30]+ InttoStr(PicNum1)+'.png');
SecondImage2.lockPaint;
Inc(PicNum1);
if PicNum1 = 10 then PicNum1 := 0;
TargetImage.Bitmap.Assign(SecondImage2.Bitmap);
TargetImage.Update;
SecondImage2.UnlockPaint;
CurrentImage.Bitmap.Assign(SourceImage.Bitmap);
THeight := 103;
Twidth := 60;
if fCurrentViewLines <> nil then
freemem(fCurrentViewLines);
getmem(fCurrentViewLines, sizeof(pointer) * THeight);
for q := 0 to THeight - 1 do
begin
fCurrentViewLines[q] := CurrentImage.Bitmap.Scanline[q];
end;
//================
procedure TfmMain.ClockFlipeffect(Step:Integer);
var
W, H, Y: Integer;
begin
W := CurrentImage.Width;
H := CurrentImage.Height;
if (Step = 0) then
StretchBlt(CurrentImage.Bitmap.Canvas.Handle, 0, 0, W, H,
SourceImage.Bitmap.Canvas.Handle, 0, 0, W, H,
SRCCOPY);
if Step = 0 then
exit;
SetStretchBltMode(CurrentImage.bitmap.Canvas.Handle, HALFTONE);
CurrentImage.bitmap.Canvas.Pen.Color := clBlack;
CurrentImage.bitmap.Canvas.Pen.Width := 1;
CurrentImage.bitmap.Canvas.Pen.Style := psSolid;
StretchBlt(CurrentImage.bitmap.Canvas.Handle, 0, 0, W, H div 2,
TargetImage.Bitmap.Canvas.Handle, 0, 0, W, H div 2,
SRCCOPY);
if Step <= 512 then
begin
Y := MulDiv(H, Step, 1024);
if IEGlobalSettings().TransitionsDrawAlternative = False then
StretchBlt(CurrentImage.bitmap.Canvas.Handle, 0, H div 2, W ,H,
SourceImage.Bitmap.Canvas.Handle, 0, H div 2, W, H,
SRCCOPY);
StretchBlt(CurrentImage.bitmap.Canvas.Handle, 0, Y, W , H div 2 - Y,
SourceImage.Bitmap.Canvas.Handle, 0, 0, W, H div 2,
SRCCOPY);
if IEGlobalSettings().TransitionsDrawAlternative = False then
PageFlipDarkenEdges(Y, Step);
end
else
begin
Y := MulDiv(H, Step - 512, 512) div 2;
if IEGlobalSettings().TransitionsDrawAlternative = False then
StretchBlt(CurrentImage.bitmap.Canvas.Handle, 0, H div 2, W, H div 2,
SourceImage.Bitmap.Canvas.Handle, 0, h div 2, W, H Div 2,
SRCCOPY);
StretchBlt(CurrentImage.bitmap.Canvas.Handle, 0, H div 2, W, Y,
TargetImage.Bitmap.Canvas.Handle, 0, H Div 2, W, H div 2,
SRCCOPY);
if IEGlobalSettings().TransitionsDrawAlternative = False then
PageFlipDarkenEdges(H div 2 + Y, Step);
end;
CurrentImage.Update;
end;
procedure TfmMain.PageFlipDarkenEdges(iCurrentPosition, Step : Integer);
const
Initial_Darken_Level = 0.23;
Darkness_Reduction = 0.68;
var
iX, iY: integer;
ppx: pRGB;
rr, gg, bb: integer;
iFadeStep1 , iFadeStep2 : integer;
bDoDarken: Boolean;
begin
// Upper Flip
iFadeStep1 := Round(Step + Round(1024 * 0.9) / 5.0);
if iFadeStep1 > 1024 then iFadeStep1 := 1024;
// Down Flip
iFadeStep2 := Round(1024 - Step + Round(1024 * 0.9) / 5.0);
if iFadeStep2 > 1024 then iFadeStep2 := 1024;
for iY := 0 to THeight - 1 do
begin
ppx := fCurrentViewLines[iY];
for iX := 0 to TWidth - 1 do
begin
bDoDarken := iY > iCurrentPosition;
if bDoDarken then
begin
// Upper Flip
if iY < ((THeight-1) Div 2) then
begin
with ppx^ do
begin
r := (ppx^.r * (1024-iFadeStep1) ) shr 10;
g := (ppx^.g * (1024-iFadeStep1) ) shr 10;
b := (ppx^.b * (1024-iFadeStep1) ) shr 10;
end;
end
// Down Flip
else
begin
with ppx^ do
begin
r := (ppx^.r * iFadeStep2 ) shr 10;
g := (ppx^.g * iFadeStep2 ) shr 10;
b := (ppx^.b * iFadeStep2 ) shr 10;
end;
end;
inc(ppx);
end;
end;
end;
CurrentImage.bitmap.Canvas.MoveTo(0, iCurrentPosition);
CurrentImage.bitmap.Canvas.LineTo(TWidth, iCurrentPosition);
end;
I tried changing the page flip as Nigel said.
seems to be working fine
Please see the source to see if there is a better way.
Thanks to Nigel for the advice.