Esempio n. 1
0
        public override ImageData Read(Stream stream, ImageMetaData info)
        {
            var reader = new AkbReader(stream, (AkbMetaData)info);
            var image  = reader.Unpack();

            return(ImageData.Create(info, reader.Format, null, image, reader.Stride));
        }
Esempio n. 2
0
        byte[] ReadBaseImage(string filename, AkbMetaData overlay_info)
        {
            var pattern = Path.GetFileNameWithoutExtension(filename) + ".*";

            pattern = VFS.CombinePath(VFS.GetDirectoryName(filename), pattern);
            foreach (var entry in VFS.GetFiles(pattern))
            {
                if (entry.Name == overlay_info.FileName)
                {
                    continue;
                }
                using (var base_file = VFS.OpenBinaryStream(entry))
                {
                    var base_info = ReadMetaData(base_file) as AkbMetaData;
                    if (null != base_info && base_info.BPP == overlay_info.BPP &&
                        base_info.Width == overlay_info.Width && base_info.Height == overlay_info.Height)
                    {
                        // FIXME what if baseline image is incremental itself?
                        var reader = new AkbReader(base_file.AsStream, base_info);
                        return(reader.Unpack());
                    }
                }
            }
            return(null);
        }
Esempio n. 3
0
        public override ImageData Read(IBinaryStream file, ImageMetaData info)
        {
            var meta = (AkbMetaData)info;

            byte[] background = null;
            if (!string.IsNullOrEmpty(meta.BaseFileName))
            {
                background = ReadBaseImage(meta.BaseFileName, meta);
            }
            var reader = new AkbReader(file.AsStream, (AkbMetaData)info);
            var image  = reader.Unpack(background);

            return(ImageData.Create(info, reader.Format, null, image, reader.Stride));
        }
Esempio n. 4
0
 public override ImageData Read(Stream stream, ImageMetaData info)
 {
     var reader = new AkbReader (stream, (AkbMetaData)info);
     var image = reader.Unpack();
     return ImageData.Create (info, reader.Format, null, image, reader.Stride);
 }