Пример #1
0
        protected override void OnOpen(EndianBinaryReader reader)
        {
            reader.Endianness = Endian.BigEndian;

            MagicNumber = Encoding.ASCII.GetString(reader.ReadBytes(4));
            Version     = Encoding.ASCII.GetString(reader.ReadBytes(4));
            FileSize    = reader.ReadUInt32();
            HeaderSize  = reader.ReadUInt32();
            NumImages   = reader.ReadUInt32();
            Unknown0x14 = reader.ReadUInt32();
            Unknown0x18 = reader.ReadUInt32();

            UnknownValues0x1C = new uint[NumImages];
            for (int i = 0; i < UnknownValues0x1C.Length; i++)
            {
                UnknownValues0x1C[i] = reader.ReadUInt32();
            }

            ImageOffsets = new uint[NumImages];
            for (int i = 0; i < ImageOffsets.Length; i++)
            {
                ImageOffsets[i] = reader.ReadUInt32();
            }

            imageDataShims = new G1TGImageDataShim[NumImages];
            for (int i = 0; i < NumImages; i++)
            {
                reader.BaseStream.Seek(HeaderSize + ImageOffsets[i], SeekOrigin.Begin);
                G1TGImageHeader imageHeader = new G1TGImageHeader(reader);

                reader.BaseStream.Seek((HeaderSize + ImageOffsets[i]) + imageHeader.HeaderSize, SeekOrigin.Begin);
                imageDataShims[i] = new G1TGImageDataShim(imageHeader, reader);
            }
        }
Пример #2
0
        protected override Bitmap OnGetBitmap(int imageIndex, int paletteIndex)
        {
            G1TGImageDataShim imageDataShim = imageDataShims[imageIndex];

            imageBinary = new ImageBinary();
            imageBinary.AddInputPixels(imageDataShim.Data);
            imageBinary.InputPixelFormat = imageDataShim.Format;
            imageBinary.Width            = imageDataShim.Width;
            imageBinary.Height           = imageDataShim.Height;

            return(imageBinary.GetBitmap(0, 0));
        }