Skip to content

RasterResourceDecoder

class RasterResourceDecoder
Implements: IResourceDecoder
Package: dev.joid.lib.resource.decoder.impl · Module: core · Source: RasterResourceDecoder.java

Decodes a still image, PNG, JPEG, BMP, still WebP and the other formats of the bundled image readers, into one texture.

ResourceFormat picks it for any file that no other format recognizes. The transparent pixels take the color of their opaque neighbours, so that the edges of a scaled image do not darken.

ReturnsSignatureSummary
RasterResourceDecodercreate(Asset asset) factoryCreates a decoder that reads asset with the image readers of the JVM.
RasterResourceDecodercreate(BufferedImage image) factoryCreates a decoder of an image already in memory, such as one drawn with Java2D.
RasterResourceDecodercreate(Asset asset, ImageReaderSpi reader) factoryCreates a decoder that reads asset with reader.
RasterResourceDecoder(Asset asset, BufferedImage source, ImageReaderSpi reader) protectedCreates the decoder, for a subclass; give either an asset or an image.

ReturnsSignatureSummary
voidprepare(ResourceData resource)Gives the data a transparent placeholder texture until the image is decoded.
voiddecode(ResourceData resource)Reads the image and sets the size and the pixels of the data.
voidupload(ResourceData resource)Uploads the pixels into the texture.
ReturnsSignatureSummary
voidclear(ResourceData resource) hookHolds nothing to free; a subclass that holds more frees it there.
Inherited from IResourceDecoder (3)

fork · isSettled · isMipmappable

RasterResourceDecoder create(Asset asset) factory

Creates a decoder that reads asset with the image readers of the JVM.

RasterResourceDecoder create(BufferedImage image) factory

Creates a decoder of an image already in memory, such as one drawn with Java2D.

RasterResourceDecoder create(Asset asset, ImageReaderSpi reader) factory

Creates a decoder that reads asset with reader.

RasterResourceDecoder(Asset asset, BufferedImage source, ImageReaderSpi reader) protected

Creates the decoder, for a subclass; give either an asset or an image.

void prepare(ResourceData resource)

Gives the data a transparent placeholder texture until the image is decoded.

void decode(ResourceData resource)

Reads the image and sets the size and the pixels of the data. Throws UncheckedIOException when the asset cannot be read, and IllegalArgumentException when no reader can decode it.

void upload(ResourceData resource)

Uploads the pixels into the texture.

void clear(ResourceData resource) hook

Holds nothing to free; a subclass that holds more frees it there.


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