示例#1
0
        public void WriteTo(BinaryWriter bw)
        {
            var header = new Header
            {
                TotalLength = Header.Length + PaletteDataLength + (Width * Height) + PaddingLength,
                Unknown1    = 0x_77_77_77_77,
                Width       = Width,
                Height      = Height,
                Unknown2    = 1
            };

            header.WriteTo(bw);
            var posBeforePal = bw.BaseStream.Position;

            bw.Write(RawPalette.Compress(Palette));
            var posAfterPal = bw.BaseStream.Position;
            int palLen      = (int)(posAfterPal - posBeforePal);

            if (palLen < PaletteDataLength)
            {
                bw.Pad(PaletteDataLength - palLen);
            }
            bw.Write(Pixels);
            bw.Pad(PaddingLength);
        }
示例#2
0
        public void WriteTo(BinaryWriter bw)
        {
            var initOffset = bw.BaseStream.Position;

            bw.BaseStream.Position = initOffset + HeaderInstance.TextureDataOffset;
            var compressedPixels = RawChar.Compress(PixelMap);

            bw.Write(compressedPixels);
            bw.BaseStream.Position = initOffset + HeaderInstance.PaletteDataOffset;
            bw.Write(RawPalette.Compress(Palette1));
            bw.Write(RawPalette.Compress(Palette2));
        }
示例#3
0
        public void WriteTo(BinaryWriter bw)
        {
            bw.WriteMagicNumber(MagicNumber);
            bw.Write(Width);
            bw.Write(Height);
            var posBeforePal = bw.BaseStream.Position;

            bw.Write(RawPalette.Compress(Palette));
            var posAfterPal = bw.BaseStream.Position;
            int palLen      = (int)(posAfterPal - posBeforePal);

            if (palLen < PaletteDataLength)
            {
                bw.Pad(PaletteDataLength - palLen);
            }
            bw.Write(Pixels);
        }