C# 클래스 Hjg.Pngcs.PngWriter

Writes a PNG image, line by line.
파일 보기 프로젝트 열기: devedse/DeveMazeGenerator 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
ImgInfo Hjg.Pngcs.ImageInfo

보호된 프로퍼티들

프로퍼티 타입 설명
filename String
rowb byte[]
rowbfilter byte[]
rowbprev byte[]

공개 메소드들

메소드 설명
ComputeCompressionRatio ( ) : double

Computes compressed size/raw size, approximate

Actually: compressed size = total size of IDAT data , raw size = uncompressed pixel bytes = rows * (bytesPerRow + 1)

CopyChunksFirst ( PngReader reader, int copy_mask ) : void
CopyChunksLast ( PngReader reader, int copy_mask ) : void
End ( ) : void

Finalizes the image creation and closes the file stream.

This MUST be called after writing the lines.

GetChunksList ( ) : ChunksListForWrite
GetFilename ( ) : String

Filename or description, from the optional constructor argument.

GetMetadata ( ) : PngMetadata
IsUnpackedMode ( ) : bool
PngWriter ( Stream outputStream, Hjg.Pngcs.ImageInfo imgInfo ) : System

Constructs a PngWriter from a outputStream, with no filename information

PngWriter ( Stream outputStream, Hjg.Pngcs.ImageInfo imgInfo, String filename ) : System

Constructs a PngWriter from a outputStream, with optional filename or description

After construction nothing is writen yet. You still can set some parameters (compression, filters) and queue chunks before start writing the pixels. See also FileHelper.createPngWriter()

SetFilterType ( FilterType filterType ) : void

Sets internal prediction filter type, or strategy to choose it.

This must be called just after constructor, before starting writing. Recommended values: DEFAULT (default) or AGGRESIVE

SetUseUnPackedMode ( bool useUnpackedMode ) : void
WriteRow ( Hjg.Pngcs.ImageLine imgline, int rownumber ) : void

this uses the row number from the imageline!

WriteRow ( int newrow ) : void
WriteRow ( int newrow, int rown ) : void
WriteRowByte ( byte newrow, int rown ) : void
WriteRowInt ( int newrow, int rown ) : void

Writes a full image row.

This must be called sequentially from n=0 to n=rows-1 One integer per sample , in the natural order: R G B R G B ... (or R G B A R G B A... if has alpha) The values should be between 0 and 255 for 8 bitspc images, and between 0- 65535 form 16 bitspc images (this applies also to the alpha channel if present) The array can be reused.

WriteRowsByte ( byte image ) : void
WriteRowsInt ( int image ) : void

보호된 메소드들

메소드 설명
encodeRowFromByte ( byte row ) : void
encodeRowFromInt ( int row ) : void

비공개 메소드들

메소드 설명
CopyChunks ( PngReader reader, int copy_mask, bool onlyAfterIdat ) : void

copy chunks from reader - copy_mask : see ChunksToWrite.COPY_XXX If we are after idat, only considers those chunks after IDAT in PngReader TODO: this should be more customizable

FilterRow ( int rown ) : void
FilterRowAverage ( ) : void
FilterRowNone ( ) : void
FilterRowPaeth ( ) : void
FilterRowSub ( ) : void
FilterRowUp ( ) : void
SumRowbfilter ( ) : long
WriteEndChunk ( ) : void
WriteFirstChunks ( ) : void
WriteLastChunks ( ) : void
WriteSignatureAndIHDR ( ) : void

Write id signature and also "IHDR" chunk

filterAndSend ( int rown ) : void
init ( ) : void

init: is called automatically before writing the first row

prepareEncodeRow ( int rown ) : void
reportResultsForFilter ( int rown, FilterType type, bool tentative ) : void

메소드 상세

ComputeCompressionRatio() 공개 메소드

Computes compressed size/raw size, approximate
Actually: compressed size = total size of IDAT data , raw size = uncompressed pixel bytes = rows * (bytesPerRow + 1)
public ComputeCompressionRatio ( ) : double
리턴 double

CopyChunksFirst() 공개 메소드

public CopyChunksFirst ( PngReader reader, int copy_mask ) : void
reader PngReader
copy_mask int
리턴 void

CopyChunksLast() 공개 메소드

public CopyChunksLast ( PngReader reader, int copy_mask ) : void
reader PngReader
copy_mask int
리턴 void

End() 공개 메소드

Finalizes the image creation and closes the file stream.
This MUST be called after writing the lines.
public End ( ) : void
리턴 void

GetChunksList() 공개 메소드

public GetChunksList ( ) : ChunksListForWrite
리턴 ChunksListForWrite

GetFilename() 공개 메소드

Filename or description, from the optional constructor argument.
public GetFilename ( ) : String
리턴 String

GetMetadata() 공개 메소드

public GetMetadata ( ) : PngMetadata
리턴 PngMetadata

IsUnpackedMode() 공개 메소드

public IsUnpackedMode ( ) : bool
리턴 bool

PngWriter() 공개 메소드

Constructs a PngWriter from a outputStream, with no filename information
public PngWriter ( Stream outputStream, Hjg.Pngcs.ImageInfo imgInfo ) : System
outputStream Stream
imgInfo Hjg.Pngcs.ImageInfo
리턴 System

PngWriter() 공개 메소드

Constructs a PngWriter from a outputStream, with optional filename or description
After construction nothing is writen yet. You still can set some parameters (compression, filters) and queue chunks before start writing the pixels. See also FileHelper.createPngWriter()
public PngWriter ( Stream outputStream, Hjg.Pngcs.ImageInfo imgInfo, String filename ) : System
outputStream Stream Opened stream for binary writing
imgInfo Hjg.Pngcs.ImageInfo Basic image parameters
filename String Optional, can be the filename or a description.
리턴 System

SetFilterType() 공개 메소드

Sets internal prediction filter type, or strategy to choose it.
This must be called just after constructor, before starting writing. Recommended values: DEFAULT (default) or AGGRESIVE
public SetFilterType ( FilterType filterType ) : void
filterType FilterType One of the five prediction types or strategy to choose it
리턴 void

SetUseUnPackedMode() 공개 메소드

public SetUseUnPackedMode ( bool useUnpackedMode ) : void
useUnpackedMode bool
리턴 void

WriteRow() 공개 메소드

this uses the row number from the imageline!
public WriteRow ( Hjg.Pngcs.ImageLine imgline, int rownumber ) : void
imgline Hjg.Pngcs.ImageLine
rownumber int
리턴 void

WriteRow() 공개 메소드

public WriteRow ( int newrow ) : void
newrow int
리턴 void

WriteRow() 공개 메소드

public WriteRow ( int newrow, int rown ) : void
newrow int
rown int
리턴 void

WriteRowByte() 공개 메소드

public WriteRowByte ( byte newrow, int rown ) : void
newrow byte
rown int
리턴 void

WriteRowInt() 공개 메소드

Writes a full image row.
This must be called sequentially from n=0 to n=rows-1 One integer per sample , in the natural order: R G B R G B ... (or R G B A R G B A... if has alpha) The values should be between 0 and 255 for 8 bitspc images, and between 0- 65535 form 16 bitspc images (this applies also to the alpha channel if present) The array can be reused.
public WriteRowInt ( int newrow, int rown ) : void
newrow int Array of pixel values
rown int Number of row, from 0 (top) to rows-1 (bottom)
리턴 void

WriteRowsByte() 공개 메소드

public WriteRowsByte ( byte image ) : void
image byte
리턴 void

WriteRowsInt() 공개 메소드

public WriteRowsInt ( int image ) : void
image int
리턴 void

encodeRowFromByte() 보호된 메소드

protected encodeRowFromByte ( byte row ) : void
row byte
리턴 void

encodeRowFromInt() 보호된 메소드

protected encodeRowFromInt ( int row ) : void
row int
리턴 void

프로퍼티 상세

ImgInfo 공개적으로 프로퍼티

Basic image info, inmutable
public ImageInfo,Hjg.Pngcs ImgInfo
리턴 Hjg.Pngcs.ImageInfo

filename 보호되어 있는 프로퍼티

filename, or description - merely informative, can be empty
protected String filename
리턴 String

rowb 보호되어 있는 프로퍼티

raw current row, as array of bytes,counting from 1 (index 0 is reserved for filter type)
protected byte[] rowb
리턴 byte[]

rowbfilter 보호되어 있는 프로퍼티

raw current row, after filtered
protected byte[] rowbfilter
리턴 byte[]

rowbprev 보호되어 있는 프로퍼티

previuos raw row
protected byte[] rowbprev
리턴 byte[]