PngCs  1.1.4
A C# library for read/write PNG images
Public Member Functions | Public Attributes | List of all members
Hjg.Pngcs.ImageInfo Class Reference

Simple immutable wrapper for basic image info More...

Public Member Functions

 ImageInfo (int cols, int rows, int bitdepth, bool alpha)
 Simple constructor: only for RGB/RGBA
 
 ImageInfo (int cols, int rows, int bitdepth, bool alpha, bool grayscale, bool palette)
 General Constructor
 
override String ToString ()
 General information, for debugging
 
override int GetHashCode ()
 
override bool Equals (Object obj)
 

Public Attributes

readonly int Cols
 Image width, in pixels
 
readonly int Rows
 Image height, in pixels
 
readonly int BitDepth
 Bits per sample (per channel) in the buffer.
 
readonly int Channels
 Number of channels, used in the buffer
 
readonly int BitspPixel
 Bits used for each pixel in the buffer
 
readonly int BytesPixel
 Bytes per pixel, rounded up
 
readonly int BytesPerRow
 Bytes per row, rounded up
 
readonly int SamplesPerRow
 Samples (scalar values) per row
 
readonly int SamplesPerRowPacked
 Number of values in our scanline, which might be packed.
 
readonly bool Alpha
 flag: has alpha channel
 
readonly bool Greyscale
 flag: is grayscale (G/GA)
 
readonly bool Indexed
 flag: has palette
 
readonly bool Packed
 flag: less than one byte per sample (bit depth 1-2-4)
 

Detailed Description

Simple immutable wrapper for basic image info

Some parameters are clearly redundant The constructor requires an 'ortogonal' subset http://www.w3.org/TR/PNG/#11IHDR

Constructor & Destructor Documentation

Hjg.Pngcs.ImageInfo.ImageInfo ( int  cols,
int  rows,
int  bitdepth,
bool  alpha 
)

Simple constructor: only for RGB/RGBA

Hjg.Pngcs.ImageInfo.ImageInfo ( int  cols,
int  rows,
int  bitdepth,
bool  alpha,
bool  grayscale,
bool  palette 
)

General Constructor

Parameters
colsWidth in pixels
rowsHeight in pixels
bitdepthBits per sample per channel
alphaHas alpha channel
grayscaleIs grayscale
paletteHas palette

Member Function Documentation

override String Hjg.Pngcs.ImageInfo.ToString ( )

General information, for debugging

Returns
Summary
override int Hjg.Pngcs.ImageInfo.GetHashCode ( )
override bool Hjg.Pngcs.ImageInfo.Equals ( Object  obj)

Member Data Documentation

readonly int Hjg.Pngcs.ImageInfo.Cols

Image width, in pixels

readonly int Hjg.Pngcs.ImageInfo.Rows

Image height, in pixels

readonly int Hjg.Pngcs.ImageInfo.BitDepth

Bits per sample (per channel) in the buffer.

This is 8 or 16 for RGB/ARGB images. For grayscale, it's 8 (or 1 2 4 ). For indexed images, number of bits per palette index (1 2 4 8). /remarks>

readonly int Hjg.Pngcs.ImageInfo.Channels

Number of channels, used in the buffer

WARNING: This is 3-4 for rgb/rgba, but 1 for palette/gray ! /remarks>

readonly int Hjg.Pngcs.ImageInfo.BitspPixel

Bits used for each pixel in the buffer

equals channels * bitDepth

readonly int Hjg.Pngcs.ImageInfo.BytesPixel

Bytes per pixel, rounded up

This is mainly for internal use (filter)

readonly int Hjg.Pngcs.ImageInfo.BytesPerRow

Bytes per row, rounded up

equals ceil(bitspp*cols/8)

readonly int Hjg.Pngcs.ImageInfo.SamplesPerRow

Samples (scalar values) per row

Equals cols * channels

readonly int Hjg.Pngcs.ImageInfo.SamplesPerRowPacked

Number of values in our scanline, which might be packed.

Equals samplesPerRow if not packed. Elsewhere, it's lower For internal use, mostly.

readonly bool Hjg.Pngcs.ImageInfo.Alpha

flag: has alpha channel

readonly bool Hjg.Pngcs.ImageInfo.Greyscale

flag: is grayscale (G/GA)

readonly bool Hjg.Pngcs.ImageInfo.Indexed

flag: has palette

readonly bool Hjg.Pngcs.ImageInfo.Packed

flag: less than one byte per sample (bit depth 1-2-4)