Class SignatureImage
java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.DatabaseBlobBean
org.deltava.beans.cooler.SignatureImage
- All Implemented Interfaces:
Serializable,Comparable<Object>,IDBean,Cacheable
A bean to store Signature Images for processing.
- Since:
- 2.3
- Version:
- 7.0
- Author:
- Luke
- See Also:
-
Field Summary
Fields inherited from class org.deltava.beans.DatabaseBlobBean
_buffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the image height.byte[]Retrieves the new image in a particular format.intgetWidth()Returns the image width.voidload(byte[] buffer) Loads the image from a byte array and updates the internal buffer.voidload(InputStream is) Loads the image from a stream.voidMarks the signature with a watermark.Methods inherited from class org.deltava.beans.DatabaseBlobBean
clear, getInputStream, getSize, isLoadedMethods inherited from class org.deltava.beans.DatabaseBean
cacheKey, compareTo, equals, getHexID, getID, hashCode, setID, validateID, validateID
-
Constructor Details
-
SignatureImage
public SignatureImage(int id) Initializes the bean.- Parameters:
id- the Pilot's database ID- Throws:
IllegalArgumentException- if id is zero or negative
-
-
Method Details
-
getHeight
public int getHeight()Returns the image height.- Returns:
- the height in pixels, or -1 if not loaded
-
getWidth
public int getWidth()Returns the image width.- Returns:
- the width in pixels, or -1 if not loaded
-
load
public void load(byte[] buffer) Loads the image from a byte array and updates the internal buffer.- Overrides:
loadin classDatabaseBlobBean- Parameters:
buffer- the image buffer- Throws:
IllegalArgumentException- if the image cannot be parsed- See Also:
-
load
Loads the image from a stream.- Overrides:
loadin classDatabaseBlobBean- Parameters:
is- the stream containing the data- Throws:
IOException- if an error occurs reading the stream data- See Also:
-
watermark
Marks the signature with a watermark.- Parameters:
txt- the watermark texttx- the x-coordinate of the textty- the y-coordinate of the text
-
getImage
Retrieves the new image in a particular format.- Parameters:
fmt- the format code (eg. gif, jpg, png)- Returns:
- the formatted image
- Throws:
IOException- if an error occurs
-