home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 5
/
FreshFish_July-August1994.bin
/
bbs
/
gnu
/
gs-2.6.1.4-src.lha
/
src
/
amiga
/
gs-2.6.1.4
/
gdevcdj.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-27
|
49KB
|
1,526 lines
/* Copyright (C) 1991, 1992, 1993 Aladdin Enterprises. All rights reserved.
This file is part of Ghostscript.
Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
to anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing. Refer
to the Ghostscript General Public License for full details.
Everyone is granted permission to copy, modify and redistribute
Ghostscript, but only under the conditions described in the Ghostscript
General Public License. A copy of this license is supposed to have been
given to you along with Ghostscript so you can know your rights and
responsibilities. It should be in a file named COPYING. Among other
things, the copyright notice and this notice must be preserved on all
copies. */
/* gdevcdj.c */
/* H-P colour printer drivers for Ghostscript */
#include "std.h" /* to stop stdlib.h redefining types */
#include <stdlib.h> /* for rand() */
#include "gdevprn.h"
#include "gdevpcl.h"
#include "gsprops.h"
/***
*** Note: this driver was contributed by a user, George Cameron:
*** please contact g.cameron@biomed.abdn.ac.uk if you have questions.
***/
/*
* Note that there are six drivers contained in this code:
*
* 1 - cdj500: HP DeskJet 500C
* 2 - cdj550: HP DeskJet 550C
* 3 - pjxl300: HP PaintJet XL300
* 4 - pj: HP PaintJet
* 5 - pjxl: HP PaintJet XL
* 6 - declj250: DEC LJ250
*
* All of these drivers have 8-bit (monochrome), 16-bit and 24-bit
* (colour) and for the DJ 550C 32-bit, (colour, cmyk mode)
* options in addition to the usual 1-bit and 3-bit modes
* It is also possible to set various printer-specific parameters
* from the gs command line, eg.
*
* gs -sDEVICE=cdj550 -dBitsPerPixel=16 -dDepletion=1 -dShingling=2 tiger.ps
*
* Please consult the appropriate section in the devices.doc file for
* further details on all these drivers.
*/
#define DESKJET_PRINT_LIMIT 0.04 /* 'real' top margin? */
#define PAINTJET_PRINT_LIMIT 0.0 /* This is a guess.. */
/* Margins are left, bottom, right, top. */
#define DESKJET_MARGINS_LETTER 0.25, 0.50, 0.25, 0.167
#define DESKJET_MARGINS_A4 0.125, 0.50, 0.143, 0.167
#define PAINTJET_MARGINS_LETTER 0.167, 0.167, 0.167, 0.167
#define PAINTJET_MARGINS_A4 0.167, 0.167, 0.167, 0.167
#define PAINTJET_MARGINS_A3 0.167, 0.167, 0.167, 0.167
/* Default page size is US-Letter or A4 (other sizes from command line) */
#ifndef A4
# define WIDTH_10THS 85
# define HEIGHT_10THS 110
#else
# define WIDTH_10THS 83 /* 210mm */
# define HEIGHT_10THS 117 /* 297mm */
#endif
/* Define bits-per-pixel for generic drivers - default is 24-bit mode */
#ifndef BITSPERPIXEL
# define BITSPERPIXEL 24
#endif
#define W sizeof(word)
#define I sizeof(int)
/* Printer types */
#define DJ500C 0
#define DJ550C 1
#define PJXL300 2
#define PJ180 3
#define PJXL180 4
#define DECLJ250 5
/* No. of ink jets (used to minimise head movements) */
#define HEAD_ROWS_MONO 50
#define HEAD_ROWS_COLOUR 16
/* Colour mapping procedures */
private dev_proc_map_rgb_color (gdev_pcl_map_rgb_color);
private dev_proc_map_color_rgb (gdev_pcl_map_color_rgb);
/* Print-page, properties and miscellaneous procedures */
private dev_proc_open_device(dj500c_open);
private dev_proc_open_device(dj550c_open);
private dev_proc_open_device(pjxl300_open);
private dev_proc_open_device(pjxl_open);
private dev_proc_open_device(pj_open);
private dev_proc_print_page(dj500c_print_page);
private dev_proc_print_page(dj550c_print_page);
private dev_proc_print_page(pjxl_print_page);
private dev_proc_print_page(pj_print_page);
private dev_proc_print_page(pjxl300_print_page);
private dev_proc_print_page(declj250_print_page);
private dev_proc_get_props(cdj_get_props);
private dev_proc_get_props(pjxl_get_props);
private dev_proc_get_props(pj_get_props);
private dev_proc_put_props(cdj_put_props);
private dev_proc_put_props(pjxl_put_props);
private dev_proc_put_props(pj_put_props);
/* The device descriptors */
typedef struct gx_device_cdj_s gx_device_cdj;
struct gx_device_cdj_s {
gx_device_common;
gx_prn_device_common;
int correction; /* Black correction parameter */
int shingling; /* Interlaced, multi-pass printing */
int depletion; /* 'Intelligent' dot-removal */
};
typedef struct gx_device_pjxl_s gx_device_pjxl;
struct gx_device_pjxl_s {
gx_device_common;
gx_prn_device_common;
uint correction; /* Black correction parameter */
int printqual; /* Mechanical print quality */
int rendertype; /* Driver or printer dithering control */
};
typedef struct gx_device_hp_s gx_device_hp;
struct gx_device_hp_s {
gx_device_common;
gx_prn_device_common;
uint correction; /* Black correction parameter
* (used only by DJ500C) */
};
typedef struct gx_device_hp_s gx_device_pj;
#define hp_device ((gx_device_hp *)pdev)
#define cdj ((gx_device_cdj *)pdev)
#define pjxl ((gx_device_pjxl *)pdev)
#define pj ((gx_device_pj *)pdev)
#define prn_hp_colour_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page)\
prn_device_body(gx_device_printer, procs, dev_name,\
WIDTH_10THS, HEIGHT_10THS, x_dpi, y_dpi, 0, 0, 0, 0, 0,\
bpp, 0, 0, 0, 0, print_page)
#define cdj_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page, correction, shingling, depletion)\
{ prn_hp_colour_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page),\
correction,\
shingling,\
depletion\
}
#define pjxl_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page, printqual, rendertype)\
{ prn_hp_colour_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page), 0, \
printqual,\
rendertype\
}
#define pj_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page)\
{ prn_hp_colour_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page), 0\
}
#define hp_colour_procs(proc_colour_open, proc_get_props, proc_put_props) {\
proc_colour_open,\
gdev_pcl_get_initial_matrix,\
gx_default_sync_output,\
gdev_prn_output_page,\
gdev_prn_close,\
gdev_pcl_map_rgb_color,\
gdev_pcl_map_color_rgb,\
NULL, /* fill_rectangle */\
NULL, /* tile_rectangle */\
NULL, /* copy_mono */\
NULL, /* copy_color */\
NULL, /* draw_line */\
gx_default_get_bits,\
proc_get_props,\
proc_put_props\
}
private gx_device_procs cdj500_procs =
hp_colour_procs(dj500c_open, cdj_get_props, cdj_put_props);
private gx_device_procs cdj550_procs =
hp_colour_procs(dj550c_open, cdj_get_props, cdj_put_props);
private gx_device_procs pjxl300_procs =
hp_colour_procs(pjxl300_open, pjxl_get_props, pjxl_put_props);
private gx_device_procs pjxl_procs =
hp_colour_procs(pjxl_open, pjxl_get_props, pjxl_put_props);
private gx_device_procs pj_procs =
hp_colour_procs(pj_open, pj_get_props, pj_put_props);
gx_device_cdj far_data gs_cdjmono_device =
cdj_device(cdj500_procs, "cdjmono", 300, 300, 1,
dj500c_print_page, 4, 0, 1);
gx_device_cdj far_data gs_cdeskjet_device =
cdj_device(cdj500_procs, "cdeskjet", 300, 300, 3,
dj500c_print_page, 4, 2, 1);
gx_device_cdj far_data gs_cdjcolor_device =
cdj_device(cdj500_procs, "cdjcolor", 300, 300, 24,
dj500c_print_page, 4, 2, 1);
gx_device_cdj far_data gs_cdj500_device =
cdj_device(cdj500_procs, "cdj500", 300, 300, BITSPERPIXEL,
dj500c_print_page, 4, 2, 1);
gx_device_cdj far_data gs_cdj550_device =
cdj_device(cdj550_procs, "cdj550", 300, 300, BITSPERPIXEL,
dj550c_print_page, 0, 2, 1);
gx_device_pjxl far_data gs_pjxl300_device =
pjxl_device(pjxl300_procs, "pjxl300", 300, 300, BITSPERPIXEL,
pjxl300_print_page, 0, 0);
gx_device_pjxl far_data gs_pjxl_device =
pjxl_device(pjxl_procs, "pjxl", 180, 180, BITSPERPIXEL,
pjxl_print_page, 0, 0);
gx_device_pj far_data gs_pj_device =
pj_device(pj_procs, "pj", 180, 180, BITSPERPIXEL,
pj_print_page);
gx_device_pj far_data gs_declj250_device =
pj_device(pj_procs, "declj250", 180, 180, BITSPERPIXEL,
declj250_print_page);
/* Forward references