Package org.ngengine.stbimage
Interface StbDecoder
- All Known Implementing Classes:
BmpDecoder,GifDecoder,HdrDecoder,JpegDecoder,PicDecoder,PngDecoder,PnmDecoder,PsdDecoder,TgaDecoder
public interface StbDecoder
Common decoder contract used by all image format implementations.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the allocator used by this decoder for output buffers.info()Reads image metadata without fully decoding pixel data.load(int desiredChannels) Decodes image pixels.default StbImageResultload16(int desiredChannels) Loads image data as 16-bit channels.default List<StbImageResult> loadAllFrames(int desiredChannels) Loads all frames for animated formats.default StbImageResultloadf(int desiredChannels) Loads image data as floating-point output for HDR-capable decoders.default StbImageResultloadNextFrame(int desiredChannels) Loads the next frame for animated formats.
-
Method Details
-
info
StbImageInfo info()Reads image metadata without fully decoding pixel data.- Returns:
- image information
-
load
Decodes image pixels.- Parameters:
desiredChannels- requested output channels (0 keeps source/default behavior)- Returns:
- decoded image result
-
getAllocator
IntFunction<ByteBuffer> getAllocator()Returns the allocator used by this decoder for output buffers.- Returns:
- allocator function
-
load16
Loads image data as 16-bit channels.If the underlying format natively decodes as 8-bit, this method upconverts by replicating 8-bit values into 16-bit (
v -> (v << 8) | v).- Parameters:
desiredChannels- requested output channels (0 keeps source/default behavior)- Returns:
- decoded 16-bit result
-
loadf
Loads image data as floating-point output for HDR-capable decoders.- Parameters:
desiredChannels- requested output channels (0 keeps source/default behavior)- Returns:
- decoded floating-point result
-
loadNextFrame
Loads the next frame for animated formats. For non-animated formats, this is equivalent toload(int).- Parameters:
desiredChannels-- Returns:
-
loadAllFrames
Loads all frames for animated formats. For non-animated formats, this returns a singleton list with the same result asload(int).- Parameters:
desiredChannels-- Returns:
-