Add webp and json generation options to the map renderer (#10367)

This commit is contained in:
Julian Giebel
2022-08-14 07:50:03 +02:00
committed by GitHub
parent bea1f595d4
commit 1390cd4019
5 changed files with 327 additions and 54 deletions

View File

@@ -19,7 +19,7 @@ namespace Content.MapRenderer.Painters
{
public sealed class MapPainter
{
public async IAsyncEnumerable<Image> Paint(string map)
public async IAsyncEnumerable<RenderedGridImage<Rgba32>> Paint(string map)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
@@ -80,7 +80,7 @@ namespace Content.MapRenderer.Painters
// Skip empty grids
if (grid.LocalAABB.IsEmpty())
{
Console.WriteLine($"Warning: Grid {grid.Index} was empty. Skipping image rendering.");
Console.WriteLine($"Warning: Grid {grid.GridEntityId} was empty. Skipping image rendering.");
continue;
}
@@ -107,7 +107,11 @@ namespace Content.MapRenderer.Painters
gridCanvas.Mutate(e => e.Flip(FlipMode.Vertical));
});
yield return gridCanvas;
var renderedImage = new RenderedGridImage<Rgba32>(gridCanvas);
renderedImage.GridUid = grid.GridEntityId;
renderedImage.Offset = grid.WorldPosition;
yield return renderedImage;
}
// We don't care if it fails as we have already saved the images.