Class AwtXbrz

java.lang.Object
io.github.stanio.xbrz.awt.AwtXbrz

public final class AwtXbrz extends Object
AWT image resizing functions using xBRZ.
See Also:
  • Method Details

    • scaleImage

      public static BufferedImage scaleImage(ImageData source, int factor)
    • scaleImage

      public static BufferedImage scaleImage(ImageData source, int factor, boolean untrackedData)
      Scales the given pixel data by the specified factor.

      The untrackedData parameter controls whether the result image will be backed by a tracked data buffer or not. Having a tracked data buffer will likely benefit on-screen display performance, while it may incur some initialization slow down. If you only need to process images off screen, f.e. read a source image, scale it, and save the result, then you may specify untracked = true to save up on result initialization cost.

      Parameters:
      source - ...
      factor - ...
      untrackedData - ...
      Returns:
      ...
      See Also:
    • scaleImage

      public static Image scaleImage(Image base, int factor)
      Scales the given base image by the given factor.

      If the given image is static, the result is a BufferedImage.

      If the given image is animated, the result is a Toolkit created image using filtered source, like:

       Image base;
       ...
       int factor = 2;
       BufferedImageFilter xbrzFilter = new BufferedImageFilter(new XbrzOp(factor));
       Image scaled = Toolkit.getDefaultToolkit()
               .createImage(new FilteredImageSource(base.getSource(), xbrzFilter));
      Parameters:
      base - ...
      factor - ...
      Returns:
      ...
    • scaleImage

      public static BufferedImage scaleImage(BufferedImage source, int factor)
    • scaleImage

      public static Image scaleImage(Image source, int targetWidth, int targetHeight)
      Scales the given image to the given exact target dimensions.

      The image is first upscaled using xBRZ, then smoothly downscaled as necessary.

      As with scaleImage(source, factor) this will produce a BufferedImage if the source image is static, or toolkit created image if the source is animated.

      Parameters:
      source - ...
      targetWidth - ...
      targetHeight - ...
      Returns:
      ...
      See Also: