PngCs  1.1.4
A C# library for read/write PNG images
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
Hjg.Pngcs.Chunks.PngChunk Class Referenceabstract

Represents a instance of a PNG chunk More...

Inherited by Hjg.Pngcs.Chunks.PngChunkMultiple, Hjg.Pngcs.Chunks.PngChunkSingle, and Hjg.Pngcs.Chunks.PngChunkSkipped.

Public Types

enum  ChunkOrderingConstraint {
  NONE, BEFORE_PLTE_AND_IDAT, AFTER_PLTE_BEFORE_IDAT, BEFORE_IDAT,
  NA
}
 Restrictions for chunk ordering, for ancillary chunks More...
 

Public Member Functions

ChunkRaw createEmptyChunk (int len, bool alloc)
 
override String ToString ()
 Basic info: Id, length, Type name
 
abstract ChunkRaw CreateRawChunk ()
 Serialization. Creates a Raw chunk, ready for write, from this chunk content
 
abstract void ParseFromRaw (ChunkRaw c)
 Deserialization. Given a Raw chunk, just rad, fills this chunk content
 
abstract void CloneDataFromRead (PngChunk other)
 Override to make a copy (normally deep) from other chunk
 
abstract bool AllowsMultiple ()
 This is implemented in PngChunkMultiple/PngChunSingle
 
abstract ChunkOrderingConstraint GetOrderingConstraint ()
 Get ordering constrain
 

Static Public Member Functions

static void FactoryRegister (String chunkId, Type type)
 Registers a Chunk ID in the factory, to instantiate a given type
 
static T CloneChunk< T > (T chunk, ImageInfo info)
 

Public Attributes

readonly String Id
 4 letters. The Id almost determines the concrete type (except for PngUKNOWN)
 
readonly bool Crit
 Standard basic properties, implicit in the Id
 

Protected Member Functions

 PngChunk (String id, ImageInfo imgInfo)
 Constructs an empty chunk
 

Protected Attributes

readonly ImageInfo ImgInfo
 Image basic info, mostly for some checks
 

Properties

bool Priority [get, set]
 For writing. Queued chunks with high priority will be written as soon as possible
 
int ChunkGroup [get, set]
 Chunk group where it was read or writen
 
int Length [get, set]
 
long Offset [get, set]
 

Detailed Description

Represents a instance of a PNG chunk

Concrete classes should extend PngChunkSingle or PngChunkMultiple

Note that some methods/fields are type-specific (GetOrderingConstraint(), AllowsMultiple()) some are 'almost' type-specific (Id,Crit,Pub,Safe; the exception is PngUKNOWN), and some are instance-specific

Ref: http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html

Member Enumeration Documentation

Restrictions for chunk ordering, for ancillary chunks

Enumerator:
NONE 

No constraint, the chunk can go anywhere

BEFORE_PLTE_AND_IDAT 

Before PLTE (palette) - and hence, also before IDAT

AFTER_PLTE_BEFORE_IDAT 

After PLTE (palette), but before IDAT

BEFORE_IDAT 

Before IDAT (before or after PLTE)

NA 

Does not apply

Constructor & Destructor Documentation

Hjg.Pngcs.Chunks.PngChunk.PngChunk ( String  id,
ImageInfo  imgInfo 
)
protected

Constructs an empty chunk

Parameters
id
imgInfo

Member Function Documentation

static void Hjg.Pngcs.Chunks.PngChunk.FactoryRegister ( String  chunkId,
Type  type 
)
static

Registers a Chunk ID in the factory, to instantiate a given type

This can be called by client code to register additional chunk types

Parameters
chunkId
typeshould extend PngChunkSingle or PngChunkMultiple
ChunkRaw Hjg.Pngcs.Chunks.PngChunk.createEmptyChunk ( int  len,
bool  alloc 
)
static T Hjg.Pngcs.Chunks.PngChunk.CloneChunk< T > ( chunk,
ImageInfo  info 
)
static
Type Constraints
T :PngChunk 
override String Hjg.Pngcs.Chunks.PngChunk.ToString ( )

Basic info: Id, length, Type name

Returns
abstract ChunkRaw Hjg.Pngcs.Chunks.PngChunk.CreateRawChunk ( )
pure virtual
abstract void Hjg.Pngcs.Chunks.PngChunk.ParseFromRaw ( ChunkRaw  c)
pure virtual
abstract void Hjg.Pngcs.Chunks.PngChunk.CloneDataFromRead ( PngChunk  other)
pure virtual
abstract bool Hjg.Pngcs.Chunks.PngChunk.AllowsMultiple ( )
pure virtual

This is implemented in PngChunkMultiple/PngChunSingle

Returns
Allows more than one chunk of this type in a image

Implemented in Hjg.Pngcs.Chunks.PngChunkMultiple, Hjg.Pngcs.Chunks.PngChunkSingle, and Hjg.Pngcs.Chunks.PngChunkSkipped.

abstract ChunkOrderingConstraint Hjg.Pngcs.Chunks.PngChunk.GetOrderingConstraint ( )
pure virtual

Member Data Documentation

readonly String Hjg.Pngcs.Chunks.PngChunk.Id

4 letters. The Id almost determines the concrete type (except for PngUKNOWN)

readonly bool Hjg.Pngcs.Chunks.PngChunk.Crit

Standard basic properties, implicit in the Id

readonly ImageInfo Hjg.Pngcs.Chunks.PngChunk.ImgInfo
protected

Image basic info, mostly for some checks

Property Documentation

bool Hjg.Pngcs.Chunks.PngChunk.Priority
getset

For writing. Queued chunks with high priority will be written as soon as possible

int Hjg.Pngcs.Chunks.PngChunk.ChunkGroup
getset

Chunk group where it was read or writen

int Hjg.Pngcs.Chunks.PngChunk.Length
getset
long Hjg.Pngcs.Chunks.PngChunk.Offset
getset