Skip to content

ImageUtils

final class ImageUtils
Package: dev.joid.lib.utils.image · Module: core · Source: ImageUtils.java

Decodes an image with a chosen reader and prepares pixels with transparent areas for filtering.

The image decoders of JOID use it; a decoder of your own can too.

ReturnsSignatureSummary
BufferedImageread(InputStream stream, ImageReaderSpi spi) staticDecodes the first image of stream with the ImageIO reader of spi.
voidbleedAlpha(int[] pixels, int width, int height) staticGives each fully transparent pixel of pixels (ARGB, width × height, row after row) the color of the nearest pixel that is not, and keeps its alpha at 0.

BufferedImage read(InputStream stream, ImageReaderSpi spi) static

Decodes the first image of stream with the ImageIO reader of spi. Throws an IOException when the stream cannot be read or decoded.

void bleedAlpha(int[] pixels, int width, int height) static

Gives each fully transparent pixel of pixels (ARGB, width × height, row after row) the color of the nearest pixel that is not, and keeps its alpha at 0. A filtered texture then shows no dark fringe around its transparent areas; an image fully opaque or fully transparent stays unchanged.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page