using Hjg.Pngcs;
using Hjg.Pngcs.Chunks;
+using Vintagestory.API.Common;
namespace Automap
{
public Snapshotter(string path, ColumnsMetadata cols, int chunkSize, int worldSeed)
{
- this.fileName = Path.Combine(path, $"snapshot_{worldSeed}_{DateTime.UtcNow:u}.png");
+ this.fileName = Path.Combine(path, $"snapshot_{worldSeed}.png");
this.chunkPath = Path.Combine(path, AutomapSystem._chunkPath);
this.cols = cols;
this.chunkSize = chunkSize;
/// <summary>
/// takes a snapshot. this should be called from an extra thread.
/// </summary>
- /// <param name="path">path to the map dir</param>
- /// <param name="chunkPath">name of the chunks dir part thing</param>
- /// <param name="cols"></param>
- /// <param name="chunkSize"></param>
public async void Take()
{
- var t = new Stopwatch();
- t.Start();
-
- Console.WriteLine("snapshot started");
ImageInfo info = new ImageInfo(Width * chunkSize, Height * chunkSize, 8, false);
+
PngWriter snapWriter = FileHelper.CreatePngWriter(fileName, info, true);
+
PngMetadata meta = snapWriter.GetMetadata( );
meta.SetTimeNow( );
var transparencyChunk = meta.CreateTRNSChunk( );
{
Console.WriteLine("Snapshot exception!");
}
- Console.WriteLine($"snapshot finished in {t.ElapsedMilliseconds}");
}
private async Task<Dictionary<int, byte[][]>> ReadAllInGroup(IGrouping<int, ColumnMeta> group)