using XFESystem.Branding;
if (args.Length != 1) throw new ArgumentException("Usage: BootAnimationPreview <new frame directory>");
string output = Path.GetFullPath(args[0]);
if (Directory.Exists(output)) throw new IOException("Preserve prior previews; choose a new directory.");
Directory.CreateDirectory(output);
const int width = 960, height = 540;
uint[] pixels = new uint[width * height];
for (int frame = 0; frame < 144; frame++)
{
int milliseconds = frame * 1000 / 30;
unsafe { fixed (uint* pointer = pixels) BootVisual.Draw(pointer, width, height, width, (ulong)milliseconds, milliseconds >= BootVisual.IntroMilliseconds); }
using var stream = File.Create(Path.Combine(output, frame.ToString("D4") + ".ppm"));
stream.Write(System.Text.Encoding.ASCII.GetBytes($"P6\n{width} {height}\n255\n"));
byte[] row = new byte[width * 3];
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{ uint rgb = pixels[y * width + x]; row[x*3] = (byte)(rgb >> 16); row[x*3+1] = (byte)(rgb >> 8); row[x*3+2] = (byte)rgb; }
stream.Write(row);
}
}
Console.WriteLine(output);
using XFESystem.Branding;
if (args.Length != 1) throw new ArgumentException("Usage: BootAnimationPreview <new frame directory>");
string output = Path.GetFullPath(args[0]);
if (Directory.Exists(output)) throw new IOException("Preserve prior previews; choose a new directory.");
Directory.CreateDirectory(output);
const int width = 960, height = 540;
uint[] pixels = new uint[width * height];
for (int frame = 0; frame < 144; frame++)
{
int milliseconds = frame * 1000 / 30;
unsafe { fixed (uint* pointer = pixels) BootVisual.Draw(pointer, width, height, width, (ulong)milliseconds, milliseconds >= BootVisual.IntroMilliseconds); }
using var stream = File.Create(Path.Combine(output, frame.ToString("D4") + ".ppm"));
stream.Write(System.Text.Encoding.ASCII.GetBytes($"P6\n{width} {height}\n255\n"));
byte[] row = new byte[width * 3];
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{ uint rgb = pixels[y * width + x]; row[x*3] = (byte)(rgb >> 16); row[x*3+1] = (byte)(rgb >> 8); row[x*3+2] = (byte)rgb; }
stream.Write(row);
}
}
Console.WriteLine(output);