Example #1
0
        void ReadTrailer(MbmBinaryReader input)
        {
            // Seek to trailer
            UInt32 lastPos = input.Tell();

            input.Seek(header.trailerOff);

            UInt32 count = input.ReadUInt32();

            if (count > MaxBitmapCount || count == 0)
            {
                String message = String.Format("Bitmap count in MBM file doesn't make sense ({0}). " +
                                               "It should not be equal to 0 and must not be larger than {1}", count, MaxBitmapCount);

                throw new MbmException(message);
            }

            trailer = new MbmTrailer(count);

            for (UInt32 i = 0; i < count; i++)
            {
                trailer.Add(input.ReadUInt32());
            }

            input.Seek(lastPos);
        }
Example #2
0
        SBMHeader ReadSingleBitmapHeader(MbmBinaryReader input, UInt32 offset)
        {
            SBMHeader bitmapHeader = new SBMHeader();

            // Seek to trailer
            UInt32 lastPos = input.Tell();

            input.Seek(offset);

            bitmapHeader.bitmapSize   = input.ReadUInt32();
            bitmapHeader.headerLength = input.ReadUInt32();
            bitmapHeader.sizeInPixel  = input.ReadSize();
            bitmapHeader.sizeInTwips  = input.ReadSize();
            bitmapHeader.bitsPerPixel = input.ReadUInt32();
            bitmapHeader.colorMode    = (BitmapColor)input.ReadUInt32();
            bitmapHeader.paletteSize  = input.ReadUInt32();
            bitmapHeader.compression  = (BitmapCompression)input.ReadUInt32();

            input.Seek(lastPos);

            return(bitmapHeader);
        }