TPNGImage help

TPNGImage

Unit methods > RegisterChunk


Registers this chunk class with TPNGObject.

type TChunkClass = class of TChunk;
procedure
RegisterChunk(ChunkClass: TChunkClass);

Description
Use RegisterChunk method to register a new class using TChunk as it's ancestor. The method will use the last four letters from the chunk name as the chunk name (Or you may also set fName variable on the constructor). When the component reads a chunk using the same name as a registered chunk it will use LoadFromStream method to load the data and SaveToStream when saving.

If you intend to create new chunk classes you must call this method before loading or saving image using TPngObject. See example 2 to see an example registering a new chunk class.