Class FileImageTypeConverter
java.lang.Object
VASSAL.tools.image.FileImageTypeConverter
- All Implemented Interfaces:
ImageTypeConverter
Convert a
BufferedImage
to a different type by caching image
data on disk.- Since:
- 3.2.0
- Author:
- Joel Uckelman
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconvert
(Reference<BufferedImage> ref, int type) Converts an image to the given type.protected void
read
(InputStream in, BufferedImage dst) protected void
write
(BufferedImage src, OutputStream out)
-
Field Details
-
tfactory
-
-
Constructor Details
-
FileImageTypeConverter
Create a converter.- Parameters:
tfactory
- the temporary file to use as a cache
-
-
Method Details
-
convert
Converts an image to the given type. WARNING: When this method is called, the sole reference to the image must be the one held byref
in order to allow the source image to be garbage collected after the image data is written to disk.- Specified by:
convert
in interfaceImageTypeConverter
- Parameters:
ref
- a holder for the imagetype
- the type of image to return- Returns:
- a converted image
- Throws:
ImageIOException
- if something goes wrong
-
write
- Throws:
IOException
-
read
- Throws:
IOException
-