PNG

Represents the PNG file's data. This struct is intended to be passed around by pointer.

Members

Aliases

header
deprecated alias header = magic

The PNG file magic number header. Please note the image data header is a IHDR chunk, not this (see getHeader for that). This just a static identifier

Functions

getChunk
Chunk* getChunk(string what)

Gets the chunk with the given name, or throws if it cannot be found.

getChunkNullable
Chunk* getChunkNullable(string what)

Gets the chunk with the given name, return null if it is not found.

insertChunk
bool insertChunk(Chunk* chk, bool replaceExisting)

Insert chunk before IDAT. PNG specs allows to drop all chunks after IDAT, so we have to insert our custom chunks right before it. Use Chunk.create() to create new chunk, and then insertChunk() to add it. Return true if we did replacement.

replaceChunk
bool replaceChunk(Chunk* chk)

Convenient wrapper for insertChunk().

Variables

chunks
Chunk[] chunks;

The array of chunks that make up the file contents. See getChunkNullable, getChunk, insertChunk, and replaceChunk for functions to access and manipulate this array.

length
uint length;

The length of the file.

magic
ubyte[8] magic;

The PNG file magic number header. Please note the image data header is a IHDR chunk, not this (see getHeader for that). This just a static identifier

Meta