public final class UtilityImage
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static ImageBuffer |
applyFilter(ImageBuffer image,
Filter filter)
Apply a filter to the input buffered image.
|
static ImageBuffer |
applyMask(ImageBuffer imageBuffer,
ColorRgba maskColor)
Apply color mask to image.
|
static Graphic |
createGraphic()
Create a graphic context.
|
static ImageBuffer |
createImageBuffer(int width,
int height,
Transparency transparency)
Create a compatible buffered image.
|
static Text |
createText(java.lang.String fontName,
int size,
TextStyle style)
Crate a text.
|
static int |
filterRGB(int rgb,
int fr,
int fg,
int fb)
Apply a filter rgb.
|
static ImageBuffer |
flipHorizontal(ImageBuffer image)
Apply an horizontal flip to the input image.
|
static ImageBuffer |
flipVertical(ImageBuffer image)
Apply a vertical flip to the input image.
|
static ImageBuffer |
getImageBuffer(ImageBuffer imageBuffer)
Get a buffered image from a buffered image.
|
static ImageBuffer |
getImageBuffer(Media media,
boolean alpha)
Get a buffered image from an image file.
|
static ImageBuffer |
getRasterBuffer(ImageBuffer image,
int fr,
int fg,
int fb,
int er,
int eg,
int eb,
int refSize)
Get raster buffer from data.
|
static int |
getRasterColor(int i,
int[] data,
int max)
Get raster color.
|
static int[][] |
loadRaster(Media media)
Load a raster data from a file.
|
static ImageBuffer |
resize(ImageBuffer image,
int width,
int height)
Resize input buffered image.
|
static ImageBuffer |
rotate(ImageBuffer image,
int angle)
Rotate input buffered image.
|
static void |
saveImage(ImageBuffer image,
Media media)
Save an image into a file.
|
static ImageBuffer[] |
splitImage(ImageBuffer image,
int row,
int col)
Split an image into an array of sub image (data not shared).
|
public static Text createText(java.lang.String fontName, int size, TextStyle style)
fontName
- The font name.size
- The font size (in pixel).style
- The font style.public static Graphic createGraphic()
public static ImageBuffer createImageBuffer(int width, int height, Transparency transparency)
width
- The image width (must be positive).height
- The image height (must be positive).transparency
- The transparency value.public static ImageBuffer getImageBuffer(Media media, boolean alpha)
media
- The image media path.alpha
- true
to enable alpha, false
else.public static ImageBuffer getImageBuffer(ImageBuffer imageBuffer)
imageBuffer
- input buffered image.public static ImageBuffer applyMask(ImageBuffer imageBuffer, ColorRgba maskColor)
imageBuffer
- The image buffer reference.maskColor
- The color mask.public static ImageBuffer[] splitImage(ImageBuffer image, int row, int col)
image
- The image to split.row
- The number of horizontal divisions.col
- The number of vertical divisions.public static ImageBuffer rotate(ImageBuffer image, int angle)
image
- The input buffered image.angle
- The angle to apply in degree (0-359)public static ImageBuffer resize(ImageBuffer image, int width, int height)
image
- The input buffered image.width
- The new width.height
- The new height.public static ImageBuffer flipHorizontal(ImageBuffer image)
image
- The input buffered image.public static ImageBuffer flipVertical(ImageBuffer image)
image
- The input buffered image.public static ImageBuffer applyFilter(ImageBuffer image, Filter filter)
image
- The input image.filter
- The filter to use.public static void saveImage(ImageBuffer image, Media media)
image
- The image to save.media
- The image output media path.public static int[][] loadRaster(Media media)
media
- The raster media path.public static int filterRGB(int rgb, int fr, int fg, int fb)
rgb
- The original rgb.fr
- The red filter.fg
- The green filter.fb
- The blue filter.public static int getRasterColor(int i, int[] data, int max)
i
- The color offset.data
- The raster data.max
- The max offset.public static ImageBuffer getRasterBuffer(ImageBuffer image, int fr, int fg, int fb, int er, int eg, int eb, int refSize)
image
- The buffer image.fr
- The first red.fg
- The first green.fb
- The first blue.er
- The end red.eg
- The end green.eb
- The end blue.refSize
- The reference size.