Class ImageUtil.HighQualityScaler

java.lang.Object
org.xhtmlrenderer.util.ImageUtil.HighQualityScaler
All Implemented Interfaces:
ImageUtil.Scaler
Enclosing class:
ImageUtil

private static class ImageUtil.HighQualityScaler extends Object implements ImageUtil.Scaler
Step-wise downscaling
  • Constructor Details

    • HighQualityScaler

      private HighQualityScaler()
  • Method Details

    • getScaledInstance

      @CheckReturnValue public BufferedImage getScaledInstance(BufferedImage img, ScalingOptions opt)
      Description copied from interface: ImageUtil.Scaler
      Convenience method that returns a scaled instance of the provided BufferedImage, 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 interface ImageUtil.Scaler
      Parameters:
      img - the original image to be scaled
      opt - scaling options described below: imageType type of image from BufferedImage (values starting with TYPE) hint one of the rendering hints that corresponds to RenderingHints.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, where targetWidth or targetHeight is smaller than the original dimensions, and generally only when the BILINEAR 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