Plan 9 from Bell Labs’s /usr/web/sources/contrib/maht/inferno/appl/cmd/rooster/ppm.m

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


# ppm.b

Images: module
{
	PATH : con "/appl/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;

#		create_ppm : fn(b : self ref Image, filename : string);
		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);

};


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.