Data update

This commit is contained in:
Ingy döt Net 2023-07-01 19:04:33 -04:00
parent 8f05c7136f
commit 0bf4da02c3
82 changed files with 2194 additions and 118 deletions

View file

@ -21,18 +21,18 @@ fn ImageData() type {
}
/// Write PGM P2 ASCII to 'writer'
pub fn print(self: *const Self, writer: anytype, optional_comments: ?[]const []const u8) !void {
_ = try writer.print("P2\n", .{});
try writer.print("P2\n", .{});
if (optional_comments) |lines| {
for (lines) |line|
_ = try writer.print("# {s}\n", .{line});
try writer.print("# {s}\n", .{line});
}
_ = try writer.print("{d} {d}\n{d}\n", .{ self.w, self.h, 255 });
try writer.print("{d} {d}\n{d}\n", .{ self.w, self.h, 255 });
for (self.image, 0..) |pixel, i| {
const sep = if (i % self.w == self.w - 1) "\n" else " ";
_ = try writer.print("{d}{s}", .{ pixel.w, sep });
try writer.print("{d}{s}", .{ pixel.w, sep });
}
}
};