bufferedImageFromImage
bufferedImageFromImage: (Image) -> BufferedImageThe image itself: every Bento image is already a BufferedImage.
| Method | Returns | Description |
|---|---|---|
bufferedImageFromImage(Image) | BufferedImage | The image itself: every Bento image is already a BufferedImage. |
toARGB(Image) | BufferedImage | The image itself when its type is TYPE_INT_ARGB, else a TYPE_INT_ARGB image it is drawn into (a decoded PNG, a premultiplied or 4-byte… |
recolorImage(Image, Color) | BufferedImage | Every pixel color, keeping its alpha. |
luminanceOffset(Image, number) | BufferedImage | offset added to red, green and blue, clamped. |
luminanceScale(Image, number) | BufferedImage | Red, green and blue scaled by percentage, clamped. |
alphaOffset(Image, number) | BufferedImage | (Image, number) -> BufferedImage: offset added to alpha, clamped. The two overloads are told apart by the number: a whole number (50,… |
grayscaleImage(BufferedImage) | BufferedImage | A greyed copy, as Swing's disabled icons (GrayFilter, brighter, 50%). |
resizeImage(BufferedImage, number, number) | BufferedImage | (BufferedImage, number, number) -> BufferedImage: A smoothly scaled (area-averaged) copy of the given size. |
resizeImage(BufferedImage, number, number, boolean) | BufferedImage | |
resizeCanvas(BufferedImage, number, number) | BufferedImage | The image centred on a transparent canvas of the given size. |
rotateImage(BufferedImage, number) | BufferedImage | The image rotated theta radians about its centre, on a canvas the size of its rotated bounds, of the image's type when that has alpha (`T… |
flipImage(BufferedImage, boolean, boolean) | BufferedImage | A mirrored copy. |
outlineImage(BufferedImage, Color) | BufferedImage | (BufferedImage, Color) -> BufferedImage: The image with a one-pixel color outline, corners left out. |
outlineImage(BufferedImage, Color, boolean) | BufferedImage | |
fillImage(BufferedImage, Color) | BufferedImage | Every non-transparent pixel color. |
loadImageResource(any?, string) | BufferedImage? | An image resource: path resolved against the class c. A relative path with the plugin's own class (pass the plugin object, a panel, or… |
getImageSpritePixels(BufferedImage, Client) | SpritePixels | The image as SpritePixels: its ARGB pixels, every fully transparent one 0. Pass the client global. |
getImageIndexedSprite(BufferedImage, Client) | IndexedSprite | The image as an IndexedSprite (a chat icon for client:getModIcons()): a palette of its fully opaque colours after an unused entry 0, ev… |
fromBytes(string) | BufferedImage? | The image encoded in data (a byte string, e.g. an HTTP body or Asset.bytes), or nil when it is not one, with the type and samples `lo… |
bufferedImageFromImagebufferedImageFromImage: (Image) -> BufferedImageThe image itself: every Bento image is already a BufferedImage.
toARGBtoARGB: (Image) -> BufferedImageThe image itself when its type is TYPE_INT_ARGB, else a TYPE_INT_ARGB image it is drawn into (a decoded PNG, a premultiplied or 4-byte ABGR image): a transparent pixel comes out 0 and a faint pixel's colour is rounded.
recolorImagerecolorImage: (Image, Color) -> BufferedImageEvery pixel color, keeping its alpha.
luminanceOffsetluminanceOffset: (Image, number) -> BufferedImageoffset added to red, green and blue, clamped.
luminanceScaleluminanceScale: (Image, number) -> BufferedImageRed, green and blue scaled by percentage, clamped.
alphaOffsetalphaOffset: (Image, number) -> BufferedImage(Image, number) -> BufferedImage: offset added to alpha, clamped. The two overloads are told apart by the number: a whole number (50, and also 1.0) is this one.
(Image, number) -> BufferedImage: Alpha scaled by percentage, clamped. Reached with a fractional number (0.5); a whole number reaches the int overload.
grayscaleImagegrayscaleImage: (BufferedImage) -> BufferedImageA greyed copy, as Swing's disabled icons (GrayFilter, brighter, 50%).
resizeImageresizeImage: ((BufferedImage, number, number) -> BufferedImage) & ((BufferedImage, number, number, boolean) -> BufferedImage)(BufferedImage, number, number) -> BufferedImage: A smoothly scaled (area-averaged) copy of the given size.
(BufferedImage, number, number, boolean) -> BufferedImage: A smoothly scaled copy; with preserveAspectRatio, the longer side fits and the other keeps the ratio.
resizeCanvasresizeCanvas: (BufferedImage, number, number) -> BufferedImageThe image centred on a transparent canvas of the given size.
rotateImagerotateImage: (BufferedImage, number) -> BufferedImageThe image rotated theta radians about its centre, on a canvas the size of its rotated bounds, of the image's type when that has alpha (TYPE_4BYTE_ABGR for an RGBA PNG), else TYPE_INT_ARGB.
flipImageflipImage: (BufferedImage, boolean, boolean) -> BufferedImageA mirrored copy.
outlineImageoutlineImage: ((BufferedImage, Color) -> BufferedImage) & ((BufferedImage, Color, boolean) -> BufferedImage)(BufferedImage, Color) -> BufferedImage: The image with a one-pixel color outline, corners left out.
(BufferedImage, Color, boolean) -> BufferedImage: The image with a one-pixel color outline, corners included when outlineCorners.
fillImagefillImage: (BufferedImage, Color) -> BufferedImageEvery non-transparent pixel color.
loadImageResourceloadImageResource: (any?, string) -> BufferedImage?An image resource: path resolved against the class c. A relative path with the plugin's own class (pass the plugin object, a panel, or nil) is the plugin's package, whose resources are its assets/ folder: notes_icon.png reads assets/notes_icon.png (then the package root, so assets/notes_icon.png also works). A relative path with a built-in class (AlternateSprites, ColorScheme, or one Bento has no global for, by its name as a string: "IconTextField") is the built-in resource in that class's package. /x.png is the resource root: the built-in shared resources first (/util/reset.png, /util/arrow_right.png, /skill_icons/attack.png), then the plugin's assets/x.png. A missing file is an IllegalArgumentException (x.png is not found); a file that is not a PNG is nil (Bento decodes PNG only). The image's getType() is what the PNG decodes to (TYPE_4BYTE_ABGR for an RGBA PNG, TYPE_CUSTOM for grey and alpha), and a grey PNG's samples are answered through the grey curve (a sample of 98 is 167).
getImageSpritePixelsgetImageSpritePixels: (BufferedImage, Client) -> SpritePixelsThe image as SpritePixels: its ARGB pixels, every fully transparent one 0. Pass the client global.
getImageIndexedSpritegetImageIndexedSprite: (BufferedImage, Client) -> IndexedSpriteThe image as an IndexedSprite (a chat icon for client:getModIcons()): a palette of its fully opaque colours after an unused entry 0, every other pixel transparent (index 0), its sizes, no offsets. Opaque black finds the unused entry 0, so it is transparent. More than 255 colours raises. Pass the client global.
fromBytesfromBytes: (string) -> BufferedImage?The image encoded in data (a byte string, e.g. an HTTP body or Asset.bytes), or nil when it is not one, with the type and samples loadImageResource gives. Bento decodes PNG only.