3 ms·
When I want a quick way to get pixels on the screen I just print a PPM image to stdout and pipe my program into `feh -`. There are two PPM formats, both very s
by boomlinde 5y ago
When I want a quick way to get pixels on the screen I just print a PPM image to stdout and pipe my program into `feh -`.
There are two PPM formats, both very simple: http://netpbm.sourceforge.net/doc/ppm.html http://netpbm.sourceforge.net/doc/ppm.html
For example, the header
printf("P6\n%lu %lu\n255\n", width, height);
followed by width*height triplets of raw bytes representing the RGB values of each pixel.