Package com.illumon.dbtypes
Class DbImageImpl
java.lang.Object
com.illumon.dbtypes.DbImageImpl
- All Implemented Interfaces:
DbFile,DbImage,Externalizable,Serializable
An image which can be persisted.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.illumon.dbtypes.DbImage
DbImage.ImageScalingAlgorithm -
Constructor Summary
ConstructorsConstructorDescriptionThis method is only present to support Externalizable.DbImageImpl(byte[] bytes) Creates an image from image file bytes.DbImageImpl(BufferedImage image) Creates an image from aBufferedImage.DbImageImpl(File file) Creates an image from an image file.DbImageImpl(String file) Creates an image from an image file. -
Method Summary
Modifier and TypeMethodDescriptionintgetBlue(int x, int y) Gets the blue component in the range 0-255 in the default sRGB space for the pixel located at (x,y).Gets aBufferedImagerepresentation of this image.byte[]getBytes()Gets the image file content as a byte array.getColor(int x, int y) Gets the color of the pixel located at (x,y).intgetGray(int x, int y) Gets the gray-scale value in the range 0-255 in the default sRGB space for the pixel located at (x,y).intgetGreen(int x, int y) Gets the green component in the range 0-255 in the default sRGB space for the pixel located at (x,y).intGets the height of the image in pixels.getName()Gets the file name.intgetRed(int x, int y) Gets the red component in the range 0-255 in the default sRGB space for the pixel located at (x,y).getType()Gets the file type.intgetWidth()Gets the width of the image in pixels.voidresize(int width, int height, DbImage.ImageScalingAlgorithm algo) Creates a new resized image.subImage(int x, int y, int w, int h) Creates a sub-image of this image.voidWrites the file out.voidWrites the image to file.void
-
Constructor Details
-
DbImageImpl
public DbImageImpl()This method is only present to support Externalizable. It should not be used otherwise. -
DbImageImpl
public DbImageImpl(byte[] bytes) Creates an image from image file bytes.- Parameters:
bytes- image file bytes- Throws:
NullPointerException- if bytes is null.
-
DbImageImpl
Creates an image from an image file.- Parameters:
file- file location- Throws:
NullPointerException- file is null.IOException
-
DbImageImpl
Creates an image from an image file.- Parameters:
file- file location- Throws:
NullPointerException- file is null.IOException
-
DbImageImpl
Creates an image from aBufferedImage.- Parameters:
image- input image- Throws:
NullPointerException- image is null.
-
-
Method Details
-
getName
Description copied from interface:DbFileGets the file name. -
getType
Description copied from interface:DbFileGets the file type. -
getBytes
public byte[] getBytes()Description copied from interface:DbImageGets the image file content as a byte array. -
getBufferedImage
Description copied from interface:DbImageGets aBufferedImagerepresentation of this image.- Specified by:
getBufferedImagein interfaceDbImage- Returns:
BufferedImagerepresentation of this image.
-
getHeight
public int getHeight()Description copied from interface:DbImageGets the height of the image in pixels. -
getWidth
public int getWidth()Description copied from interface:DbImageGets the width of the image in pixels. -
getColor
Description copied from interface:DbImageGets the color of the pixel located at (x,y). -
getRed
public int getRed(int x, int y) Description copied from interface:DbImageGets the red component in the range 0-255 in the default sRGB space for the pixel located at (x,y). -
getGreen
public int getGreen(int x, int y) Description copied from interface:DbImageGets the green component in the range 0-255 in the default sRGB space for the pixel located at (x,y). -
getBlue
public int getBlue(int x, int y) Description copied from interface:DbImageGets the blue component in the range 0-255 in the default sRGB space for the pixel located at (x,y). -
getGray
public int getGray(int x, int y) Description copied from interface:DbImageGets the gray-scale value in the range 0-255 in the default sRGB space for the pixel located at (x,y). -
write
Description copied from interface:DbFileWrites the file out.- Specified by:
writein interfaceDbFile- Parameters:
file- output file name- Throws:
IOException- problem writing out the file.
-
write
Description copied from interface:DbImageWrites the image to file.- Specified by:
writein interfaceDbImage- Parameters:
formatName- output format name (e.g. "JPEG")file- output file- Throws:
IOException- problem writing out the image.
-
subImage
Description copied from interface:DbImageCreates a sub-image of this image.- Specified by:
subImagein interfaceDbImage- Parameters:
x- the X coordinate of the upper-left corner of the specified rectangular regiony- the Y coordinate of the upper-left corner of the specified rectangular regionw- the width of the specified rectangular regionh- the height of the specified rectangular region- Returns:
- sub-image
-
resize
Description copied from interface:DbImageCreates a new resized image. -
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-