xref: /inferno-os/module/print.m (revision 46439007cf417cbd9ac8049bb4122c890097a0fa)
1Print: module
2{
3	PATH: con "/dis/lib/print/print.dis";
4	CONFIG_PATH: con "/lib/print/";
5
6	init: fn(): int;
7	set_printfd: fn(fd: ref Sys->FD);
8	print_image: fn(p: ref Printer, display: ref Draw->Display, im: ref Draw->Image, pcwidth: int, cancel: chan of int): int;
9	print_textfd: fn(p: ref Printer, fd: ref Sys->FD, ps: real, pr: int, wrap: int): int;
10	get_defprinter: fn(): ref Printer;
11	set_defprinter: fn(p: ref Printer);
12	get_size: fn(p: ref Printer): (int, int, int);	# dpi, xpixels, ypixels
13	get_printers: fn(): list of ref Printer;
14	get_papers: fn(): list of ref Paper;
15	save_settings: fn(): int;
16
17	# Printer types
18
19	Ptype: adt {
20		name: string;
21		desc: string;
22		modes: list of ref Pmode;
23		driver: string;
24		hpmapfile: string;
25	};
26
27	# Paper sizes
28
29	Paper: adt {
30		name: string;
31		hpcode: string;
32		width_inches: real;
33		height_inches: real;
34	};
35
36	# Print modes
37
38	Pmode: adt {
39		name: string;
40		desc: string;
41		resx: int;
42		resy: int;
43		blackdepth: int;
44		coldepth: int;
45		blackresmult: int;
46	};
47
48	# Print options
49
50	Popt: adt {
51		name: string;
52		mode: ref Pmode;
53		paper: ref Paper;
54		orientation: int;
55		duplex: int;
56	};
57
58	# Printer instance
59
60	PORTRAIT: con 0;
61	LANDSCAPE: con 1;
62
63	DUPLEX_OFF: con 0;
64	DUPLEX_LONG: con 1;
65	DUPLEX_SHORT: con 2;
66
67	Printer: adt {
68		name: string;
69		ptype: ref Ptype;
70		device: string;
71		popt: ref Popt;
72		pdriver: Pdriver;
73	};
74
75};
76
77
78Pdriver: module
79{
80	PATHPREFIX: con "/dis/lib/print/";
81	DATAPREFIX: con "/lib/print/";
82
83	init: fn(debug: int);
84	sendimage: fn(p: ref Print->Printer, tfd: ref Sys->FD, display: ref Draw->Display, im: ref Draw->Image, width: int, lmargin: int, cancel: chan of int): int;
85	sendtextfd: fn(p: ref Print->Printer, pfd, tfd: ref Sys->FD, ps: real, pr: int, wrap: int): int;
86	printable_pixels: fn(p: ref Print->Printer): (int, int);
87
88};
89