summaryrefslogtreecommitdiff
path: root/ppm/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'ppm/main.zig')
-rw-r--r--ppm/main.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/ppm/main.zig b/ppm/main.zig
new file mode 100644
index 0000000..6e1bb1b
--- /dev/null
+++ b/ppm/main.zig
@@ -0,0 +1,22 @@
+const std = @import("std");
+const ppm = @import("ppm.zig");
+
+pub fn main() !void {
+ var img = ppm.ppm(200, 200).init;
+ defer img.dump("test.ppm") catch unreachable;
+
+ for (img.row(10)) |*px| {
+ px.*.r = 255;
+ }
+ for (img.row(20)) |*px| {
+ px.*.g = 255;
+ }
+ for (img.row(30)) |*px| {
+ px.*.b = 255;
+ }
+
+ const white = ppm.Pixel{ .r = 255, .g = 255, .b = 255 };
+
+ img.set(100, 100, white);
+ img.set(199, 199, white);
+}