Class FrameRecorder

java.lang.Object
org.openpatch.scratch.extensions.recorder.Recorder
org.openpatch.scratch.extensions.recorder.FrameRecorder

public class FrameRecorder extends Recorder
The FrameRecorder class extends the Recorder class to provide functionality for saving frames of an applet as PNG files. It allows saving the current frame with a generated filename based on the frame number or taking a snapshot with a specified filename.

Usage example:

 FrameRecorder recorder = new FrameRecorder("/path/to/output/folder");
 recorder.saveFrame(); // Saves the current frame with a generated filename
 recorder.snapshot("snapshot.png"); // Saves the current frame as "snapshot.png"
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    FrameRecorder(String outputFolder)
    Constructs a new FrameRecorder with the specified output folder.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Saves the current frame of the applet to the specified output folder.
    void
    snapshot(String filename)
    Takes a snapshot of the current frame and saves it to the specified filename.

    Methods inherited from class org.openpatch.scratch.extensions.recorder.Recorder

    post, start, stop

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FrameRecorder

      public FrameRecorder(String outputFolder)
      Constructs a new FrameRecorder with the specified output folder.
      Parameters:
      outputFolder - the folder where the recorded frames will be saved
  • Method Details

    • saveFrame

      public void saveFrame()
      Saves the current frame of the applet to the specified output folder. The frame is saved as a PNG file with a filename pattern "#######.png". The exact filename will be generated based on the current frame number.
      Specified by:
      saveFrame in class Recorder
    • snapshot

      public void snapshot(String filename)
      Takes a snapshot of the current frame and saves it to the specified filename.
      Parameters:
      filename - the name of the file to save the snapshot to