Class ImageFormat
- java.lang.Object
-
- uk.ac.rdg.resc.edal.graphics.formats.ImageFormat
-
- Direct Known Subclasses:
KmzFormat
,SimpleFormat
public abstract class ImageFormat extends Object
Abstract superclass for all image formats. Only one instance of each subclass will be created so subclasses must be thread safe. Subclasses should provide protected default constructors so that they cannot be instantiated directly.- Author:
- Jon Blower, Guy Griffiths
-
-
Constructor Summary
Constructors Constructor Description ImageFormat()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ImageFormat
get(String mimeType)
Gets an ImageFormat object corresponding with the given MIME type.abstract String
getMimeType()
Returns the MIME type that is supported by this ImageFormat object.static Set<String>
getSupportedMimeTypes()
Gets the image MIME types that are supportedabstract boolean
requiresLegend()
Returns true if this image format needs an accompanying legend.abstract boolean
supportsFullyTransparentPixels()
Returns true if this image format supports fully-transparent pixels.abstract boolean
supportsMultipleFrames()
Returns true if this image format supports multi-frame animations.abstract boolean
supportsPartiallyTransparentPixels()
Returns true if this image format supports partially-transparent pixels.abstract void
writeImage(List<BufferedImage> frames, OutputStream out, String name, String description, org.opengis.metadata.extent.GeographicBoundingBox bbox, List<org.joda.time.DateTime> tValues, String zValue, BufferedImage legend, Integer frameRate)
Writes the given list of frames to the supplied output stream.
-
-
-
Method Detail
-
getSupportedMimeTypes
public static Set<String> getSupportedMimeTypes()
Gets the image MIME types that are supported- Returns:
- the MIME types as a Set of Strings
-
get
public static ImageFormat get(String mimeType) throws InvalidFormatException
Gets an ImageFormat object corresponding with the given MIME type. Note that this does not create a new object with each invocation: only one ImageFormat object is created for each MIME type.- Parameters:
mimeType
- The MIME type of the requested format- Returns:
- An ImageFormat object capable of rendering images in the given MIME type
- Throws:
InvalidFormatException
- if the given MIME type is not supported
-
getMimeType
public abstract String getMimeType()
Returns the MIME type that is supported by this ImageFormat object.
-
supportsMultipleFrames
public abstract boolean supportsMultipleFrames()
Returns true if this image format supports multi-frame animations.
-
supportsFullyTransparentPixels
public abstract boolean supportsFullyTransparentPixels()
Returns true if this image format supports fully-transparent pixels.
-
supportsPartiallyTransparentPixels
public abstract boolean supportsPartiallyTransparentPixels()
Returns true if this image format supports partially-transparent pixels. If this is true then supportsFullyTransparentPixels() should also be true.
-
requiresLegend
public abstract boolean requiresLegend()
Returns true if this image format needs an accompanying legend. This default implementation returns false, but subclasses can override.- See Also:
KmzFormat
-
writeImage
public abstract void writeImage(List<BufferedImage> frames, OutputStream out, String name, String description, org.opengis.metadata.extent.GeographicBoundingBox bbox, List<org.joda.time.DateTime> tValues, String zValue, BufferedImage legend, Integer frameRate) throws IOException
Writes the given list of frames to the supplied output stream. If there are multiple frames, the image format must support animations, otherwise an exception is thrown.- Parameters:
frames
- AList
ofBufferedImage
s to plotout
- TheOutputStream
to write the resulting image toname
- The name of the feature being plotted (for KML)description
- A description of what's being plotted (for KML)bbox
- The bounding box of the data being plottedtValues
- The time values corresponding to the frames of datazValue
- A string representing the elevation of the plotted datalegend
- An image representing the legendframeRate
- The frame rate to render an animation at- Throws:
IOException
- If there is a problem writing the data to theOutputStream
-
-