Engines/FlatRedBallXNA/FlatRedBall/IO/PngLoader.cs
/// <summary>
/// Processes the PLTE chunk by reading in all of the indexed color values and storing them in
/// a PaletteInfo struct.
/// </summary>
/// <param name="plte">The Chunk containing the PLTE chunk from the file</param>
/// <param name="palette">An unused PaletteInfo struct to be filled by data from plte</param>
Processes the PLTE chunk by reading in all of the indexed color values and storing them in
a PaletteInfo struct.
Processes the PLTE chunk by reading in all of the indexed color values and storing them in a PaletteInfo struct .
private static void ReadPalette(Chunk plte, ref PaletteInfo palette)
        {
            uint numEntries = (uint)plte.ChunkData.Length / 3;
            if ((numEntries * 3) == plte.ChunkData.Length)
            {
                for (int i = 0; i < numEntries; ++i)
                {
                    RGB value = new RGB();
                    value.R = (byte)plte.ChunkData.ReadByte(); 
                    value.G = (byte)plte.ChunkData.ReadByte();
                    value.B = (byte)plte.ChunkData.ReadByte();
                    palette.Entries[i] = value;
                }
            }
        }
private static void ReadPalette ( Chunk plte , ref PaletteInfo palette ) { uint numEntries = ( uint ) plte . ChunkData . Length / 3 ; if ( ( numEntries * 3 ) == plte . ChunkData . Length ) { for ( int i = 0 ; i < numEntries ; ++ i ) { RGB value = new RGB ( ) ; value . R = ( byte ) plte . ChunkData . ReadByte ( ) ; value . G = ( byte ) plte . ChunkData . ReadByte ( ) ; value . B = ( byte ) plte . ChunkData . ReadByte ( ) ; palette . Entries [ i ] = value ; } } }
Processes the PLTE chunk by reading in all of the indexed color values and storing them in
a PaletteInfo struct.
Processes the PLTE chunk by reading in all of the indexed color values and storing them in a PaletteInfo struct .
//The length of PLTE's data segment should be 3 * the number of entries //Checking for monkey-business??? //Read in the values of the color entries and store them. //System.Diagnostics.Trace.WriteLine(value.R); // System.Diagnostics.Trace.WriteLine(value.G); // System.Diagnostics.Trace.WriteLine(value.B);
plte
Chunk
The Chunk containing the PLTE chunk from the file
The Chunk containing the PLTE chunk from the file
PaletteInfo
ref
<not_specific>
palette
<not_specific>
An unused PaletteInfo struct to be filled by data from plte
An unused PaletteInfo struct to be filled by data from plte