ReadLittleInt32() public method

public ReadLittleInt32 ( ) : int
return int
示例#1
0
    public static BM.Frame ReadHeader1(ByteStream stream, BM.CreateArgs createArgs, out FMEHeader header)
    {
        header = new FMEHeader();
        header.Shift = new Vector2();
        header.Shift.x = (float)stream.ReadLittleInt32();
        header.Shift.y = (float)stream.ReadLittleInt32();
        header.Flipped = stream.ReadLittleInt32() != 0;

        int header2Ofs = stream.ReadLittleInt32();
        stream.Skip(16 + (header2Ofs-32));

        return ReadHeader2(stream, createArgs);
    }
示例#2
0
    private Header ReadHeader(ByteStream stream, EHeaderType headerType)
    {
        Header header = new Header();

        if (headerType == EHeaderType.FileHeader) {
            header.W = stream.ReadLittleShort16();
            header.H = stream.ReadLittleShort16();
            stream.Skip(2);
            header.IY = stream.ReadLittleShort16();
            header.Transparent = stream.ReadByte();
            stream.Skip(1);
            header.Compressed = stream.ReadLittleShort16();
            header.DataSize = stream.ReadLittleInt32();
            stream.Skip(12);
        } else {
            header.W = stream.ReadLittleShort16();
            header.H = stream.ReadLittleShort16();
            stream.Skip(20);
            header.Transparent = stream.ReadByte();
            stream.Skip(3);
        }

        return header;
    }
示例#3
0
    public static BM.Frame ReadHeader2(ByteStream stream, BM.CreateArgs createArgs)
    {
        int headerStart = (int)stream.Position;

        BM.Header header = new BM.Header();
        header.W = stream.ReadLittleInt32();
        header.H = stream.ReadLittleInt32();
        header.Compressed = stream.ReadLittleInt32();
        header.DataSize = stream.ReadLittleInt32();
        header.Transparent = 0x8;

        stream.Skip(8);

        int[] columnOffsets = null;

        if (header.Compressed != 0) {
            header.Compressed = 2;

            columnOffsets = new int[header.W];

            for (int i = 0; i < columnOffsets.Length; ++i) {
                columnOffsets[i] = stream.ReadLittleInt32() + headerStart;
            }
        }

        return BM.ReadColumns(stream, header, columnOffsets, createArgs);
    }
示例#4
0
    private void ParseBitmap(ByteStream stream, CreateArgs createArgs)
    {
        if ((stream.ReadString(3) != "BM ") || (stream.ReadByte() != 0x1e)){
            throw new InvalidDataException("Not a BM file.");
        }

        Header header = ReadHeader(stream, EHeaderType.FileHeader);
        DebugCheck.Assert(stream.Position == 32);

        if ((header.W == 1) && (header.H != 1)) {
            // multiple bitmaps in this file.
            _fps = stream.ReadByte();
            stream.Skip(1);

            long baseOfs = stream.Position;

            int[] offsets = new int[header.IY];
            for (int i = 0; i < offsets.Length; ++i) {
                offsets[i] = stream.ReadLittleInt32();
            }

            for (int i = 0; i < offsets.Length; ++i) {
                stream.SeekSet(offsets[i] + baseOfs);
                Header subHeader = ReadHeader(stream, EHeaderType.SubHeader);
                Frame frame = ReadColumns(stream, subHeader, null, createArgs);
                _frames.Add(frame);
            }
        } else {
            int[] columnOffsets = null;

            if (header.Compressed != 0) {
                // read column offsets.
                stream.SeekSet(header.DataSize);
                columnOffsets = new int[header.W];

                for (int i = 0; i < columnOffsets.Length; ++i) {
                    columnOffsets[i] = stream.ReadLittleInt32() + 32;
                }
            }

            Frame frame = ReadColumns(stream, header, columnOffsets, createArgs);
            _frames.Add(frame);
        }
    }