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

Lightweight wrapper for an image scanline, for read and write More...

Public Types

enum  ESampleType { INT, BYTE }
 

Public Member Functions

 ImageLine (ImageInfo imgInfo)
 
 ImageLine (ImageInfo imgInfo, ESampleType stype)
 
 ImageLine (ImageInfo imgInfo, ESampleType stype, bool unpackedMode)
 Constructs an ImageLine
 
ImageLine unpackToNewImageLine ()
 
ImageLine packToNewImageLine ()
 
int[] GetScanlineInt ()
 
byte[] GetScanlineByte ()
 
bool IsInt ()
 
bool IsByte ()
 
override String ToString ()
 

Properties

ImageInfo ImgInfo [get, set]
 ImageInfo (readonly inmutable)
 
int[] Scanline [get, set]
 Samples of an image line
 
byte[] ScanlineB [get, set]
 Same as Scanline, but with one byte per sample. Only one of Scanline and ScanlineB is valid - this depends on SampleType}
 
int Rown [get, set]
 tracks the current row number (from 0 to rows-1)
 
int ElementsPerRow [get, set]
 Hown many elements has the scanline array =imgInfo.samplePerRowPacked, if packed, imgInfo.samplePerRow elsewhere
 
int maxSampleVal [get, set]
 Maximum sample value that this line admits: typically 255; less if bitdepth less than 8, 65535 if 16bits
 
ESampleType SampleType [get, set]
 Determines if samples are stored in integers or in bytes
 
bool SamplesUnpacked [get, set]
 True: each scanline element is a sample. False: each scanline element has severals samples packed in a byte
 
FilterType FilterUsed [get, set]
 informational only ; filled by the reader
 

Detailed Description

Lightweight wrapper for an image scanline, for read and write

It can be (usually it is) reused while iterating over the image lines See scanline field doc, to understand the format. /remarks>

Member Enumeration Documentation

Enumerator:
INT 
BYTE 

Constructor & Destructor Documentation

Hjg.Pngcs.ImageLine.ImageLine ( ImageInfo  imgInfo)
Hjg.Pngcs.ImageLine.ImageLine ( ImageInfo  imgInfo,
ESampleType  stype 
)
Hjg.Pngcs.ImageLine.ImageLine ( ImageInfo  imgInfo,
ESampleType  stype,
bool  unpackedMode 
)

Constructs an ImageLine

Parameters
imgInfoInmutable copy of PNG ImageInfo
stypeStorage for samples:INT (default) or BYTE
unpackedModeIf true and bitdepth less than 8, samples are unpacked. This has no effect if biddepth 8 or 16

Member Function Documentation

ImageLine Hjg.Pngcs.ImageLine.unpackToNewImageLine ( )
ImageLine Hjg.Pngcs.ImageLine.packToNewImageLine ( )
int [] Hjg.Pngcs.ImageLine.GetScanlineInt ( )
byte [] Hjg.Pngcs.ImageLine.GetScanlineByte ( )
bool Hjg.Pngcs.ImageLine.IsInt ( )
bool Hjg.Pngcs.ImageLine.IsByte ( )
override String Hjg.Pngcs.ImageLine.ToString ( )

Property Documentation

ImageInfo Hjg.Pngcs.ImageLine.ImgInfo
getset

ImageInfo (readonly inmutable)

int [] Hjg.Pngcs.ImageLine.Scanline
getset

Samples of an image line

The 'scanline' is an array of integers, corresponds to an image line (row) Except for 'packed' formats (gray/indexed with 1-2-4 bitdepth) each int is a "sample" (one for channel), (0-255 or 0-65535) in the respective PNG sequence sequence : (R G B R G B...) or (R G B A R G B A...) or (g g g ...) or ( i i i ) (palette index)

For bitdepth 1/2/4 ,and if samplesUnpacked=false, each value is a PACKED byte! To get an unpacked copy, see Pack() and its inverse Unpack()

To convert a indexed line to RGB balues, see ImageLineHelper.PalIdx2RGB() (cant do the reverse)

byte [] Hjg.Pngcs.ImageLine.ScanlineB
getset

Same as Scanline, but with one byte per sample. Only one of Scanline and ScanlineB is valid - this depends on SampleType}

int Hjg.Pngcs.ImageLine.Rown
getset

tracks the current row number (from 0 to rows-1)

int Hjg.Pngcs.ImageLine.ElementsPerRow
getset

Hown many elements has the scanline array =imgInfo.samplePerRowPacked, if packed, imgInfo.samplePerRow elsewhere

int Hjg.Pngcs.ImageLine.maxSampleVal
getset

Maximum sample value that this line admits: typically 255; less if bitdepth less than 8, 65535 if 16bits

ESampleType Hjg.Pngcs.ImageLine.SampleType
getset

Determines if samples are stored in integers or in bytes

bool Hjg.Pngcs.ImageLine.SamplesUnpacked
getset

True: each scanline element is a sample. False: each scanline element has severals samples packed in a byte

FilterType Hjg.Pngcs.ImageLine.FilterUsed
getset

informational only ; filled by the reader