Class OutputModule

java.lang.Object
gaiasky.script.v2.impl.APIModule
gaiasky.script.v2.impl.OutputModule
All Implemented Interfaces:
OutputAPI

public class OutputModule extends APIModule implements OutputAPI
The output module contains methods and calls that relate to the frame output system, the screenshot system, and other types of output systems.

Screenshots and frames are saved to a pre-defined location. You can get the default locations with BaseModule.get_default_frame_output_dir() and BaseModule.get_default_screenshots_dir().

  • Constructor Details

    • OutputModule

      public OutputModule(EventManager em, APIv2 api, String name)
      Create a new module with the given attributes.
      Parameters:
      api - Reference to the API class.
      name - Name of the module.
  • Method Details

    • configure_screenshots

      public void configure_screenshots(int w, int h, String path, String prefix)
      Description copied from interface: OutputAPI
      Configures the screenshot system, setting the resolution of the images, the output directory and the image name prefix.
      Specified by:
      configure_screenshots in interface OutputAPI
      Parameters:
      w - Width of images.
      h - Height of images.
      path - The output directory path.
      prefix - The file name prefix.
    • get_current_screenshots_dir

      public String get_current_screenshots_dir()
      Description copied from interface: OutputAPI
      Get the current output directory for screenshots as a string. This comes from a setting stored in the configuration file. To get the default screenshots location, use BaseModule.get_default_screenshots_dir().
      Specified by:
      get_current_screenshots_dir in interface OutputAPI
      Returns:
      The absolute path to the current output directory for screenshots.
    • screenshot_mode

      public void screenshot_mode(String mode)
      Description copied from interface: OutputAPI
      Set the screenshot mode. Possible values are simple and advanced.

      The simple mode is faster and just outputs the last frame rendered to the Gaia Sky window, with the same resolution and containing the UI elements. The advanced mode redraws the last frame using the resolution configured using OutputAPI.configure_screenshots(int, int, String, String) and it does not draw the UI.

      Specified by:
      screenshot_mode in interface OutputAPI
      Parameters:
      mode - The screenshot mode. simple or advanced.
    • screenshot

      public void screenshot()
      Description copied from interface: OutputAPI
      Take a screenshot of the current frame and saves it to the configured location (see OutputAPI.configure_screenshots(int, int, String, String)).
      Specified by:
      screenshot in interface OutputAPI
    • configure_frame_output

      public void configure_frame_output(int w, int h, int fps, String path, String prefix)
      Description copied from interface: OutputAPI
      Configure the frame output system, setting the resolution of the images, the target frames per second, the output directory and the image name prefix. This function sets the frame output mode to 'advanced'.
      Specified by:
      configure_frame_output in interface OutputAPI
      Parameters:
      w - Width of images.
      h - Height of images.
      fps - Target frames per second (number of images per second).
      path - The output directory path.
      prefix - The file name prefix.
    • get_current_frame_output_dir

      public String get_current_frame_output_dir()
      Description copied from interface: OutputAPI
      Get the current output directory for the frame output system as a string. This comes from a setting stored in the configuration file. To get the default frame output location, use BaseModule.get_default_frame_output_dir().
      Specified by:
      get_current_frame_output_dir in interface OutputAPI
      Returns:
      The absolute path to the current output directory for the frame output system.
    • configure_frame_output

      public void configure_frame_output(int w, int h, double fps, String path, String prefix)
      Description copied from interface: OutputAPI
      Configure the frame output system, setting the resolution of the images, the target frames per second, the output directory and the image name prefix. This function sets the frame output mode to 'advanced'.
      Specified by:
      configure_frame_output in interface OutputAPI
      Parameters:
      w - Width of images.
      h - Height of images.
      fps - Target frames per second (number of images per second).
      path - The output directory path.
      prefix - The file name prefix.
    • frame_output_mode

      public void frame_output_mode(String mode)
      Description copied from interface: OutputAPI
      Set the frame output mode. Possible values are simple and advanced.

      The simple mode is faster and just outputs the last frame rendered to the Gaia Sky window, with the same resolution and containing the UI elements. The advanced mode redraws the last frame using the resolution configured using OutputAPI.configure_frame_output(int, int, int, String, String) and it does not draw the UI.

      Specified by:
      frame_output_mode in interface OutputAPI
      Parameters:
      mode - The screenshot mode. simple or advanced.
    • frame_output

      public void frame_output(boolean active)
      Description copied from interface: OutputAPI
      Activate or deactivate the frame output system. If called with true, the system starts outputting images right away.
      Specified by:
      frame_output in interface OutputAPI
      Parameters:
      active - Whether to activate or deactivate the frame output system.
    • is_frame_output_active

      public boolean is_frame_output_active()
      Description copied from interface: OutputAPI
      Check whether the frame output system is currently on (i.e. frames are being saved to disk).
      Specified by:
      is_frame_output_active in interface OutputAPI
      Returns:
      True if the render output is active.
    • get_frame_output_fps

      public double get_frame_output_fps()
      Description copied from interface: OutputAPI
      Get the current frame rate setting of the frame output system.
      Specified by:
      get_frame_output_fps in interface OutputAPI
      Returns:
      The frame rate setting of the frame output system.
    • reset_frame_output_sequence_number

      public void reset_frame_output_sequence_number()
      Description copied from interface: OutputAPI
      Resets to zero the image sequence number used to generate the file names of the frame output images.
      Specified by:
      reset_frame_output_sequence_number in interface OutputAPI