public abstract class ImageFactory
extends java.lang.Object
ImageFactory
contains image creation mechanism on top of different platforms like PC and
Android. System will choose appropriate Factory based on the supported image type.Constructor and Description |
---|
ImageFactory() |
Modifier and Type | Method and Description |
---|---|
abstract Image |
fromFile(java.nio.file.Path path)
Gets
Image from file. |
abstract Image |
fromImage(java.lang.Object image)
Gets
Image from varies Java image types. |
abstract Image |
fromInputStream(java.io.InputStream is)
Gets
Image from InputStream . |
abstract Image |
fromNDArray(NDArray array)
|
Image |
fromUrl(java.lang.String url)
Gets
Image from URL. |
Image |
fromUrl(java.net.URL url)
Gets
Image from URL. |
static ImageFactory |
getInstance()
Gets new instance of Image factory from the provided factory implementation.
|
static void |
setImageFactory(ImageFactory factory)
Sets a custom instance of
ImageFactory . |
public static ImageFactory getInstance()
ImageFactory
public static void setImageFactory(ImageFactory factory)
ImageFactory
.factory
- a custom instance of ImageFactory
public abstract Image fromFile(java.nio.file.Path path) throws java.io.IOException
Image
from file.path
- the path to the imageImage
java.io.IOException
- Image not found or not readablepublic Image fromUrl(java.net.URL url) throws java.io.IOException
Image
from URL.url
- the URL to load fromImage
java.io.IOException
- URL is not valid.public Image fromUrl(java.lang.String url) throws java.io.IOException
Image
from URL.url
- the String represent URL to load fromImage
java.io.IOException
- URL is not valid.public abstract Image fromInputStream(java.io.InputStream is) throws java.io.IOException
Image
from InputStream
.is
- InputStream
Image
java.io.IOException
- image cannot be read from input stream.public abstract Image fromImage(java.lang.Object image)
Image
from varies Java image types.
Image can be BufferedImage or BitMap depends on platform
image
- the image object.Image