コード例 #1
0
ファイル: ImageIPH.cs プロジェクト: zxc120/GARbro
        public override uint     Signature { get { return 0; } } // 'RIFF'

        public override ImageMetaData ReadMetaData (IBinaryStream file)
        {
            // 'RIFF' isn't included into signature to avoid auto-detection of the WAV files as IPH images.
            if (0x46464952 != file.Signature) // 'RIFF'
                return null;
            var header = file.ReadHeader (0x10);
            if (0x38 != header.ToInt32 (4))
                return null;
            var signature = header.ToInt32 (8);
            if (signature != 0x20485049 && signature != 0x00485049) // 'IPH'
                return null;
            if (0x20746D66 != header.ToInt32 (12)) // 'fmt '
                return null;
            file.Position = 0x38;
            if (0x20706D62 != file.ReadInt32()) // 'bmp '
                return null;
            var info = new IphMetaData();
            info.PackedSize = file.ReadInt32();
            info.Width  = file.ReadUInt16();
            info.Height = file.ReadUInt16();
            file.Position = 0x50;
            info.BPP = file.ReadUInt16();
            info.IsCompressed = 0 != file.ReadInt16();
            // XXX int16@[0x54] is a transparency color or 0xFFFF if image is not transparent
            return info;
        }
コード例 #2
0
ファイル: ImageIPH.cs プロジェクト: tenyuhuang/GARbro
 public IphReader(Stream input, IphMetaData info)
 {
     m_info   = info;
     m_input  = new ArcView.Reader(input);
     m_width  = (int)info.Width;
     m_height = (int)info.Height;
     m_output = new byte[m_width * m_height * 2];
 }
コード例 #3
0
ファイル: ImageIPH.cs プロジェクト: zxc120/GARbro
 public IphReader (IBinaryStream input, IphMetaData info)
 {
     m_info = info;
     m_input = input;
     m_width = (int)info.Width;
     m_height = (int)info.Height;
     m_output = new byte[m_width*m_height*2];
 }
コード例 #4
0
ファイル: ImageIPH.cs プロジェクト: tenyuhuang/GARbro
        }                                                        // 'RIFF'

        public override ImageMetaData ReadMetaData(Stream stream)
        {
            // 'RIFF' isn't included into signature to avoid auto-detection of the WAV files as IPH images.
            if (0x46464952 != FormatCatalog.ReadSignature(stream))  // 'RIFF'
            {
                return(null);
            }
            using (var reader = new ArcView.Reader(stream))
            {
                if (0x38 != reader.ReadInt32())
                {
                    return(null);
                }
                var signature = reader.ReadInt32();
                if (signature != 0x20485049 && signature != 0x00485049) // 'IPH'
                {
                    return(null);
                }
                if (0x20746D66 != reader.ReadInt32()) // 'fmt '
                {
                    return(null);
                }
                reader.BaseStream.Position = 0x38;
                if (0x20706D62 != reader.ReadInt32()) // 'bmp '
                {
                    return(null);
                }
                var info = new IphMetaData();
                info.PackedSize            = reader.ReadInt32();
                info.Width                 = reader.ReadUInt16();
                info.Height                = reader.ReadUInt16();
                reader.BaseStream.Position = 0x50;
                info.BPP          = reader.ReadUInt16();
                info.IsCompressed = 0 != reader.ReadInt16();
                // XXX int16@[0x54] is a transparency color or 0xFFFF if image is not transparent
                return(info);
            }
        }