public final class ImageExtensions extends Object
Contains extension methods for conversions based on System.Drawing.Image
and Image
.
Modifier and Type | Method and Description |
---|---|
static RasterImage |
fromJava(BufferedImage image)
Converts the
BufferedImage to the PngImage . |
static RasterImage |
fromJava(BufferedImage image,
Rectangle rect)
Converts the
BufferedImage to the PngImage . |
static BufferedImage |
toJava(Image image)
Converts the
Image to the BufferedImage with TYPE_INT_ARGB. |
static BufferedImage |
toJava(Image image,
int bufferedImageType)
Converts the
Image to the BufferedImage with bufferedImageType. |
static BufferedImage |
toJava(Image image,
Rectangle subImageRect)
Takes the subimage from
Image and converts to the BufferedImage with BufferedImage.TYPE_INT_ARGB. |
static BufferedImage |
toJava(Image image,
Rectangle subImageRect,
int bufferedImageType)
Takes the subimage from
Image and converts to the BufferedImage with bufferedImageType. |
public static RasterImage fromJava(BufferedImage image, Rectangle rect)
Converts the BufferedImage
to the PngImage
.
image
has. To get all parts of the image use more safe extension method ToGdiImageFull.image
- The BufferedImage
to convert.rect
- The required rectangle.PngImage
.public static RasterImage fromJava(BufferedImage image)
Converts the BufferedImage
to the PngImage
.
image
- The BufferedImage
to convert.PngImage
.public static BufferedImage toJava(Image image)
Converts the Image
to the BufferedImage
with TYPE_INT_ARGB.
image
- The Image
to convert.BufferedImage
.BufferedImage.TYPE_INT_ARGB
public static BufferedImage toJava(Image image, int bufferedImageType)
Converts the Image
to the BufferedImage
with bufferedImageType.
Please choose bufferedImageType
from java.awt.image.BufferedImage#TYPE_****
image
- The Image
to convert.BufferedImage
.public static BufferedImage toJava(Image image, Rectangle subImageRect)
Takes the subimage from Image
and converts to the BufferedImage
with BufferedImage.TYPE_INT_ARGB.
image
- The Image
to convert.subImageRect
- The rectangle of subimage to convert.BufferedImage
contains subimage taken from Image
.BufferedImage.TYPE_INT_ARGB
public static BufferedImage toJava(Image image, Rectangle subImageRect, int bufferedImageType)
Takes the subimage from Image
and converts to the BufferedImage
with bufferedImageType.
Please choose bufferedImageType
from java.awt.image.BufferedImage#TYPE_****
image
- The Image
to convert.subImageRect
- The rectangle of subimage to convert.BufferedImage
contains subimage taken from Image
.BufferedImage.TYPE_4BYTE_ABGR
,
BufferedImage.TYPE_BYTE_BINARY