Package org.bzdev.gio

Interface ISWriterOps

All Known Implementing Classes:
AnimatedPanelGraphics, ImageSequenceWriter

public interface ISWriterOps
Common Operations for image-sequence writers. While the class ImageSequenceWriter is designed to create a document that will be written to an output stream, the class AnimatedPanelGraphics allows sequences of images to be displayed directly. This interface provides common operations.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Interface for classes that provide the parameters needed to configure an image sequence writer by providing a width, height, and frame rate.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    addMetadata(int frameWidth, int frameHeight, double frameRate)
    Add the metadata entry without a media type and without a format string.
    default void
    addMetadata(int frameWidth, int frameHeight, String frameMimeType)
    Add the metadata entry without a frame rate and format.
    void
    addMetadata(int frameWidth, int frameHeight, String frameMimeType, double frameRate, String format)
    Add the metadata entry in full.
    default void
    addMetadata(int frameWidth, int frameHeight, String frameMimeType, String format)
    Add the metadata entry without a frame rate.
    void
    Close this writer.
    int
    Get the frame height.
    int
    Get the frame width.
    Create a graphics output stream for drawing graphics.
    Create a graphics output stream for drawing graphics, specifying a repetition count.
    Create a named graphics output stream for drawing graphics.
    nextOutputStreamGraphics(String name, int count)
    Create a named graphics output stream for drawing graphics, specifying a repetition count.
    default void
    Specify the estimated number of frames as an integer.
    void
    Specify the estimated number of frames as a long integer.
  • Method Details

    • addMetadata

      default void addMetadata(int frameWidth, int frameHeight, String frameMimeType) throws IOException, IllegalStateException
      Add the metadata entry without a frame rate and format. A default format will be provided if needed.
      Parameters:
      frameWidth - the frame width in pixels
      frameHeight - the frame height in pixels
      frameMimeType - the media type of the frames; null if not applicable
      Throws:
      IOException - and IO exception occurred
      IllegalStateException - metadata was already added
    • addMetadata

      default void addMetadata(int frameWidth, int frameHeight, String frameMimeType, String format) throws IOException, IllegalStateException
      Add the metadata entry without a frame rate. Subclasses that require a format field should document any requirements on the printf string the format supplies. If not needed, the format field will be ignored.
      Parameters:
      frameWidth - the frame width in pixels
      frameHeight - the frame height in pixels
      frameMimeType - the media type of the frames; null if not applicable
      format - the printf string that will produce the name of an image given an integer; null for a default value
      Throws:
      IOException - and IO exception occurred
      IllegalStateException - metadata was already added
    • addMetadata

      default void addMetadata(int frameWidth, int frameHeight, double frameRate) throws IOException, IllegalStateException
      Add the metadata entry without a media type and without a format string. Subclasses that require a format field should document any requirements on the printf string the format supplies. When needed, defaults will be provided for the media type and image-name format string.
      Parameters:
      frameWidth - the frame width in pixels
      frameHeight - the frame height in pixels
      frameRate - the number of frames per second
      Throws:
      IOException - an IO error occurred
      IllegalStateException - metadata was already added
    • addMetadata

      void addMetadata(int frameWidth, int frameHeight, String frameMimeType, double frameRate, String format) throws IOException, IllegalStateException
      Add the metadata entry in full. Subclasses that require a format field should document any requirements on the printf string the format supplies. If not needed, the format field will be ignored.
      Parameters:
      frameWidth - the frame width in pixels
      frameHeight - the frame height in pixels
      frameMimeType - the media type of the frames
      frameRate - the number of frames per second
      format - the printf string that will produce the name of an image given an integer; null for a default value
      Throws:
      IOException - an IO error occurred
      IllegalStateException - metadata was already added
    • getFrameWidth

      int getFrameWidth()
      Get the frame width. The frame width is the common width of all images in the sequence and is configured by a call to addMetadata(int,int,String), addMetadata(int,int,String,String), addMetadata(int,int,double), or addMetadata(int,int,String,double,String). If one of these methods has not been called, a value of zero will be returned.
      Returns:
      the frame width
    • getFrameHeight

      int getFrameHeight()
      Get the frame height. The frame height is the common width of all images in the sequence, and is configured by a call to addMetadata(int,int,String), addMetadata(int,int,String,String), addMetadata(int,int,double), or addMetadata(int,int,String,double,String). If one of these methods has not been called, a value of zero will be returned.
      Returns:
      the frame height
    • setEstimatedFrameCount

      default void setEstimatedFrameCount(int count)
      Specify the estimated number of frames as an integer. The estimated frame count is an estimate of the number of images or frames in a sequence.
      Parameters:
      count - the number of frames; 0 for unknown
    • setEstimatedFrameCount

      void setEstimatedFrameCount(long count)
      Specify the estimated number of frames as a long integer. The estimated frame count is an estimate of the number of images or frames in a sequence.
      Parameters:
      count - the number of frames; 0 for unknown
    • nextOutputStreamGraphics

      OSGraphicsOps nextOutputStreamGraphics() throws IllegalStateException, IOException
      Create a graphics output stream for drawing graphics. To use this method, one will typically use the following design pattern:
          ISWriterOps isw = ...;
          ...
          OutputStreamGraphics osg = isw.nextOutputStreamGraphics();
          Graphics2D g2d = osg.createGraphics();
          // drawing operation using g2d
          ...
          g2d.displose();
          osg.imageComplete();
          osg.close();
       
      Returns:
      a graphics output stream for drawing an image
      Throws:
      IOException - - if an IOException occurred
      IllegalStateException
    • nextOutputStreamGraphics

      OSGraphicsOps nextOutputStreamGraphics(String name) throws IllegalStateException, IOException
      Create a named graphics output stream for drawing graphics. To use this method, one will typically use the following design pattern:
          ISWriterOps isw = ...;
          ...
          String name = ...;
          OutputStreamGraphics osg = isw.nextOutputStreamGraphics(name);
          Graphics2D g2d = osg.createGraphics();
          // drawing operation using g2d
          ...
          g2d.displose();
          osg.imageComplete();
          osg.close();
       
      The name can be used by the object implementing this interface as a key for looking up an image or other object. How a name is interpreted is class specific.
      Parameters:
      name - the name for this output stream
      Returns:
      a graphics output stream for drawing an image
      Throws:
      IOException - - if an IOException occurred
      IllegalStateException
    • nextOutputStreamGraphics

      OSGraphicsOps nextOutputStreamGraphics(int count) throws IllegalStateException, IOException
      Create a graphics output stream for drawing graphics, specifying a repetition count. To use this method, one will typically use the following design pattern:
          ISWriterOps isw = ...
          ...
          OSGraphicsOps osg = isw.nextOutputStreamGraphics(...);
          int count = ...;
          Graphics2D g2d = osg.createGraphics(count);
          // drawing operation using g2d
          ...
          g2d.displose();
          osg.imageComplete();
          osg.close();
       
      Parameters:
      count - the repetition count for the entry corresponding to the graphics output stream that will be returned
      Returns:
      a graphics output stream for drawing graphics
      Throws:
      IOException - - if an IOException occurred
      IllegalStateException
    • nextOutputStreamGraphics

      OSGraphicsOps nextOutputStreamGraphics(String name, int count) throws IllegalStateException, IOException
      Create a named graphics output stream for drawing graphics, specifying a repetition count. To use this method, one will typically use the following design pattern:
          ISWriterOps isw = ...
          ...
          OSGraphicsOps osg = isw.nextOutputStreamGraphics(...);
          String name = ...;
      
          int count = ...;
          Graphics2D g2d = osg.createGraphics(name, count);
          // drawing operation using g2d
          ...
          g2d.displose();
          osg.imageComplete();
          osg.close();
       
      The name can be used by the object implementing this interface as a key for looking up an image or other object. How a name is interpreted is class specific.
      Parameters:
      name - the name for this output stream
      count - the repetition count for the entry corresponding to the graphics output stream that will be returned
      Returns:
      a graphics output stream for drawing graphics
      Throws:
      IOException - - if an IOException occurred
      IllegalStateException
    • close

      void close() throws IllegalStateException, IOException
      Close this writer.
      Throws:
      IOException - - if an IOException occurred
      IllegalStateException