summaryrefslogblamecommitdiff
path: root/ppm/main.zig
blob: 6e1bb1b741aff87d614830d46b4a8de90bb6bf85 (plain) (tree)





















                                                            
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);
}