Class PnmDecoder

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

public class PnmDecoder extends Object implements StbDecoder
PNM decoder for PPM/PGM (binary), including 16-bit.
  • Constructor Details

    • PnmDecoder

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

    • isPnm

      public static boolean isPnm(ByteBuffer buffer)
      Tests whether the source starts with a supported PNM magic value.
      Parameters:
      buffer - source bytes
      Returns:
      true when signature is a supported PNM variant
    • getAllocator

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

      public StbImageInfo info()
      Reads image metadata without fully decoding pixel data.
      Specified by:
      info in interface StbDecoder
      Returns:
      image information
    • 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