public class ImageOutputFormat extends java.lang.Object implements OutputFormat
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.
|
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.
|
protected void |
setRenderingHints(java.awt.Graphics2D g) |
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.
|
public ImageOutputFormat()
public ImageOutputFormat(java.lang.String formatName, java.lang.String description, java.lang.String fileExtension, int bufferedImageType)
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.public javax.swing.filechooser.FileFilter getFileFilter()
OutputFormat
getFileFilter
in interface OutputFormat
public java.lang.String getFileExtension()
OutputFormat
getFileExtension
in interface OutputFormat
public javax.swing.JComponent getOutputFormatAccessory()
OutputFormat
getOutputFormatAccessory
in interface OutputFormat
public void write(java.net.URI uri, Drawing drawing) throws java.io.IOException
OutputFormat
write
in interface OutputFormat
uri
- The uri.drawing
- The drawing.java.io.IOException
public void write(java.io.File file, Drawing drawing) throws java.io.IOException
java.io.IOException
public void write(java.io.OutputStream out, Drawing drawing) throws java.io.IOException
write
in interface OutputFormat
out
- The output stream.drawing
- The drawing.java.io.IOException
public void write(java.io.OutputStream out, Drawing drawing, java.awt.geom.AffineTransform drawingTransform, java.awt.Dimension imageSize) throws java.io.IOException
java.io.IOException
public java.awt.datatransfer.Transferable createTransferable(Drawing drawing, java.util.List<Figure> figures, double scaleFactor) throws java.io.IOException
createTransferable
in interface OutputFormat
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.java.io.IOException
public void write(java.io.OutputStream out, Drawing drawing, java.util.List<Figure> figures) throws java.io.IOException
java.io.IOException
public void write(java.io.OutputStream out, Drawing drawing, java.util.List<Figure> figures, java.awt.geom.AffineTransform drawingTransform, java.awt.Dimension imageSize) throws java.io.IOException
java.io.IOException
public java.awt.image.BufferedImage toImage(Drawing drawing, java.util.List<Figure> figures, double scaleFactor, boolean clipToFigures)
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.
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,public java.awt.image.BufferedImage toImage(Drawing drawing, java.util.List<Figure> figures, java.awt.geom.AffineTransform transform, java.awt.Dimension imageSize)
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.protected void setRenderingHints(java.awt.Graphics2D g)