Esempio n. 1
0
        public ImageInfo Load(Stream input)
        {
            using var br = new BinaryReaderX(input);

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

            // Create image info
            input.Position = 0x80;
            var imageData = br.ReadBytes(_header.dataSize);

            var size = new Size(_header.width == 0 ? _header.paddedWidth : _header.width, _header.height == 0 ? _header.paddedHeight : _header.height);

            var imageInfo = new ImageInfo(imageData, _header.format, size);

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

            return(imageInfo);
        }
Esempio n. 2
0
        public ImageInfo Load(Stream input)
        {
            using var br = new BinaryReaderX(input);

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

            // Read unknown region
            _unkRegion = br.ReadBytes(_header.dataOffset - (int)br.BaseStream.Position);

            // Create image info
            input.Position = _header.dataOffset;
            var imageData = br.ReadBytes(_header.dataSize);

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

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

            return(imageInfo);
        }