Esempio n. 1
0
        public override ImageMetaData ReadMetaData(IBinaryStream file)
        {
            var header = file.ReadHeader(0x29);

            if (header.Length != 0x29)
            {
                return(null);
            }
            var gps = new GpsMetaData
            {
                Width        = header.ToUInt32(0x19),
                Height       = header.ToUInt32(0x1D),
                Compression  = header[0x10],
                UnpackedSize = header.ToInt32(0x11),
                PackedSize   = header.ToInt32(0x15),
            };

            // read BMP header
            using (var stream = OpenGpsStream(file, gps.Compression, 0x54))
                using (var input = BinaryStream.FromStream(stream, file.Name))
                {
                    var bmp_info = base.ReadMetaData(input);
                    if (null == bmp_info)
                    {
                        return(null);
                    }
                    gps.BPP = bmp_info.BPP;
                    return(gps);
                }
        }
Esempio n. 2
0
        public override ImageMetaData ReadMetaData(Stream stream)
        {
            var header = new byte[0x29];

            if (header.Length != stream.Read(header, 0, header.Length))
            {
                return(null);
            }
            var gps = new GpsMetaData
            {
                Width        = LittleEndian.ToUInt32(header, 0x19),
                Height       = LittleEndian.ToUInt32(header, 0x1D),
                Compression  = header[0x10],
                UnpackedSize = LittleEndian.ToInt32(header, 0x11),
                PackedSize   = LittleEndian.ToInt32(header, 0x15),
            };

            // read BMP header
            using (var input = OpenGpsStream(stream, gps.Compression, 0x54))
            {
                var bmp_info = base.ReadMetaData(input);
                if (null == bmp_info)
                {
                    return(null);
                }
                gps.BPP = bmp_info.BPP;
                return(gps);
            }
        }
Esempio n. 3
0
        public override ImageMetaData ReadMetaData(IBinaryStream file)
        {
            var header = file.ReadHeader(0x29);
            var gps    = new GpsMetaData();

            if (header.ToUInt32(4) == 0xCCCCCCCC)
            {
                gps.HeaderSize   = 0x19;
                gps.Compression  = 2;
                gps.UnpackedSize = header.ToInt32(0x9);
                gps.PackedSize   = header.ToInt32(0xD);
            }
            else
            {
                gps.HeaderSize   = 0x29;
                gps.Compression  = header[0x10];
                gps.UnpackedSize = header.ToInt32(0x11);
                gps.PackedSize   = header.ToInt32(0x15);
                gps.Width        = header.ToUInt32(0x19);
                gps.Height       = header.ToUInt32(0x1D);
            }
            file.Position = gps.HeaderSize;
            // read BMP header
            using (var stream = OpenGpsStream(file, gps.Compression, 0x54))
                using (var input = BinaryStream.FromStream(stream, file.Name))
                {
                    var bmp_info = Bmp.ReadMetaData(input);
                    if (null == bmp_info)
                    {
                        return(null);
                    }
                    gps.BPP    = bmp_info.BPP;
                    gps.Width  = bmp_info.Width;
                    gps.Height = bmp_info.Height;
                    return(gps);
                }
        }
Esempio n. 4
0
 public override ImageMetaData ReadMetaData(Stream stream)
 {
     var header = new byte[0x29];
     if (header.Length != stream.Read (header, 0, header.Length))
         return null;
     var gps = new GpsMetaData
     {
         Width   = LittleEndian.ToUInt32 (header, 0x19),
         Height  = LittleEndian.ToUInt32 (header, 0x1D),
         Compression = header[0x10],
         UnpackedSize = LittleEndian.ToInt32 (header, 0x11),
         PackedSize = LittleEndian.ToInt32 (header, 0x15),
     };
     // read BMP header
     using (var input = OpenGpsStream (stream, gps.Compression, 0x54))
     {
         var bmp_info = base.ReadMetaData (input);
         if (null == bmp_info)
             return null;
         gps.BPP = bmp_info.BPP;
         return gps;
     }
 }