Package uk.ac.starlink.ttools.plot
Class GraphicExporter
java.lang.Object
uk.ac.starlink.ttools.plot.GraphicExporter
- Direct Known Subclasses:
PdfGraphicExporter
Exports painted graphics to an output file in some graphics format.
- Since:
- 1 Aug 2008
- Author:
- Mark Taylor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GraphicExporter
Exports to Encapsulated PostScript.static final GraphicExporter
Exports to gzipped Encapsulated PostScript.static final GraphicExporter
Exports to GIF format.static final GraphicExporter
Exports to JPEG format.static final GraphicExporter
Exports to PNG format with a standard (currently opaque) background.static final GraphicExporter
Exports to PNG format with a transparent background.static final GraphicExporter
Exports to SVG format. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
GraphicExporter
(String name, String mimeType, boolean isVector, String description, String[] fileSuffixes) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
exportGraphic
(Picture picture, OutputStream out) Paints the given picture to an output stream using some graphics format or other.Returns the content encoding for the output used by this exporter.Returns a minimal description of this exporter.String[]
Returns an array of file suffixes which usually indicate a file with an export format used by this instance.static GraphicExporter[]
Returns a standard list of available GraphicExporter objects.Returns the MIME type for the graphics format used by this exporter.getName()
Returns the name of this exporter (usually the graphics format name).boolean
isVector()
Indicates whether this exports to a vector or bitmapped graphics format.static Picture
toPicture
(JComponent comp) Utility method to acquire a Picture object which can paint the content of a screen component.toString()
-
Field Details
-
JPEG
Exports to JPEG format. -
PNG
Exports to PNG format with a standard (currently opaque) background. -
PNG_TRANSPARENT
Exports to PNG format with a transparent background. -
GIF
Exports to GIF format. -
SVG
Exports to SVG format. -
EPS
Exports to Encapsulated PostScript. -
EPS_GZIP
Exports to gzipped Encapsulated PostScript.
-
-
Constructor Details
-
GraphicExporter
protected GraphicExporter(String name, String mimeType, boolean isVector, String description, String[] fileSuffixes) Constructor.- Parameters:
name
- exporter name (usually graphics format name)mimeType
- MIME type for this exporter's output formatisVector
- true for vector formats, false for bitmappeddescription
- minimal description of format (may just be name)fileSuffixes
- file suffixes which usually indicate the export format used by this instance (may be null)
-
-
Method Details
-
exportGraphic
Paints the given picture to an output stream using some graphics format or other. This method should not close the stream.- Parameters:
picture
- picture to drawout
- destination output stream- Throws:
IOException
-
getName
Returns the name of this exporter (usually the graphics format name).- Returns:
- exporter name
-
getMimeType
Returns the MIME type for the graphics format used by this exporter.- Returns:
- MIME type string
-
isVector
public boolean isVector()Indicates whether this exports to a vector or bitmapped graphics format.- Returns:
- true for vector graphics, false for bitmapped
-
getDescription
Returns a minimal description of this exporter. This may just be the format's name if there's nothing else to say.- Returns:
- description
-
getContentEncoding
Returns the content encoding for the output used by this exporter. The default implementation returns null, meaning no special encoding.- Returns:
- content encoding
-
getFileSuffixes
Returns an array of file suffixes which usually indicate a file with an export format used by this instance.- Returns:
- copy of file suffix list; may be empty but will not be null
-
toString
-
toPicture
Utility method to acquire a Picture object which can paint the content of a screen component. The component should not be altered while the picture is in use.- Parameters:
comp
- screen component- Returns:
- object to draw comp's content
-
getKnownExporters
Returns a standard list of available GraphicExporter objects. However, the one for exporting PDFs must be supplied explicitly, since which to choose (if any) depends on configuration.- Parameters:
pdfEx
- exporter for PDF graphics, or null if none required- Returns:
- list of available exporters including the supplied PDF one
-