Documentation of 'org.jhotdraw.draw.io.ImageOutputFormat' Java class
ImageOutputFormat
org.jhotdraw.draw.io

Class ImageOutputFormat

  • All Implemented Interfaces:
    OutputFormat


    public class ImageOutputFormat
    extends java.lang.Object
    implements OutputFormat
    An output format for exporting drawings using one of the image formats supported by javax.imageio.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ImageOutputFormat()
      Creates a new image output format for Portable Network Graphics PNG.
      ImageOutputFormat(java.lang.String formatName, java.lang.String description, java.lang.String fileExtension, int bufferedImageType)
      Creates a new image output format for the specified image format.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.awt.datatransfer.Transferable createTransferable(Drawing drawing, java.util.List<Figure> figures, double scaleFactor)
      Writes the drawing to the specified output stream.
      java.lang.String getFileExtension()
      Returns the file extension for the output format.
      javax.swing.filechooser.FileFilter getFileFilter()
      Return a FileFilter that can be used to identify files which can be stored with this output format.
      javax.swing.JComponent getOutputFormatAccessory()
      Return a JFileChooser accessory that can be used to customize the output format.
      java.awt.image.BufferedImage toImage(Drawing drawing, java.util.List<Figure> figures, java.awt.geom.AffineTransform transform, java.awt.Dimension imageSize)
      Creates a BufferedImage from the specified list of figures.
      java.awt.image.BufferedImage toImage(Drawing drawing, java.util.List<Figure> figures, double scaleFactor, boolean clipToFigures)
      Creates a BufferedImage from the specified list of figures.
      void write(java.io.File file, Drawing drawing)
      Writes the drawing to the specified file.
      void write(java.io.OutputStream out, Drawing drawing)
      Writes the drawing to the specified output stream.
      void write(java.io.OutputStream out, Drawing drawing, java.awt.geom.AffineTransform drawingTransform, java.awt.Dimension imageSize)
      Writes the drawing to the specified output stream.
      void write(java.io.OutputStream out, Drawing drawing, java.util.List<Figure> figures)
      Writes the figures to the specified output stream.
      void write(java.io.OutputStream out, Drawing drawing, java.util.List<Figure> figures, java.awt.geom.AffineTransform drawingTransform, java.awt.Dimension imageSize)
      Writes the figures to the specified output stream.
      void write(java.net.URI uri, Drawing drawing)
      Writes a Drawing into an URI.
      • Methods inherited from class java.lang.Object

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

      • ImageOutputFormat

        public ImageOutputFormat()
        Creates a new image output format for Portable Network Graphics PNG.
      • ImageOutputFormat

        public ImageOutputFormat(java.lang.String formatName,
                                 java.lang.String description,
                                 java.lang.String fileExtension,
                                 int bufferedImageType)
        Creates a new image output format for the specified image format.
        Parameters:
        formatName - The format name for the javax.imageio.ImageIO object.
        description - The format description to be used for the file filter.
        fileExtension - The file extension to be used for file filter.
        bufferedImageType - The BufferedImage type used to produce the image. The value of this parameter must match with the format name.
    • Method Detail

      • getFileFilter

        public javax.swing.filechooser.FileFilter getFileFilter()
        Description copied from interface: OutputFormat
        Return a FileFilter that can be used to identify files which can be stored with this output format. Typically, each output format has its own recognizable file extension.
        Specified by:
        getFileFilter in interface OutputFormat
        Returns:
        FileFilter to be used with a javax.swing.JFileChooser
      • getFileExtension

        public java.lang.String getFileExtension()
        Description copied from interface: OutputFormat
        Returns the file extension for the output format. The file extension should be appended to a file name when storing a Drawing with the specified file format.
        Specified by:
        getFileExtension in interface OutputFormat
      • getOutputFormatAccessory

        public javax.swing.JComponent getOutputFormatAccessory()
        Description copied from interface: OutputFormat
        Return a JFileChooser accessory that can be used to customize the output format.
        Specified by:
        getOutputFormatAccessory in interface OutputFormat
        Returns:
        A JFileChooser accessory to be used with a javax.swing.JFileChooser Returns null, if no accessory is provided for this format.
      • write

        public void write(java.net.URI uri,
                          Drawing drawing)
                   throws java.io.IOException
        Description copied from interface: OutputFormat
        Writes a Drawing into an URI.
        Specified by:
        write in interface OutputFormat
        Parameters:
        uri - The uri.
        drawing - The drawing.
        Throws:
        java.io.IOException
      • write

        public void write(java.io.File file,
                          Drawing drawing)
                   throws java.io.IOException
        Writes the drawing to the specified file. This method ensures that all figures of the drawing are visible on the image.
        Throws:
        java.io.IOException
      • write

        public void write(java.io.OutputStream out,
                          Drawing drawing)
                   throws java.io.IOException
        Writes the drawing to the specified output stream. This method ensures that all figures of the drawing are visible on the image.
        Specified by:
        write in interface OutputFormat
        Parameters:
        out - The output stream.
        drawing - The drawing.
        Throws:
        java.io.IOException
      • write

        public void write(java.io.OutputStream out,
                          Drawing drawing,
                          java.awt.geom.AffineTransform drawingTransform,
                          java.awt.Dimension imageSize)
                   throws java.io.IOException
        Writes the drawing to the specified output stream. This method applies the specified transform to the drawing, and draws it on an image of the specified size.
        Throws:
        java.io.IOException
      • createTransferable

        public java.awt.datatransfer.Transferable createTransferable(Drawing drawing,
                                                                     java.util.List<Figure> figures,
                                                                     double scaleFactor)
                                                              throws java.io.IOException
        Writes the drawing to the specified output stream. This method ensures that all figures of the drawing are visible on the image.
        Specified by:
        createTransferable in interface OutputFormat
        Parameters:
        drawing - The drawing.
        figures - A list of figures of the drawing.
        scaleFactor - The factor to be used, when the Transferable creates an image with a fixed size from the figures.
        Returns:
        The Transferable.
        Throws:
        java.io.IOException
      • write

        public void write(java.io.OutputStream out,
                          Drawing drawing,
                          java.util.List<Figure> figures)
                   throws java.io.IOException
        Writes the figures to the specified output stream. This method ensures that all figures of the drawing are visible on the image.
        Throws:
        java.io.IOException
      • write

        public void write(java.io.OutputStream out,
                          Drawing drawing,
                          java.util.List<Figure> figures,
                          @Nullable
                          java.awt.geom.AffineTransform drawingTransform,
                          @Nullable
                          java.awt.Dimension imageSize)
                   throws java.io.IOException
        Writes the figures to the specified output stream. This method applies the specified transform to the drawing, and draws it on an image of the specified size.
        Throws:
        java.io.IOException
      • toImage

        public java.awt.image.BufferedImage toImage(Drawing drawing,
                                                    java.util.List<Figure> figures,
                                                    double scaleFactor,
                                                    boolean clipToFigures)
        Creates a BufferedImage from the specified list of figures.

        The images are drawn using the specified scale factor. If some figures have a drawing area located at negative coordinates, then the drawing coordinates are translated, so that all figures are visible on the image.

        Parameters:
        drawing - The drawing.
        figures - A list of figures of the drawing.
        scaleFactor - The scale factor used when drawing the figures.
        clipToFigures - If this is true, the image is clipped to the figures. If this is false, the image includes the drawing area,
      • toImage

        public java.awt.image.BufferedImage toImage(Drawing drawing,
                                                    java.util.List<Figure> figures,
                                                    java.awt.geom.AffineTransform transform,
                                                    java.awt.Dimension imageSize)
        Creates a BufferedImage from the specified list of figures.
        Parameters:
        drawing - The drawing.
        figures - A list of figures of the drawing.
        transform - The AffineTransform to be used when drawing the figures.
        imageSize - The width and height of the image.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.