Skip to content

Commit

Permalink
Fix palette builder for new version
Browse files Browse the repository at this point in the history
  • Loading branch information
csinkers committed Apr 27, 2024
1 parent 81319d2 commit 10e0eb6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Tools/PaletteBuilder/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ static Palette BuildPalette(CommandLine options)
{
using var stream = File.OpenRead(file);
var image = Image.Load<Rgba32>(stream);
if (!image.TryGetSinglePixelSpan(out var pixelSpan))
if (!image.DangerousTryGetSinglePixelMemory(out var pixelMemory))
{
Console.WriteLine($"Could not read pixels from {file}");
continue;
}

builder.Add(pixelSpan);
builder.Add(pixelMemory.Span);
Console.Write('.');
}
}
Expand Down Expand Up @@ -93,10 +93,10 @@ static void ConvertAll(IEnumerable<string> directories, Palette palette)
{
using var stream = File.OpenRead(file);
var image = Image.Load<Rgba32>(stream);
if (!image.TryGetSinglePixelSpan(out var pixelSpan))
if (!image.DangerousTryGetSinglePixelMemory(out var pixelMemory))
continue;

var pixels = palette.Convert(pixelSpan);
var pixels = palette.Convert(pixelMemory.Span);
WriteBitmap(Path.ChangeExtension(file, "bmp"), palette.Colours, pixels, image.Width);
Console.Write('.');
}
Expand Down

0 comments on commit 10e0eb6

Please sign in to comment.