Alexandria.Engines.UltimaUnderworld.Graphic.Load C# (CSharp) Méthode

Load() private méthode

private Load ( BinaryReader reader, int width, int height, PaletteAsset palette, byte format, int aux = null, int auxOffset ) : void
reader System.IO.BinaryReader
width int
height int
palette Glare.Assets.PaletteAsset
format byte
aux int
auxOffset int
Résultat void
        void Load(BinaryReader reader, int width, int height, PaletteAsset palette, byte format, int[] aux = null, int auxOffset = 0)
        {
            int[] indices = new int[width * height];
            ushort dataSize;

            switch (format) {
                case 4: // Uncompressed
                    dataSize = reader.ReadUInt16();
                    if (width * height != dataSize)
                        throw new InvalidDataException();
                    reader.ReadBytesAsInt32(indices, 0, width * height);
                    break;

                case 6: // 5-bit RLE
                    dataSize = reader.ReadUInt16();
                    LoadRLE(indices, reader, width, height, 5, aux, auxOffset);
                    break;

                case 8: // 4-bit RLE
                    if (aux == null)
                        throw new NotImplementedException("Need to load auxiliary palette.");
                    dataSize = reader.ReadUInt16();
                    LoadRLE(indices, reader, width, height, 4, aux, auxOffset);
                    break;

                case 10: // 4-bit aux palette indices.
                    throw new NotImplementedException("Need to load auxiliary palette.");

                default:
                    throw new NotImplementedException("Unknown graphic format " + format + ".");
            }

            Setup(palette, width, height, indices);
        }