com.atlassian.core.util.thumbnail
Class MemoryImageScale
java.lang.Object
com.atlassian.core.util.thumbnail.MemoryImageScale
- All Implemented Interfaces:
- ImageScaler
public class MemoryImageScale
- extends Object
- implements ImageScaler
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MemoryImageScale
public MemoryImageScale(DimensionsHelper dimensionsHelper,
ImageFactory imageFactory)
scaleImage
public BufferedImage scaleImage(int maxWidth,
int maxHeight,
ReusableBufferedInputStream imageStream)
throws IOException
- Specified by:
scaleImage in interface ImageScaler
- Throws:
IOException
scaleImage
public static BufferedImage scaleImage(BufferedImage imageToScale,
Thumber.WidthHeightHelper newDimensions)
scaleImage
public static BufferedImage scaleImage(BufferedImage imageToScale,
Dimensions newDimensions)
getScaledInstance
public static BufferedImage getScaledInstance(BufferedImage image,
int targetWidth,
int targetHeight,
Object hint,
boolean higherQuality)
- Convenience method that returns a scaled instance of the provided
BufferedImage.
Borrowed from http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html
Warning: this algorith enters endless loop, when target size is bigger than image size and higherQuality is true
- Parameters:
image - the original image to be scaledtargetWidth - the desired width of the scaled instance, in pixelstargetHeight - the desired height of the scaled instance, in pixelshint - 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 multi-step 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)
- Returns:
- a scaled version of the original
BufferedImage
Copyright © 2015 Atlassian. All rights reserved.