public void ReadGtfTest(string fileName, string outPath) { using FileStream inStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); using GTF gtf = GTF.CreateFromGtfStream(inStream); using FileStream outStream = new FileStream(outPath, FileMode.Create); gtf.SavePngTo(outStream); }
public async Task ReplaceGTF(int index, Bitmap bitmap) { if (index < 0 || index > Count) { throw new ArgumentOutOfRangeException(); } int encodingType = gtfs[index].Type; gtfs[index].Dispose(); using MemoryStream ms = new MemoryStream(); await GTF.WriteGTF(ms, bitmap, encodingType); ms.Seek(0, SeekOrigin.Begin); gtfs[index] = GTF.CreateFromGtfStream(ms); ms.Seek(0, SeekOrigin.Begin); await gtfSource.Entries[index].SetData(ms); }
public static async Task <SpriteSheetSource> CreateImageSource(ParFile parFile) { SpriteSheetSource imageSource = new SpriteSheetSource(parFile); foreach (ParEntry entry in parFile.Entries) { try { imageSource.filenames.Add(entry.FileName); GTF gtf = GTF.CreateFromGtfStream(await entry.GetData()); imageSource.gtfs.Add(gtf); } catch (Exception) { throw; } } return(imageSource); }