Package org.xhtmlrenderer.util
Class ImageUtil.HighQualityScaler
java.lang.Object
org.xhtmlrenderer.util.ImageUtil.HighQualityScaler
- All Implemented Interfaces:
ImageUtil.Scaler
- Enclosing class:
ImageUtil
@ParametersAreNonnullByDefault
private static class ImageUtil.HighQualityScaler
extends Object
implements ImageUtil.Scaler
Step-wise downscaling
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetScaledInstance
(BufferedImage img, ScalingOptions opt) Convenience method that returns a scaled instance of the providedBufferedImage
, taken from article on java.net by Chris Campbell.
-
Constructor Details
-
HighQualityScaler
private HighQualityScaler()
-
-
Method Details
-
getScaledInstance
@Nonnull @CheckReturnValue public BufferedImage getScaledInstance(BufferedImage img, ScalingOptions opt) Description copied from interface:ImageUtil.Scaler
Convenience method that returns a scaled instance of the providedBufferedImage
, taken from article on java.net by Chris Campbell.
Expects the image to be fully loaded (e.g. no need to wait for loading on requesting height or width)- Specified by:
getScaledInstance
in interfaceImageUtil.Scaler
- Parameters:
img
- the original image to be scaledopt
- scaling options described below: imageType type of image fromBufferedImage
(values starting with TYPE) hint one of the rendering hints that corresponds toRenderingHints.KEY_INTERPOLATION
(e.g.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR
,RenderingHints.VALUE_INTERPOLATION_BILINEAR
,RenderingHints.VALUE_INTERPOLATION_BICUBIC
) higherQuality if true, this method will use a multistep scaling technique that provides higher quality than the usual one-step technique (only useful in downscaling cases, wheretargetWidth
ortargetHeight
is smaller than the original dimensions, and generally only when theBILINEAR
hint is specified) targetWidth the desired width of the scaled instance, in pixels targetHeight the desired height of the scaled instance, in pixels- Returns:
- a scaled version of the original
BufferedImage
-