# ppm.b Images: module { PATH : con "/dis/lib/ppm.dis"; init: fn(nil: ref Draw->Context, argv: list of string); Pixel : adt { r, g, b : int; }; Bitmap : adt { width, height : int; pick { bit8 => pixels : array of byte; bit16 => pixels : array of int; rgba8 => pixels : array of byte; } }; Image : adt { width, height, format, maxval, numchannels : int; bitmap : ref Bitmap; dataoffset : big; fd : ref Sys->FD; open_ppm : fn(b : self ref Image, filename : string) : ref sys->FD; write_to_ppm_pixel : fn(b : self ref Image, x, y, v, channel : int) : int; }; new_rgba8 : fn(width, height : int) : ref Image; create_ppm : fn(i : ref Image, filename : string); };