Package VASSAL.tools.image
Class ImageUtils
java.lang.Object
VASSAL.tools.image.ImageUtils
public class ImageUtils extends Object
-
Field Summary
Fields Modifier and Type Field Description protected static BufferedImagecompatOpaqueImageprotected static intcompatOpaqueImageTypeprotected static BufferedImagecompatTransImageprotected static intcompatTranslImageTypestatic StringGIF_SUFFIXstatic String[]IMAGE_SUFFIXESstatic StringJPEG_SUFFIXstatic StringJPG_SUFFIXstatic BufferedImageNULL_IMAGEstatic StringPNG_SUFFIXstatic StringSVG_SUFFIX -
Method Summary
Modifier and Type Method Description static BufferedImagecoerceToIntType(BufferedImage img)static BufferedImagecreateCompatibleImage(int w, int h)static BufferedImagecreateCompatibleImage(int w, int h, boolean transparent)static BufferedImagecreateCompatibleTranslucentImage(int w, int h)static ImageforceLoad(Image img)static RectanglegetBounds(Dimension d)static RectanglegetBounds(BufferedImage im)static intgetCompatibleImageType()static intgetCompatibleImageType(boolean transparent)static intgetCompatibleImageType(BufferedImage img)static intgetCompatibleTranslucentImageType()static RenderingHintsgetDefaultHints()static BufferedImagegetImage(InputStream in)Deprecated, for removal: This API element is subject to removal in a future version.static BufferedImagegetImage(String name, InputStream in)static BufferedImagegetImageResource(String name)static DimensiongetImageSize(InputStream in)Deprecated, for removal: This API element is subject to removal in a future version.UsegetImageSize(String,InputStream)instead.static DimensiongetImageSize(String name, InputStream in)static booleanhasImageSuffix(String name)static booleanisCompatibleImage(BufferedImage img)static booleanisTransparent(Image img)static booleanisTransparent(BufferedImage img)static voidsetHighQualityScaling(boolean b)Deprecated, for removal: This API element is subject to removal in a future version.All scaling is done with the high-quality scaler now.static StringstripImageSuffix(String name)static BufferedImagetoBufferedImage(Image src)Transform anImageto aBufferedImage.static BufferedImagetoCompatibleImage(BufferedImage src)static BufferedImagetoType(BufferedImage src, int type)static BufferedImagetransform(BufferedImage src, double scale, double angle)static BufferedImagetransform(BufferedImage src, double scale, double angle, RenderingHints hints)static BufferedImagetransform(BufferedImage src, double scale, double angle, RenderingHints hints, int quality)Deprecated, for removal: This API element is subject to removal in a future version.static Rectangletransform(Rectangle srect, double scale, double angle)
-
Field Details
-
compatOpaqueImage
-
compatTransImage
-
compatOpaqueImageType
protected static final int compatOpaqueImageType -
compatTranslImageType
protected static final int compatTranslImageType -
NULL_IMAGE
-
GIF_SUFFIX
- See Also:
- Constant Field Values
-
PNG_SUFFIX
- See Also:
- Constant Field Values
-
SVG_SUFFIX
- See Also:
- Constant Field Values
-
JPG_SUFFIX
- See Also:
- Constant Field Values
-
JPEG_SUFFIX
- See Also:
- Constant Field Values
-
IMAGE_SUFFIXES
-
-
Method Details
-
setHighQualityScaling
@Deprecated(since="2020-08-06", forRemoval=true) public static void setHighQualityScaling(boolean b)Deprecated, for removal: This API element is subject to removal in a future version.All scaling is done with the high-quality scaler now. -
getDefaultHints
-
transform
-
transform
-
transform
public static BufferedImage transform(BufferedImage src, double scale, double angle, RenderingHints hints) -
transform
@Deprecated(since="2020-08-06", forRemoval=true) public static BufferedImage transform(BufferedImage src, double scale, double angle, RenderingHints hints, int quality)Deprecated, for removal: This API element is subject to removal in a future version. -
coerceToIntType
-
getBounds
- Parameters:
im- Image- Returns:
- the boundaries of this image, where (0,0) is the pseudo-center of the image
-
getBounds
-
getImageSize
@Deprecated(since="2020-08-06", forRemoval=true) public static Dimension getImageSize(InputStream in) throws IOExceptionDeprecated, for removal: This API element is subject to removal in a future version.UsegetImageSize(String,InputStream)instead.- Throws:
IOException
-
getImageSize
- Throws:
ImageIOException
-
getImage
@Deprecated(since="2020-08-06", forRemoval=true) public static BufferedImage getImage(InputStream in) throws IOExceptionDeprecated, for removal: This API element is subject to removal in a future version.UsegetImage(String,InputStream)instead.- Throws:
IOException
-
getImageResource
- Throws:
ImageIOException
-
getImage
- Throws:
ImageIOException
-
toType
-
forceLoad
-
isTransparent
-
isTransparent
-
toBufferedImage
Transform anImageto aBufferedImage.- Parameters:
src- theImageto transform
-
getCompatibleImageType
public static int getCompatibleImageType() -
getCompatibleTranslucentImageType
public static int getCompatibleTranslucentImageType() -
getCompatibleImageType
public static int getCompatibleImageType(boolean transparent) -
getCompatibleImageType
-
createCompatibleImage
-
createCompatibleImage
-
createCompatibleTranslucentImage
-
toCompatibleImage
-
isCompatibleImage
-
hasImageSuffix
-
stripImageSuffix
-
getImage(String,InputStream)instead.