Class BmpDecoder

java.lang.Object
org.ngengine.stbimage.BmpDecoder
All Implemented Interfaces:
StbDecoder

public class BmpDecoder extends Object implements StbDecoder
BMP decoder supporting 1/4/8/24/32-bit, uncompressed and RLE compressed.
  • Constructor Details

    • BmpDecoder

      public BmpDecoder(ByteBuffer buffer, IntFunction<ByteBuffer> allocator, boolean flipVertically)
      Creates a BMP decoder instance.
      Parameters:
      buffer - source data
      allocator - output allocator
      flipVertically - true to flip decoded rows
  • Method Details

    • isBmp

      public static boolean isBmp(ByteBuffer buffer)
      Tests if the buffer starts with BMP magic bytes.
      Parameters:
      buffer - source bytes
      Returns:
      true if BMP signature matches
    • info

      public StbImageInfo info()
      Reads image metadata without fully decoding pixel data.
      Specified by:
      info in interface StbDecoder
      Returns:
      image information
    • getAllocator

      public IntFunction<ByteBuffer> getAllocator()
      Returns the allocator used by this decoder for output buffers.
      Specified by:
      getAllocator in interface StbDecoder
      Returns:
      allocator function
    • load

      public StbImageResult load(int desiredChannels)
      Decodes image pixels.
      Specified by:
      load in interface StbDecoder
      Parameters:
      desiredChannels - requested output channels (0 keeps source/default behavior)
      Returns:
      decoded image result