386BSD 0.1 development
[unix-history] / usr / othersrc / public / ghostscript-2.4.1 / gdevbit.c
CommitLineData
50802ec0
WJ
1/* Copyright (C) 1991 Aladdin Enterprises. All rights reserved.
2 Distributed by Free Software Foundation, Inc.
3
4This file is part of Ghostscript.
5
6Ghostscript is distributed in the hope that it will be useful, but
7WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
8to anyone for the consequences of using it or for whether it serves any
9particular purpose or works at all, unless he says so in writing. Refer
10to the Ghostscript General Public License for full details.
11
12Everyone is granted permission to copy, modify and redistribute
13Ghostscript, but only under the conditions described in the Ghostscript
14General Public License. A copy of this license is supposed to have been
15given to you along with Ghostscript so you can know your rights and
16responsibilities. It should be in a file named COPYING. Among other
17things, the copyright notice and this notice must be preserved on all
18copies. */
19
20/* gdevbit.c */
21/* Fake bitmapped device to estimate rendering time. */
22#include "gdevprn.h"
23
24/* Define the device parameters. */
25#define X_DPI 400
26#define Y_DPI 400
27#define WIDTH_10THS 80 /* 440 */
28#define HEIGHT_10THS 80 /* 1080 */
29
30/* The device descriptor */
31private dev_proc_print_page(bit_print_page);
32gx_device_printer gs_bit_device =
33 prn_device(prn_std_procs, "bit",
34 WIDTH_10THS, HEIGHT_10THS,
35 X_DPI, Y_DPI,
36 0,0,0,0, /* margins */
37 1, bit_print_page);
38
39/* Send the page to the printer. */
40private int
41bit_print_page(gx_device_printer *pdev, FILE *prn_stream)
42{ /* Just dump the bits on the file. */
43 int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
44 int lnum;
45 byte *in = (byte *)gs_malloc(line_size, 1, "bit_print_page(in)");
46 if ( in == 0 ) return -1;
47 for ( lnum = 0; lnum < pdev->height; lnum++ )
48 { gdev_prn_copy_scan_lines(pdev, lnum, in, line_size);
49/****** fwrite(in, 1, line_size, prn_stream);
50 ******/
51 }
52 gs_free(in, line_size, 1, "bit_print_page(in)");
53 return 0;
54}