|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xhtmlrenderer.util.ScalingOptions
public class ScalingOptions
POJO used when calling
org.xhtmlrenderer.util.ImageUtil#getScaledInstance(ScalingOptions,java.awt.Image).
Encapsulates a set of parameters related to scaling quality and output. Values are final once constructed, except
for target width and height, which can be change and the options instance reused.
There is a default constructor for average quality and performance.
| Constructor Summary | |
|---|---|
ScalingOptions()
Default scaling options, nearest neighbor interpolation, and fast downscaling. |
|
ScalingOptions(DownscaleQuality downscalingHint,
Object interpolationHint)
Constructor with all options. |
|
ScalingOptions(int targetWidth,
int targetHeight,
int type,
DownscaleQuality downscalingHint,
Object hint)
Constructor with all options. |
|
| Method Summary | |
|---|---|
void |
applyRenderingHints(Graphics2D g2)
Applies any rendering hints configured for these ScalingOptions to a Graphics2D instance before image operations are called on it. |
DownscaleQuality |
getDownscalingHint()
|
Object |
getRenderingHint()
|
protected Map |
getRenderingHints()
Returns a Map of image rendering hints applicable to Graphics2D.setRenderingHints(java.util.Map). |
int |
getTargetHeight()
|
int |
getTargetWidth()
|
void |
setTargetDimensions(Dimension dim)
|
void |
setTargetHeight(int targetHeight)
|
void |
setTargetWidth(int targetWidth)
|
boolean |
sizeMatches(Image img)
Returns true if the target size specified by these options matches the size provided (e.g. |
boolean |
sizeMatches(int w,
int h)
Returns true if the target size specified by these options matches the size provided (e.g. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ScalingOptions(DownscaleQuality downscalingHint,
Object interpolationHint)
downscalingHint - Directs downscaling quality. One of the enumerated types of
DownscaleQuality such as
org.xhtmlrenderer.util.ImageUtil.DOWNSCALE_FAST.interpolationHint - Hint for interpolation to AWT image renderer, one of the Object constants from
RenderingHints using RenderingHints.KEY_INTERPOLATIONpublic ScalingOptions()
public ScalingOptions(int targetWidth,
int targetHeight,
int type,
DownscaleQuality downscalingHint,
Object hint)
targetWidth - Target width in pixels of image once scaledtargetHeight - Target height in pixels of image once scaledtype - Type of BufferedImage to create for output; see docs for
BufferedImage.BufferedImage(int,int,int)downscalingHint - Directs downscaling quality. One of the enumerated types of
DownscaleQuality such as
org.xhtmlrenderer.util.ImageUtil.DOWNSCALE_FAST.hint - Hint for interpolation to AWT image renderer, one of the Object constants from
RenderingHints using RenderingHints.KEY_INTERPOLATION| Method Detail |
|---|
public DownscaleQuality getDownscalingHint()
ScalingOptions#ScalingOptions(int,DownscaleQuality,Object) docs.public Object getRenderingHint()
ScalingOptions#ScalingOptions(int,DownscaleQuality,Object) docs.public void applyRenderingHints(Graphics2D g2)
g2 - A Graphics2D instance on which scaled images will be rendered.protected Map getRenderingHints()
Graphics2D.setRenderingHints(java.util.Map).
By default, this will only include the interpolation hint specified for this ScalingOptions. Other hints
could be added in a overridden version in a subclass.
public boolean sizeMatches(int w,
int h)
w - an image widthh - an image height
public boolean sizeMatches(Image img)
img -
public int getTargetWidth()
public int getTargetHeight()
public void setTargetWidth(int targetWidth)
public void setTargetHeight(int targetHeight)
public void setTargetDimensions(Dimension dim)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||