Package org.ngengine.stbimage
Class PnmDecoder
java.lang.Object
org.ngengine.stbimage.PnmDecoder
- All Implemented Interfaces:
StbDecoder
PNM decoder for PPM/PGM (binary), including 16-bit.
-
Constructor Summary
ConstructorsConstructorDescriptionPnmDecoder(ByteBuffer buffer, IntFunction<ByteBuffer> allocator, boolean flipVertically) Creates a PNM decoder instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the allocator used by this decoder for output buffers.info()Reads image metadata without fully decoding pixel data.static booleanisPnm(ByteBuffer buffer) Tests whether the source starts with a supported PNM magic value.load(int desiredChannels) Decodes image pixels.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ngengine.stbimage.StbDecoder
load16, loadAllFrames, loadf, loadNextFrame
-
Constructor Details
-
PnmDecoder
Creates a PNM decoder instance.- Parameters:
buffer- source dataallocator- output allocatorflipVertically- true to vertically flip decoded output
-
-
Method Details
-
isPnm
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
Returns the allocator used by this decoder for output buffers.- Specified by:
getAllocatorin interfaceStbDecoder- Returns:
- allocator function
-
info
Reads image metadata without fully decoding pixel data.- Specified by:
infoin interfaceStbDecoder- Returns:
- image information
-
load
Decodes image pixels.- Specified by:
loadin interfaceStbDecoder- Parameters:
desiredChannels- requested output channels (0 keeps source/default behavior)- Returns:
- decoded image result
-