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 Details

    • info

      StbImageInfo info()
      Reads image metadata without fully decoding pixel data.
      Returns:
      image information
    • load

      StbImageResult load(int desiredChannels)
      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

      default StbImageResult load16(int desiredChannels)
      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

      default StbImageResult loadf(int desiredChannels)
      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

      default StbImageResult loadNextFrame(int desiredChannels)
      Loads the next frame for animated formats. For non-animated formats, this is equivalent to load(int).
      Parameters:
      desiredChannels -
      Returns:
    • loadAllFrames

      default List<StbImageResult> loadAllFrames(int desiredChannels)
      Loads all frames for animated formats. For non-animated formats, this returns a singleton list with the same result as load(int).
      Parameters:
      desiredChannels -
      Returns: