Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program ImageVideoSeries;
- (*
- Views an image series at specified FPS.
- Pauses with space.
- When paused you can rewind or skip forward using arrow-keys.
- *)
- const
- DISK_LOCATION = 'C:\Simba\Images\';
- PAUSE_BUTTON = VK_SPACE;
- REWIND_FRAME = VK_LEFT;
- FORWARD_FRAME = VK_RIGHT;
- FPS = 5;
- var
- bmp: TMufasaBitmap;
- i: Int32;
- frames: TStringArray;
- procedure ShowFrame(i: Int32);
- begin
- bmp.Init();
- bmp.LoadFromFile(DISK_LOCATION+frames[i]);
- ShowBitmap(bmp);
- bmp.Free();
- end;
- procedure HandleAll();
- var
- t: Double;
- isPaused: Boolean;
- begin
- t := GetTimeRunning() + 1000 div FPS;
- while GetTimeRunning() < t do
- begin
- isPaused := isKeyDown(PAUSE_BUTTON);
- while isKeyDown(PAUSE_BUTTON) do Sleep(1);
- if isPaused then
- begin
- while not isKeyDown(PAUSE_BUTTON) do
- begin
- //check for rewinding
- if isKeyDown(REWIND_FRAME) then
- begin
- WriteLn('<< [frame='+ToStr(i-1)+']');
- while isKeyDown(REWIND_FRAME) do Sleep(1);
- i := Max(0,i-1);
- ShowFrame(i);
- end;
- if isKeyDown(FORWARD_FRAME) then
- begin
- WriteLn('>> [frame='+ToStr(i+1)+']');
- while isKeyDown(FORWARD_FRAME) do Sleep(1);
- i := Min(i+1, High(frames));
- ShowFrame(i);
- end;
- Sleep(1);
- end;
- while isKeyDown(PAUSE_BUTTON) do Sleep(1);
- end;
- Sleep(1);
- end;
- end;
- begin
- frames := GetFiles(DISK_LOCATION,'png');
- for i:=0 to High(frames) do
- begin
- ShowFrame(i);
- HandleAll();
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement