public TPLTexture(TPL_Parser.ImageEntry imageEntry) { Image = imageEntry; Width = imageEntry.Header.Width; Height = imageEntry.Header.Height; Platform = new GamecubeSwizzle(imageEntry.Header.Format); }
public void Load(Stream stream) { Name = FileInfo.FileName; CanEdit = true; using (var reader = new FileReader(stream)) { reader.SetByteOrder(true); ImageHeader = reader.ReadStruct <Header>(); Width = ImageHeader.Width; Height = ImageHeader.Height; MipCount = ImageHeader.MipCount; var format = (Decode_Gamecube.TextureFormats)ImageHeader.ImageFormat; var paletteformat = (Decode_Gamecube.PaletteFormats)ImageHeader.PaletteFormat; int imageSize = Decode_Gamecube.GetDataSizeWithMips(format, Width, Height, MipCount); reader.SeekBegin(ImageHeader.ImageOffset); ImageData = reader.ReadBytes(imageSize); Platform = new GamecubeSwizzle(format, paletteformat); if (ImageHeader.PaletteCount > 0) { reader.SeekBegin(ImageHeader.PaletteOffset); ((GamecubeSwizzle)Platform).PaletteData = reader.ReadUInt16s(ImageHeader.PaletteCount); } } }
public Texture(TextureHeader header) { Width = header.Width; Height = header.Height; MipCount = 1; Platform = new GamecubeSwizzle(header.Format); ImageData = header.ImageData; }
public HSFTexture(string name, TextureInfo info, byte[] data) { Name = name; TextureInfo = info; ImageData = data; CanEdit = true; Platform = new GamecubeSwizzle(); ReloadInfo(); }
public void Read(FileReader reader) { reader.SetByteOrder(true); ImageHeader = reader.ReadStruct <Header>(); reader.Align(32); Width = ImageHeader.Width; Height = ImageHeader.Height; MipCount = 1; Console.WriteLine($"Width {Width} Height {Height}"); var format = FormatsTXE[ImageHeader.ImageFormat]; ImageHeader.ImageSize = (uint)Decode_Gamecube.GetDataSize(format, (int)Width, (int)Height); ImageData = reader.ReadBytes((int)ImageHeader.ImageSize); Platform = new GamecubeSwizzle(format); }