Spryt.ImageInfo.Load C# (CSharp) Method

Load() private method

private Load ( Stream stream ) : void
stream Stream
return void
        private void Load( Stream stream )
        {
            BinaryReader reader = new BinaryReader( stream );
            ushort version = reader.ReadUInt16();

            Size = new Size( reader.ReadInt32(), reader.ReadInt32() );

            int paletteLength = reader.ReadInt32();
            Color[] palette = new Color[ paletteLength ];

            for ( int i = 0; i < paletteLength; ++i )
                palette[ i ] = Color.FromArgb( reader.ReadByte(), reader.ReadByte(), reader.ReadByte() );

            myPalette = palette;

            int layerCount = reader.ReadInt32();
            Layers = new List<Layer>();

            for ( int i = 0; i < layerCount; ++i )
            {
                Layers.Add( new Layer( this, reader.ReadString() ) );
                for ( int x = 0; x < Width; ++x )
                    for ( int y = 0; y < Height; ++y )
                        Layers[ i ].SetPixel( x, y, (Pixel) reader.ReadByte() );
            }

            if ( version >= 0x0002 )
            {
                ShowGrid = reader.ReadBoolean();
                GridWidth = reader.ReadInt32();
                GridHeight = reader.ReadInt32();
                GridHorizontalOffset = reader.ReadInt32();
                GridVerticalOffset = reader.ReadInt32();
                GridColour = Color.FromArgb( reader.ReadByte(),
                    reader.ReadByte(), reader.ReadByte(), reader.ReadByte() );
            }
        }

Same methods

ImageInfo::Load ( String filePath ) : void