public STEX(Stream input) { using (var br = new BinaryReaderX(input)) { header = br.ReadStruct <Header>(); texInfo = new TexInfo(br.BaseStream); settings = new ImageSettings { Width = header.width, Height = header.height, Format = Support.Format[(uint)((header.type << 16) | header.imageFormat)], Swizzle = new CTRSwizzle(header.width, header.height) }; br.BaseStream.Position = texInfo.offset; bmp = Common.Load(br.ReadBytes(header.dataSize), settings); } }
public STEX(Stream input) { using (var br = new BinaryReaderX(input)) { header = br.ReadStruct <Header>(); texInfo = new TexInfo(br.BaseStream); settings = new ImageSettings { Width = header.width, Height = header.height, Format = (header.type == DataTypes.UnsignedShort565) ? ImageSettings.ConvertFormat(Cetera.Image.Format.RGB565) : (header.type == DataTypes.UnsignedShort5551) ? ImageSettings.ConvertFormat(Cetera.Image.Format.RGBA5551) : (header.type == DataTypes.UnsignedShort4444) ? ImageSettings.ConvertFormat(Cetera.Image.Format.RGBA4444) : ImageSettings.ConvertFormat(header.imageFormat), }; br.BaseStream.Position = texInfo.offset; bmp = Common.Load(br.ReadBytes(header.dataSize), settings); } }