public interface ImageConverter
The generated file convert is not compatible with MicroUI API but it can be used by some custom MicroUI extensions.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ImageConverter.OutputFile
Specifies the generated file: its relative path from the output folder and
its type.
|
static class |
ImageConverter.OutputFileType
Specifies the generated file's output type.
|
| Modifier and Type | Method and Description |
|---|---|
default ImageConverter.OutputFile |
generate(Image image,
java.io.File outputDir)
Generates a file from the given file in the given output folder.
|
boolean |
generate(Image image,
java.io.OutputStream stream)
Converts the given image in the given output stream.
|
default java.lang.String[] |
getListFileExtensions()
Gets the exhaustive list of the list file extensions supported by this
converter.
|
java.lang.String |
getOutputFileExtension()
Returns the file extension to apply as suffix for the converted images.
|
default ImageConverter.OutputFile generate(Image image, java.io.File outputDir) throws java.io.IOException
This method allows to generate any types of file with any name.
By default, this method creates a file with the same relative path than input
image plus the extension returned by getOutputFileExtension(). Then
it call generate(Image, OutputStream). This simplifies the
implementation that just needs to convert the input file and fill the file
output stream.
image - the image to convertoutputDir - the output folderjava.io.IOExceptionboolean generate(Image image, java.io.OutputStream stream) throws java.io.IOException
If this method returns true, the image is considered as encoded even if no byte has been written into the output stream. In this case the final file size is 0.
If this method returns false, the image is not considered as encoded even if some bytes have been written into the output stream. In this case the written bytes are lost.
image - the image to convertstream - the output stream where write the encoded image.java.io.IOExceptionjava.lang.String getOutputFileExtension()
default java.lang.String[] getListFileExtensions()
Only the files listed in a supported list file are given to this converter to be generated. The default extension (*.images.list) is implicitely added when no specific extension is returned (otherwise the default extension must be explicitely added).