Media
vraster
A small software rasterizer that draws lines and shapes into an image.
Released v1.0.0 · 2026-09-28use "stdlib/raster.ven"
A minimal 2D software rasterizer, built on Venutian's own list and tuple builtins with in place index assignment, and no dependency on an operating system window. Its output is a PPM image written as text, not a live display, so a program using it produces a real image file rather than something shown on screen.
print canvas_new(4, 3)
Reference (12 functions)
API reference
pixel_index(canvas, x, y)
Converts an (x, y) pixel coordinate into its flat index into canvas.pixels.
pixel_index(canvas_new(4, 3), 2, 1)clamp_channel(v)
clamp_channel(300)canvas_set_pixel(canvas, x, y, r, g, b)
canvas_set_pixel(canvas_new(2, 2), 1, 1, 255, 0, 0)canvas_get_pixel(canvas, x, y)
canvas_get_pixel(canvas_new(2, 2), 0, 0)sign_int(n)
sign_int(-3)draw_line(canvas, x0, y0, x1, y1, r, g, b)
draw_line(canvas_new(5, 5), 0, 0, 4, 4, 255, 255, 255)plot_circle_octants(canvas, cx, cy, x, y, r, g, b)
Plots the eight symmetric points of one midpoint-circle step around (cx, cy).
plot_circle_octants(canvas_new(9, 9), 4, 4, 0, 3, 0, 255, 0)draw_circle(canvas, cx, cy, radius, r, g, b)
draw_circle(canvas_new(9, 9), 4, 4, 3, 0, 255, 0)fill_rect(canvas, x0, y0, x1, y1, r, g, b)
fill_rect(canvas_new(4, 4), 1, 1, 2, 2, 10, 20, 30)canvas_to_ppm(canvas)
canvas_to_ppm(canvas_new(2, 1))