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 BufferedImage
compatOpaqueImage
protected static int
compatOpaqueImageType
protected static BufferedImage
compatTransImage
protected static int
compatTranslImageType
static String
GIF_SUFFIX
static String[]
IMAGE_SUFFIXES
static String
JPEG_SUFFIX
static String
JPG_SUFFIX
static BufferedImage
NULL_IMAGE
static String
PNG_SUFFIX
static String
SVG_SUFFIX
-
Method Summary
Modifier and Type Method Description static BufferedImage
coerceToIntType(BufferedImage img)
static BufferedImage
createCompatibleImage(int w, int h)
static BufferedImage
createCompatibleImage(int w, int h, boolean transparent)
static BufferedImage
createCompatibleTranslucentImage(int w, int h)
static Image
forceLoad(Image img)
static Rectangle
getBounds(Dimension d)
static Rectangle
getBounds(BufferedImage im)
static int
getCompatibleImageType()
static int
getCompatibleImageType(boolean transparent)
static int
getCompatibleImageType(BufferedImage img)
static int
getCompatibleTranslucentImageType()
static RenderingHints
getDefaultHints()
static BufferedImage
getImage(InputStream in)
Deprecated, for removal: This API element is subject to removal in a future version.static BufferedImage
getImage(String name, InputStream in)
static BufferedImage
getImageResource(String name)
static Dimension
getImageSize(InputStream in)
Deprecated, for removal: This API element is subject to removal in a future version.UsegetImageSize(String,InputStream)
instead.static Dimension
getImageSize(String name, InputStream in)
static boolean
hasImageSuffix(String name)
static boolean
isCompatibleImage(BufferedImage img)
static boolean
isTransparent(Image img)
static boolean
isTransparent(BufferedImage img)
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.static String
stripImageSuffix(String name)
static BufferedImage
toBufferedImage(Image src)
Transform anImage
to aBufferedImage
.static BufferedImage
toCompatibleImage(BufferedImage src)
static BufferedImage
toType(BufferedImage src, int type)
static BufferedImage
transform(BufferedImage src, double scale, double angle)
static BufferedImage
transform(BufferedImage src, double scale, double angle, RenderingHints hints)
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.static Rectangle
transform(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 anImage
to aBufferedImage
.- Parameters:
src
- theImage
to 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.