Package org.jzy3d.io

Class AbstractImageExporter

java.lang.Object
org.jzy3d.io.AbstractImageExporter
All Implemented Interfaces:
AWTImageExporter
Direct Known Subclasses:
GifExporter

public abstract class AbstractImageExporter extends Object implements AWTImageExporter
The AbstractImageExporter can receive BufferedImage image from a renderer to export them somewhere. The exporter as a target frame rate. If it receive images at a higher rate, exceeding images will be dropped. If it receive images as a lower rate, it will repeat the last known image until the new one arrives. The exporter uses its own thread to handle export image queries without slowing down the caller thread.
Author:
Martin Pernollet
  • Field Details

    • previousImage

      protected BufferedImage previousImage
    • timer

      protected TicToc timer
    • numberSubmittedImages

      protected AtomicInteger numberSubmittedImages
    • numberOfPendingImages

      protected AtomicInteger numberOfPendingImages
    • numberOfSkippedImages

      protected AtomicInteger numberOfSkippedImages
    • numberOfSavedImages

      protected AtomicInteger numberOfSavedImages
    • executor

      protected ExecutorService executor
    • outputFrameRate

      protected FrameRate outputFrameRate
    • debug

      protected boolean debug
  • Constructor Details

    • AbstractImageExporter

      public AbstractImageExporter(FrameRate outputFrameRate)
  • Method Details

    • export

      public void export(BufferedImage image)
      Specified by:
      export in interface AWTImageExporter
    • exportWithVariableFrameRate

      protected void exportWithVariableFrameRate(BufferedImage image)
    • exportWithContinuousFrameRate

      protected void exportWithContinuousFrameRate(BufferedImage image)
      Handle images that should be exported regularly. Skip image if comes too early w.r.t. global delay, repeat image if it comes too late w.r.t global delay, simply add it otherwise.
      Parameters:
      image -
    • scheduleImageExport

      protected void scheduleImageExport(BufferedImage image)
    • scheduleImageExport

      protected void scheduleImageExport(BufferedImage image, boolean isLastImage)
    • doAddFrameByRunnable

      protected abstract void doAddFrameByRunnable(BufferedImage image, boolean isLastImage) throws IOException
      Throws:
      IOException
    • scheduleImageExport

      protected void scheduleImageExport(BufferedImage image, int interFrameDelay)
    • scheduleImageExport

      protected void scheduleImageExport(BufferedImage image, int interFrameDelay, boolean isLastImage)
    • doAddFrameByRunnable

      protected abstract void doAddFrameByRunnable(BufferedImage image, int interFrameDelay, boolean isLastImage) throws IOException
      Throws:
      IOException
    • terminate

      public boolean terminate(long timeout, TimeUnit unit)
      Await completion of all image addition, add the last image, and finish the file. If a time unit is given, the timeout Returns true if all images have been flushed before the timeout ends, false otherwise
      Specified by:
      terminate in interface AWTImageExporter
    • closeOutput

      protected abstract void closeOutput() throws IOException
      Throws:
      IOException
    • isContinuousFrameRate

      public boolean isContinuousFrameRate()
      Returns true if the delay is set globally or if it is defined per frame.
    • getTimer

      public TicToc getTimer()
    • setTimer

      public void setTimer(TicToc timer)
    • getNumberSubmittedImages

      public AtomicInteger getNumberSubmittedImages()
    • getNumberOfSkippedImages

      public AtomicInteger getNumberOfSkippedImages()
    • getNumberOfSavedImages

      public AtomicInteger getNumberOfSavedImages()
    • isDebug

      public boolean isDebug()
    • setDebug

      public void setDebug(boolean debug)