Пример #1
0
        /// <summary>
        /// Loads BMP header from stream.
        /// </summary>
        /// <param name="stream">Fully formatted BMP image.</param>
        /// <returns>Length of header.</returns>
        protected override long Load(Stream stream)
        {
            base.Load(stream);
            byte[] temp = stream.ReadBytes(HeaderSize);

            if (!CheckIdentifier(temp))
            {
                throw new FormatException("Stream is not a BMP Image");
            }

            FileHeader = new BMPFileHeader(temp);
            DIBHeader  = new BMPDIBHeader(temp);

            Width  = DIBHeader.Width;
            Height = DIBHeader.Height;

            return(HeaderSize);
        }
Пример #2
0
        /// <summary>
        /// Loads BMP header from stream.
        /// </summary>
        /// <param name="stream">Fully formatted BMP image.</param>
        /// <returns>Length of header.</returns>
        protected override long Load(Stream stream)
        {
            base.Load(stream);
            byte[] temp = stream.ReadBytes(HeaderSize);

            if (!CheckIdentifier(temp))
                throw new FormatException("Stream is not a BMP Image");

            FileHeader = new BMPFileHeader(temp);
            DIBHeader = new BMPDIBHeader(temp);

            Width = DIBHeader.Width;
            Height = DIBHeader.Height;

            return HeaderSize;
        }