コード例 #1
0
        public ImageInfo Load(Stream input)
        {
            using var br = new BinaryReaderX(input);

            // Read header
            _header = br.ReadType <MtexHeader>();

            // Ignore padding
            br.BaseStream.Position = 0x80;

            // Read texture
            var texture = br.ReadBytes((int)input.Length - 0x80);

            var imageInfo = new ImageInfo(texture, _header.format, new Size(_header.width, _header.height));

            imageInfo.RemapPixels.With(context => new CtrSwizzle(context, CtrTransformation.YFlip));
            imageInfo.PadSize.ToPowerOfTwo();

            return(imageInfo);
        }
コード例 #2
0
ファイル: MTEX.cs プロジェクト: Milozaki7/Kuriimu2
        public ImageInfo Load(Stream input)
        {
            using var br = new BinaryReaderX(input);

            // Read header
            _header = br.ReadType <MtexHeader>();

            // Ignore padding
            br.BaseStream.Position = 0x80;

            // Read texture
            var texture = br.ReadBytes((int)input.Length - 0x80);

            var imageInfo = new ImageInfo(texture, _header.format, new Size(_header.width, _header.height))
            {
                Configuration = new ImageConfiguration().
                                RemapPixelsWith(size => new CTRSwizzle(size.Width, size.Height, CtrTransformation.YFlip, true)),
            };

            return(imageInfo);
        }