C# 클래스 FlatRedBall.IO.PngLoader

Notes: Interlaced pngs are now fully supported Only the chunks of data that are outlined in the Png specification as Critical Chunks are supported. TODO: Allow use of the CRC values to check the validity of the Chunk data Consider implementing the Ancillary Chunks since chunks like gAMA can drastically change visible colors.
파일 보기 프로젝트 열기: vchelaru/FlatRedBall

공개 프로퍼티들

프로퍼티 타입 설명
ByteBufferSize int
ColorBufferSize int

공개 메소드들

메소드 설명
GetPixelData ( string fileName ) : ImageData

Loads a .png image from the fileName given and returns an array of pixel colors.

Initialize ( ) : void

비공개 메소드들

메소드 설명
BuildPixels ( byte image, HeaderInfo &header, PaletteInfo &palette ) : Color[]

Does the remaining work to convert the byte[] containing the image into a Color[] containing colors for each pixel. This operation is different for most individual combinations of ColorType and bitDepth and currently only ColorType 2 is supported.

CheckSignature ( Stream &file ) : bool

Checks the first 8 bytes of the file in the given Stream against the standard signature for .png images.

ConvertToType ( uint type ) : ChunkTypes

Converts a 4-byte uint into an enumerated ChunkType

ExtractBits ( byte sourceByte, int pointer, byte bitDepth ) : byte
FormUint ( Stream &bytes ) : uint

Arranges and combines the byte values stored in byte[] bytes in order to form a uint.

GetBytesPerPixel ( HeaderInfo header ) : float

Uses the ColorType and Bitdepth of this image to calculate the number of bytes per pixel.

GetChunkData ( Stream &file, uint length ) : byte[]

Reads the bytes of a chunk's ChunkData segment from the Stream and returns it in a byte[].

GetNextChunk ( Stream &file, List &chunks ) : bool

Reads the length, type, data and CRC of the next chunk in the file, and then forms a Chunk struct using this data.

LoadFile ( string fileName ) : int

Loads a file (hopefully a .png image) into a byte[].

OldMethod ( byte image, HeaderInfo &header, PaletteInfo &palette ) : Color[]
PaethPredictor ( int left, int up, int upLeft ) : byte

A helper for the ReverseFilterPaeth method

ProcessChunks ( List chunks, HeaderInfo header, PaletteInfo &palette ) : byte[]

Takes a List of all of the Chunks in the .png image being loaded (after IHDR is loaded and removed) and processes each Chunk appropriately before returning the compressed image. NOTE: Currently only processes the required Chunks PLTE, IDAT and IEND. Ancillary chunks are currently unsupported.

ReadFile ( Stream stream ) : int

Reads the data in the given Stream and stores it in a byte[] that is then trimmed and returned.

ReadHeader ( List &chunks ) : HeaderInfo

Processes the IHDR chunk by reading and storing all of its information in a HeaderInfo struct.

ReadImageData ( Chunk idat, byte &imageData, int &numberOfBytesRead ) : void

Reads data from the given IDAT chunk and appends it to the List imageData.

ReadPalette ( Chunk plte, PaletteInfo &palette ) : void

Processes the PLTE chunk by reading in all of the indexed color values and storing them in a PaletteInfo struct.

ReadStream ( InflaterInputStream &stream ) : void

Reads the decompressed(inflated) image data from an InflaterInputStream that was fed the compressed image.

ReverseFilterAverage ( byte &image, uint pointer, uint bps, float bpp, byte bitDepth ) : void

Reverses the filtering done on a scanline of pixels that have been filtered using Method 2 (Average)

ReverseFilterPaeth ( byte &image, uint pointer, uint bps, float bpp, byte bitDepth ) : void

Reverses the filtering done on a scanline of pixels that have been filtered using Method 3 (Paeth)

ReverseFilterSub ( byte &image, uint pointer, uint bps, float bpp, byte bitDepth ) : void

Reverses the filtering done on a scanline of pixels that have been filtered using Method 0 (Subtract)

ReverseFilterUp ( byte &image, uint pointer, uint bps, float bpp, byte bitDepth ) : void

Reverses the filtering done on a scanline of pixels that have been filtered using Method 1 (Up)

ReverseFiltering ( byte image, HeaderInfo header ) : byte[]

Calls the appropriate Reverse Filtering methods to return the image to its original state.

메소드 상세

GetPixelData() 공개 정적인 메소드

Loads a .png image from the fileName given and returns an array of pixel colors.
public static GetPixelData ( string fileName ) : ImageData
fileName string The name of the .png image to be loaded.
리턴 FlatRedBall.Graphics.Texture.ImageData

Initialize() 공개 정적인 메소드

public static Initialize ( ) : void
리턴 void

프로퍼티 상세

ByteBufferSize 공개적으로 정적으로 프로퍼티

public static int ByteBufferSize
리턴 int

ColorBufferSize 공개적으로 정적으로 프로퍼티

public static int ColorBufferSize
리턴 int