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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
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. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
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. |
void | upload(ResourceData resource) | Uploads the pixels into the texture. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
void | clear(ResourceData resource) hook | Holds nothing to free; a subclass that holds more frees it there. |
Inherited from IResourceDecoder (3)
Creation details
Section titled “Creation details”create
Section titled “create”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
Section titled “RasterResourceDecoder”RasterResourceDecoder(Asset asset, BufferedImage source, ImageReaderSpi reader) protected
Creates the decoder, for a subclass; give either an asset or an image.
Method details
Section titled “Method details”prepare
Section titled “prepare”void prepare(ResourceData resource)
Gives the data a transparent placeholder texture until the image is decoded.
decode
Section titled “decode”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.
upload
Section titled “upload”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
