public class EarthImageWriter
extends java.lang.Object
EarthImageWriter
has a single static method that writes
image data from an EarthDataView
to one of various formats.Modifier and Type | Method and Description |
---|---|
static EarthImageWriter |
getInstance()
Gets the singleton instance of this class.
|
static java.awt.image.BufferedImage |
quantizeToIndex(java.awt.image.BufferedImage image,
java.awt.image.IndexColorModel colorModel)
Performs a color quantization of an image to a specific
index color model.
|
void |
setFont(java.awt.Font font)
Sets the font used for legends.
|
Renderable |
write(EarthDataView view,
EarthDataInfo info,
boolean isVerbose,
boolean hasLegends,
IconElement logo,
boolean isAntialiased,
java.io.File file,
java.lang.String format,
java.lang.String worldFile,
java.lang.String tiffComp,
int imageColors)
Writes the specified view to an image file.
|
public static EarthImageWriter getInstance()
public void setFont(java.awt.Font font)
font
- the new legend font.public Renderable write(EarthDataView view, EarthDataInfo info, boolean isVerbose, boolean hasLegends, IconElement logo, boolean isAntialiased, java.io.File file, java.lang.String format, java.lang.String worldFile, java.lang.String tiffComp, int imageColors) throws java.lang.IllegalArgumentException, java.io.IOException
view
- the earth data view to write.info
- the earth data information to use for the
legends.isVerbose
- the verbose flag, true to print verbose messages.hasLegends
- the legends flag, true to draw color scale and
information legends.logo
- the logo to use for the legend. Ignored if
hasLegends is false.isAntialiased
- the antialias flag, true to antialias fonts
and lines.file
- the output file to write.format
- the output file format: 'png', 'jpg', 'tif',
'gif', or 'pdf'.worldFile
- the world file to write, or null for no world
file. Correct world files can only be written if no legends are
used and only for image formats, not PDF.tiffComp
- the TIFF compression type: 'none', 'deflate', or 'pack'.imageColors
- the number of image colors to use or 0 to
not restrict the image colors. If > 0, an indexed color
model will be used for TIFF, PNG, GIF, and PDF output and
antialiasing of lines turned off.java.lang.IllegalArgumentException
- if the specified format is not
supported.java.io.IOException
- if an error occurred writing the image data.public static java.awt.image.BufferedImage quantizeToIndex(java.awt.image.BufferedImage image, java.awt.image.IndexColorModel colorModel)
image
- the image to quantize.colorModel
- the index color model to quantize the
image with size <= 256 colors.