public class ImageProcessor extends Unit<ImageHandler> implements ImageHandler
ImageHandler
Modifier and Type | Field and Description |
---|---|
static String[] |
COMP_METHODS
Compression methods
|
static int |
GZIP_COMPRESSION
GZIP COMPRESSION.
|
static int |
MAX_HEIGHT
MAX HEIGHT.
|
static int |
MAX_WIDTH
MAX WIDTH.
|
static int |
NO_COMPRESSION
NO COMPRESSION.
|
static int |
PREVIEW_HEIGHT
default PREVIEW HEIGHT.
|
static int |
PREVIEW_WIDTH
default PREVIEW WIDTH.
|
static int |
ZIP_COMPRESSION
ZIP COMPRESSION.
|
APP, COMMAND, ETL_DRIVER, FORMATTER, IDE_NODE, NO_RANK, WIDGET
Modifier and Type | Method and Description |
---|---|
void |
add(String name,
Object object)
Adds loaded object using name as a key.
|
void |
addWithoutLicense(String name,
Object object)
Adds loaded object which doesn't have license using name as a key.
|
boolean |
allowLoadAll()
Checks if loader allowed to to load all objects regardless of license.
|
BufferedImage |
autoCrop(BufferedImage image,
Object[] params)
Auto crops image.
|
BufferedImage |
bandCombine(BufferedImage image,
Object[] params)
Uses "band combine" algorithm to transform image.
|
BufferedImage |
binarize(BufferedImage image,
Object[] params)
Uses "binarize" algorithm to transform image.
|
BufferedImage |
bright(BufferedImage image)
Uses "bright" algorithm to transform image.
|
boolean |
canBeLoadedAgain()
Checks if module can be loaded again.
|
int |
compareTo(ExtensionModule ext) |
BufferedImage |
contrast(BufferedImage image,
Object[] params)
Uses "contrast" algorithm to transform image.
|
BufferedImage |
crop(BufferedImage image,
Object[] params)
Crops the image.
|
BufferedImage |
detectEdge(BufferedImage image,
Object[] params)
Uses "edge detection" algorithm to transform image.
|
void |
finishLoad(UnitLoader loader)
Executed when UnitLoader finishes load.
|
void |
free()
Executed when there is a need to free memory.
|
String |
getConfigFileName()
Gets the path to the configuration file for the module.
|
String |
getDisplayName()
Gets the display name.
|
int |
getExtensionRank()
Gets the extension rank.
|
String |
getIconPath()
Gets the full path to the icon file.
|
String |
getLicensePropertyName()
Gets the name of the license property.
|
List<ImageHandler> |
getList()
Gets the list of loaded modules.
|
String |
getLocalUnitClassPath()
If extension module is a "local" it must return the path to it's corresponding Unit.
|
Map<String,ImageHandler> |
getObjects()
Gets the image handlers as a Map object where key is name and value is ImageHandler
|
List<KeyValue> |
getSelect()
Gets the list of KeyValue objects.
|
String |
getType()
Gets the type of the extension module.
|
String |
getVendor()
Gets the vendor.
|
String |
getVersion()
Gets the version of the extension module.
|
String |
getXmlConfigFileName()
Gets the path to the xml configuration file for the module.
|
static boolean |
hasAlpha(Image image)
This method returns true if the specified image has transparent pixels
|
static ImageProcessor |
instance()
Returns the instance of the ImageProcessor
|
BufferedImage |
invert(BufferedImage image)
Inverts image.
|
BufferedImage |
loadImage(byte[] image,
ImageHandler handler,
int compression)
Loads image using provided ImageHandler and compression algorithm.
|
BufferedImage |
loadImage(byte[] image,
int compression)
Loads image using default ImageHandler and specific compression algorithm.
|
BufferedImage |
loadImage(byte[] image,
String name,
int compression)
Loads image using name of the ImageHandler and specific compression algorithm.
|
BufferedImage |
loadImage(InputStream is)
Loads image.
|
boolean |
loadsConfigurableExtensions()
Returns true if Unit is indented to load configurable extensions.
|
BufferedImage |
rotate(BufferedImage image,
Object[] params)
Rotates the image
|
BufferedImage |
scale(BufferedImage image,
Object[] params)
Scales the image
|
boolean |
startLoad()
Executed when UnitLoader starts loading.
|
getClassPath, getJarPath, getObjClass, getPath, isSingleton, setClassPath, setJarPath, setObjClass, setPath, setSingleton
public static final int PREVIEW_WIDTH
public static final int PREVIEW_HEIGHT
public static final int MAX_WIDTH
public static final int MAX_HEIGHT
public static final int NO_COMPRESSION
public static final int ZIP_COMPRESSION
public static final int GZIP_COMPRESSION
public static final String[] COMP_METHODS
public static boolean hasAlpha(Image image)
image
- the imagepublic static ImageProcessor instance()
public void add(String name, Object object)
Unit
add
in class Unit<ImageHandler>
name
- the unique name of the objectobject
- the objectpublic void addWithoutLicense(String name, Object object)
Unit
addWithoutLicense
in class Unit<ImageHandler>
name
- the unique name of the objectobject
- the objectpublic boolean allowLoadAll()
Unit
allowLoadAll
in class Unit<ImageHandler>
public BufferedImage autoCrop(BufferedImage image, Object[] params) throws Exception
image
- the imageparams
- the parametersException
- in case of any errorpublic BufferedImage bandCombine(BufferedImage image, Object[] params) throws Exception
image
- the imageparams
- the parametersException
- in case of any errorpublic BufferedImage binarize(BufferedImage image, Object[] params) throws Exception
image
- the imageparams
- the parametersException
- in case of any errorpublic BufferedImage bright(BufferedImage image) throws Exception
image
- the imageException
- in case of any errorpublic boolean canBeLoadedAgain()
Unit
canBeLoadedAgain
in class Unit<ImageHandler>
public int compareTo(ExtensionModule ext)
compareTo
in interface Comparable<ExtensionModule>
public BufferedImage contrast(BufferedImage image, Object[] params) throws Exception
image
- the imageparams
- the parametersException
- in case of any errorpublic BufferedImage crop(BufferedImage image, Object[] params) throws Exception
image
- the imageparams
- the parametersException
- in case of any errorpublic BufferedImage detectEdge(BufferedImage image, Object[] params) throws Exception
image
- the imageparams
- the parametersException
- in case of any errorpublic void finishLoad(UnitLoader loader)
Unit
finishLoad
in class Unit<ImageHandler>
loader
- the UnitLoaderpublic void free()
Unit
free
in class Unit<ImageHandler>
public String getConfigFileName()
ExtensionModule
getConfigFileName
in interface ExtensionModule
public String getDisplayName()
ExtensionModule
getDisplayName
in interface ExtensionModule
public int getExtensionRank()
ExtensionModule
getExtensionRank
in interface ExtensionModule
public String getIconPath()
ExtensionModule
getIconPath
in interface ExtensionModule
public String getLicensePropertyName()
ExtensionModule
getLicensePropertyName
in interface ExtensionModule
public List<ImageHandler> getList()
Unit
getList
in class Unit<ImageHandler>
public String getLocalUnitClassPath()
ExtensionModule
getLocalUnitClassPath
in interface ExtensionModule
Unit
public Map<String,ImageHandler> getObjects()
public List<KeyValue> getSelect()
public String getType()
ExtensionModule
getType
in interface ExtensionModule
public String getVendor()
ExtensionModule
getVendor
in interface ExtensionModule
public String getVersion()
ExtensionModule
getVersion
in interface ExtensionModule
public String getXmlConfigFileName()
ExtensionModule
getXmlConfigFileName
in interface ExtensionModule
public BufferedImage invert(BufferedImage image) throws Exception
image
- the imageException
- in case of any errorpublic BufferedImage loadImage(byte[] image, ImageHandler handler, int compression) throws IOException
image
- the imagehandler
- the ImageHandlercompression
- the compression algorithm. Possible values: NO_COMPRESSION, ZIP_COMPRESSION, GZIP_COMPRESSIONIOException
- Signals that an I/O exception has occurred.public BufferedImage loadImage(byte[] image, int compression) throws IOException
image
- the imagecompression
- the compression algorithm. Possible values: NO_COMPRESSION, ZIP_COMPRESSION, GZIP_COMPRESSIONIOException
- Signals that an I/O exception has occurred.public BufferedImage loadImage(byte[] image, String name, int compression) throws IOException
image
- the imagename
- the name of the Image Handler. All detected image handlers are loaded at start up.compression
- the compression algorithm. Possible values: NO_COMPRESSION, ZIP_COMPRESSION, GZIP_COMPRESSIONIOException
- Signals that an I/O exception has occurred.public BufferedImage loadImage(InputStream is) throws IOException
ImageHandler
loadImage
in interface ImageHandler
is
- the input streamIOException
- Signals that an I/O exception has occurred.public boolean loadsConfigurableExtensions()
Unit
loadsConfigurableExtensions
in class Unit<ImageHandler>
public BufferedImage rotate(BufferedImage image, Object[] params) throws Exception
image
- the imageparams
- the parametersException
- in case of any errorpublic BufferedImage scale(BufferedImage image, Object[] params) throws Exception
image
- the imageparams
- the parametersException
- in case of any errorpublic boolean startLoad()
Unit
startLoad
in class Unit<ImageHandler>
Copyright © 2010-2020 Toolsverse. All Rights Reserved.