Class TgaDecoder

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

public class TgaDecoder extends Object implements StbDecoder
TGA decoder supporting uncompressed and RLE compressed, grayscale and color.
  • Constructor Details

    • TgaDecoder

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

    • getAllocator

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

      public static boolean isTga(ByteBuffer src)
      Performs a lightweight TGA probe.
      Parameters:
      src - source bytes
      Returns:
      true when the source can be considered a potential TGA payload
    • 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