summaryrefslogtreecommitdiff
path: root/ppm/main.zig
blob: 6e1bb1b741aff87d614830d46b4a8de90bb6bf85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);
}