de.innovationgate.utils
public interface ImageScaler
Modifier and Type | Method and Description |
---|---|
long |
determineRenderedSize()
Determines the bytes size of the image if it would be written to an output stream.
|
java.lang.String |
getFormat()
Returns the output format.
|
java.lang.String |
getFormatSuffix()
Returns the normale file suffix for the current output format, including leading "."
|
int |
getHeight()
Returns the current image height
|
java.lang.Object |
getImageEncodeParam()
Returns the image encoding params.
|
float |
getQuality()
Returns the quality of the output format.
|
java.lang.String |
getSourceFileName()
Returns the name of the sourcefile
|
int |
getWidth()
Returns the current image width
|
void |
growToSize(int width,
int height)
Scales the images up to fit given minimum sizes.
|
boolean |
isTransparencySupportedForOutput()
Returns if transparency is supported by the current output format
|
void |
load(java.io.InputStream is)
Loads image data.
|
void |
scaleByFactor(int hfactor,
int vfactor)
Scales the image based on the given scaling factors.
|
void |
scaleToSize(int width,
int height)
Scales the image to a determined target size
This method uses the parameter width and height as target sizes for the scaled image.
|
void |
scaleToSize(int width,
int height,
boolean keepRatio)
Scales the image to the determined target size
if keepRation==true
image orientation is determined (landscape or portrait)
on landscape the image is scaled with the same ratio to the given width
on portrait the image is scaled with the same ratio to the given height
|
void |
setFormat(java.lang.String format)
Sets the output format
|
void |
setImageEncodeParam(java.lang.Object imageEncodeParam)
Sets the image encoding params
|
void |
setQuality(float q)
Sets the quality of the output format.
|
void |
setSourceFileName(java.lang.String name)
Sets the name of the sourcefile
|
void |
shrinkToSize(int width,
int height)
Scales the images down to fit into given maximum sizes.
|
void |
useJPEGForOutput()
Sets the scaler to use JPEG images for output with 90% quality.
|
void |
usePNGForOutput()
Sets the scaler to use PNG images (with color palette) for output,
|
void |
writeImage(java.io.File outFile)
Writes the rendered and scaled image to a file.
|
void |
writeImage(java.io.OutputStream out)
Writes the rendered and scaled image to an outputstream
|
void load(java.io.InputStream is) throws java.io.IOException
is
- image data input stream.java.io.IOException
void useJPEGForOutput()
void usePNGForOutput()
void scaleToSize(int width, int height)
width
- The target width. Use -1 to automatically calculate target width for keeping the image ratioheight
- The target height. Use -1 to automatically calculate target height for keeping the image ratiovoid scaleToSize(int width, int height, boolean keepRatio)
width
- The target widthheight
- The target heightkeepRatio
- true/ falsevoid scaleByFactor(int hfactor, int vfactor)
hfactor
- The horizontal scaling factorvfactor
- The vertical scaling factorvoid shrinkToSize(int width, int height)
width
- The maximum widthheight
- The maximum heightvoid growToSize(int width, int height)
width
- The maximum widthheight
- The maximum heightvoid writeImage(java.io.OutputStream out)
out
- void writeImage(java.io.File outFile) throws java.io.IOException
outFile
- java.io.IOException
- if the file cannot be writtenjava.lang.String getFormat()
void setFormat(java.lang.String format)
format
- The format to set.java.lang.Object getImageEncodeParam()
void setImageEncodeParam(java.lang.Object imageEncodeParam)
imageEncodeParam
- The imageEncodeParam to set.float getQuality()
void setQuality(float q)
q
- int getWidth()
int getHeight()
long determineRenderedSize()
boolean isTransparencySupportedForOutput()
java.lang.String getFormatSuffix()
java.lang.String getSourceFileName()
void setSourceFileName(java.lang.String name)