Engines/FlatRedBallXNA/FlatRedBall/IO/PngLoader.cs
/// <summary>
/// Reads the length, type, data and CRC of the next chunk in the file, and then forms a Chunk
/// struct using this data.
/// </summary>
/// <param name="file">A Stream pointing to the byte data of the .png image.</param>
/// <param name="chunks">A reference to the List of chunks that this Chunk will be stored in.</param>
/// <returns>True if the Chunk read isn't the IEND chunk AND the end of the file hasn't been reached.</returns>
Reads the length, type, data and CRC of the next chunk in the file, and then forms a Chunk
struct using this data.
Reads the length type data and CRC of the next chunk in the file and then forms a Chunk struct using this data .
private static bool GetNextChunk(ref Stream file, ref List<Chunk> chunks)
        {
            Chunk newChunk;
            newChunk.Length = FormUint(ref file);
            newChunk.Type = ConvertToType(FormUint(ref file));
            newChunk.ChunkData = new MemoryStream(GetChunkData(ref file, newChunk.Length));
            newChunk.CRC = FormUint(ref file);
            chunks.Add(newChunk);
            return ((newChunk.Type != ChunkTypes.IEND) && (file.Position < file.Length));
        }
private static bool GetNextChunk ( ref Stream file , ref List < Chunk > chunks ) { Chunk newChunk ; newChunk . Length = FormUint ( ref file ) ; newChunk . Type = ConvertToType ( FormUint ( ref file ) ) ; newChunk . ChunkData = new MemoryStream ( GetChunkData ( ref file , newChunk . Length ) ) ; newChunk . CRC = FormUint ( ref file ) ; chunks . Add ( newChunk ) ; return ( ( newChunk . Type != ChunkTypes . IEND ) && ( file . Position < file . Length ) ) ; }
Reads the length, type, data and CRC of the next chunk in the file, and then forms a Chunk
struct using this data.
Reads the length type data and CRC of the next chunk in the file and then forms a Chunk struct using this data .
//Read length first //Read the 4-byte type and convert it into an enumeration //Store the data associated with this Chunk in a byte Stream. //Read the CRC for this Chunk //Add this chunk to the List
True if the Chunk read isn't the IEND chunk AND the end of the file hasn't been reached.
True if the Chunk read isn ' t the IEND chunk AND the end of the file hasn ' t been reached .
Stream
ref
List<Chunk>
ref
file
A Stream pointing to the byte data of the .png image.
A Stream pointing to the byte data of the . png image .
chunks
A reference to the List of chunks that this Chunk will be stored in.
A reference to the List of chunks that this Chunk will be stored in .