⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdevcd8-beta4.c

📁 printer driver for the HP670, HP690, HP850, HP855 HP870, HP890, HP1100 and HP1600 color printers.
💻 C
📖 第 1 页 / 共 5 页
字号:
/* 	$Id: gdevcd8.c 1.14 1999/04/04 13:28:44 ULI12 Exp $	 */
/*
   Copyright (C) 1996-1998  <Uli Wortmann uliw@erdw.ethz.ch>
   Portions Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

   This program may also be distributed as part of Aladdin Ghostscript,
   under the terms of the Aladdin Free Public License (the "License").

   Every copy of Aladdin Ghostscript must include a copy of the
   License, normally in a plain ASCII text file named PUBLIC.  The
   License grants you the right to copy, modify and redistribute
   Aladdin Ghostscript, but only under certain conditions described in
   the License.  Among other things, the License requires that the
   copyright notice and this notice be preserved on all copies.
 */

/* gdevcd8.c */

/*----------------------------------------------------------------

   A printer driver for the HP670, HP690, HP850, HP855
   HP870, HP890, HP1100 and HP1600 color printers. 
   To be used with the Ghostscript printing system.
   
   CREDITS: Much of the driver is based on ideas derived
            from the cdj550 driver of George Cameron.
	    
	    The support for the hp670, hp690, hp890
	    and hp1600 was added by Martin Gerbershagen.

-------------------------------------------------------------------*/

/* Note: Depending on how you transfered the files, 
   you might need to remove some CR-codes used on intel-based machines:

   simply type:  unzip -a hp850.zip

   to compile with gs5.x, simply add 

   DEVICE_DEVS4=cdj850.dev cdj670.dev cdj890.dev cdj1600.dev

   to your makefile. 

   BTW, it is always a good idea to read Make.htm found in the
   gs-distrib before attempting to recompile.....

 */

/* 1999-01-07 edited by L. Peter Deutsch <ghost@aladdin.com> to eliminate
   non-const statics and otherwise bring up to date with Ghostscript coding
   style guidelines. */

/* 01.06.98   Version 1.3  Due to the most welcome contribution
   of Martin Gerbershagen (ger@ulm.temic.de),
   support for the hp670, hp690 and hp890
   and hp1600 has been added. Martin has also
   resolved all known bugs.

   Problems  :  Dark colors are still pale.


   The driver no longer needs special switches to be invoked
   except -sDEVICE=cdj850, or -sDEVICE=CDJ890, or sDEVICE=CDJ670
   or -sDEVICE=CDJ1600

   The hp690 is supported through the hp670 device, the hp855, hp870 
   and the hp1100 through the hp850 device.

   The driver implements the following switches:

   -dPapertype= 0  plain paper [default]
   1  bond paper
   2  special paper
   3  glossy film
   4  transparency film

   Note, currently the lookuptables are not suited
   for printing on special paper or transperencies.
   Please revert to the gamma functions in this case.

   -dQuality=  -1 draft     
   0 normal       [default]
   1 presentation 

   -dRetStatus= 0 C-RET off
   1 C-RET on [default]

   -dMasterGamma= 3.0 [default = 1.0]
   __Note__: To take advantage of the calibrated color-transfer
   functions, be sure not to have any Gamma-Statements
   left! If you need to (i.e. overhead sheets), 
   you still can use the gamma-functions, but they will 
   override the built-in calibration. To use gamma in the 
   traditional way, set MasterGamma to any value greater
   1.0 and less 10.0. To adjust individual gamma-values,
   you have to additionally set MasterGamma to a value
   greater 1.0 and less 10.0

   With the next release, gamma functions will be dropped.

   When using the driver, be aware that printing in 600dpi involves
   processing of large amounts of data (> 188MB !). Therefore, the
   driver is not what you would expect to be a fast driver ;-)
   This is no problem when printing a full sized color page (because
   printing itself is slow), but it's really annoying if yoy print only
   text pages. Maybe I can optimize the code for text-only pages in a
   later release. Right now, it is recommended to use the highest
   possible optimisation level your compiler offers....
   For the time beeing, use the cdj550 device with -sBitsPerPixel=3
   for fast proof-prints. If you simply want to print 600dpi b/w data,
   use the cdj550 device with -sBitsPerPixel=8 (or 1).

   Since the printer itself is slow, it may help to set the
   process-priority of the gs-process to regular or even less. On a
   486/100MHZ this is still sufficient to maintain a continuos
   data-flow.
   Note to OS/2 users: Simply put the gs-window into the background,
   or minimize it. Also make sure, that print01.sys is invoked without
   the /irq switch (great speed improvement under warp4).

   The printer default settings compensate for dot-gain by a
   calibrated color-transfer function. If this appears to be to light
   for your business-graphs, or for overhead-sheets, feel free to set
   -dMasterGamma=1.7.

   Furthermore, you may tweak the gammavalues independently by setting
   -dGammaValC, -dGammaValM, -dGammaValY or -dGammaValK (if not set,
   the values default to MasterGamma). This will only work, when
   -dMasterGamma is set to a value greater than 1.0.

   If you want to learn more about gamma, see:

   http://www.erdw.ethz.ch/~bonk/ftp/misc/gammafaq.pdf
   http://www.erdw.ethz.ch/~bonk/ftp/misc/colorfaq.pdf

   Further information, bugs, tips etc, can be found
   at my website.

   Have fun!

   Uli

   http://www.erdw.ethz.ch/~bonk/bonk.html

 */

/* 25.08.97  Version 1.2. Resolved all but one of the 
   known bugs, introduced a couple
   of perfomance improvements. Complete
   new color-transfer-function handling.
   (see gamma). */

/* 04.05.97  Version 1.1. For added features, */
/* resolved bugs and so forth, please see   */
/* http://bonk.ethz.ch                      */

/* 11.11.96. Initial release of the driver */

#include "math_.h"
#include <stdlib.h>		/* for rand() */
#include <assert.h>
#include "gdevprn.h"
#include "gdevpcl.h"
#include "gsparam.h"

/* Conversion stuff. */
#include "gxlum.h"

/* this holds the initialisation data of the hp850 */
typedef struct hp850_cmyk_init_s {
    byte a[26];
} hp850_cmyk_init_t;
private const hp850_cmyk_init_t hp850_cmyk_init =
{
    {
	0x02,			/* format */
	0x04,			/* number of components */
      /* black */
	0x01,			/* MSB x resolution */
	0x2c,			/* LSB x resolution */
	0x01,			/* MSB y resolution */
	0x2c,			/* LSB y resolution */
	0x00,			/* MSB intensity levels */
	0x02,			/* LSB intensity levels */

      /* cyan */
	0x01,			/* MSB x resolution */
	0x2c,			/* LSB x resolution */
	0x01,			/* MSB y resolution */
	0x2c,			/* LSB y resolution */
	0x00,			/* MSB intensity levels */
	0x02,			/* LSB intensity levels */

      /* magenta */
	0x01,			/* MSB x resolution */
	0x2c,			/* LSB x resolution */
	0x01,			/* MSB y resolution */
	0x2c,			/* LSB y resolution */
	0x00,			/* MSB intensity levels */
	0x02,			/* LSB intensity levels */

      /* yellow */
	0x01,			/* MSB x resolution */
	0x2c,			/* LSB x resolution */
	0x01,			/* MSB y resolution */
	0x2c,			/* LSB y resolution */
	0x00,			/* MSB intensity levels */
	0x02			/* LSB intensity levels */
    }
};

/* this holds the color lookuptable data of the hp850 */
typedef struct {
    byte c[256];		/* Lookuptable for cyan */
    byte m[256];		/* dito for magenta */
    byte y[256];		/* dito for yellow */
    byte k[256];		/* dito for black  */
    int correct[256];		/* potential undercolor black correction */
} Gamma;

private const Gamma gammat850 =
{
  /* Lookup values for cyan */
    {0, 0, 0, 2, 2, 2, 3, 3, 3, 5, 5, 5, 7, 7, 6, 7, 7, 6, 7, 7, 7, 8, 8,
     8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 12, 12, 12,
     12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 15, 16, 16, 17, 17,
     17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 22,
     22, 23, 23, 23, 23, 23, 24, 24, 25, 25, 26, 26, 26, 26, 26, 27, 27,
     27, 27, 28, 28, 29, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 34,
     35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 42,
     43, 43, 43, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 50, 50, 51, 51,
     52, 52, 53, 54, 54, 54, 55, 55, 56, 57, 58, 58, 59, 60, 60, 61, 62,
     62, 63, 65, 65, 66, 67, 67, 68, 69, 69, 70, 72, 73, 73, 74, 75, 75,
     76, 77, 79, 79, 80, 81, 82, 83, 83, 84, 86, 87, 88, 88, 89, 90, 91,
     92, 93, 94, 95, 96, 97, 97, 99, 100, 101, 102, 103, 104, 105, 106,
     108, 109, 110, 111, 112, 114, 115, 117, 119, 120, 122, 124, 125, 127,
     129, 131, 132, 135, 136, 138, 140, 142, 144, 146, 147, 150, 152, 154,
     157, 159, 162, 164, 166, 168, 171, 174, 176, 180, 182, 187, 192, 197,
     204, 215, 255},
  /* Lookup values for magenta */
    {0, 0, 0, 1, 1, 1, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7,
     7, 8, 8, 8, 9, 9, 10, 10, 9, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12,
     12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17,
     17, 17, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22,
     23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 28, 29, 29, 29, 29, 30,
     30, 31, 30, 31, 31, 32, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36,
     36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44,
     45, 45, 46, 46, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 53, 53, 54,
     54, 55, 55, 56, 57, 57, 58, 58, 59, 60, 60, 61, 61, 62, 63, 64, 65,
     66, 66, 67, 68, 68, 70, 71, 71, 72, 73, 73, 74, 76, 77, 77, 78, 79,
     79, 80, 81, 82, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 91, 92, 93,
     94, 95, 96, 97, 98, 99, 100, 100, 101, 102, 103, 105, 106, 107, 108,
     109, 112, 113, 114, 115, 116, 118, 119, 121, 123, 124, 125, 128, 129,
     130, 133, 134, 135, 138, 139, 142, 144, 145, 148, 150, 152, 154, 157,
     159, 162, 164, 168, 169, 170, 172, 175, 177, 179, 182, 185, 189, 193,
     198, 204, 215, 255},
  /* Lookup values for yellow */
    {0, 0, 0, 2, 2, 2, 3, 3, 3, 5, 5, 5, 7, 7, 6, 7, 7, 6, 7, 7, 7, 8, 8,
     8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11,
     12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 16, 16, 16, 17, 17, 18, 18,
     18, 19, 18, 19, 19, 19, 20, 20, 21, 21, 21, 22, 22, 22, 22, 22, 23,
     23, 24, 24, 25, 25, 25, 26, 27, 28, 28, 29, 29, 29, 30, 30, 30, 30,
     31, 31, 32, 32, 33, 33, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37,
     38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45,
     45, 46, 46, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 53, 53, 54, 54,
     55, 55, 56, 57, 58, 59, 59, 60, 61, 61, 62, 62, 63, 64, 65, 66, 67,
     67, 68, 69, 69, 70, 71, 72, 73, 74, 74, 75, 76, 77, 77, 78, 79, 79,
     80, 81, 82, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 91, 93, 94, 95,
     96, 97, 98, 100, 101, 102, 102, 103, 104, 106, 107, 108, 109, 110,
     111, 113, 114, 115, 116, 117, 118, 119, 121, 123, 124, 126, 128, 130,
     131, 134, 135, 137, 139, 140, 143, 145, 146, 148, 150, 152, 154, 156,
     158, 160, 163, 166, 167, 169, 171, 173, 176, 178, 181, 184, 188, 192,
     198, 204, 215, 255},
  /* Lookup values for black */
    {0, 0, 0, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 2, 4, 3, 3, 3, 3, 3, 4, 4,
     4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 9, 9, 8,
     8, 8, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13,
     12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 16, 16,
     16, 17, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 20, 20, 21, 21,
     21, 21, 22, 22, 22, 22, 23, 22, 23, 23, 24, 24, 24, 24, 25, 25, 26,
     26, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 30, 31, 31, 31, 32,
     32, 33, 33, 34, 34, 35, 36, 36, 36, 37, 37, 37, 38, 38, 40, 40, 40,
     41, 41, 42, 43, 43, 43, 43, 44, 45, 45, 46, 47, 47, 48, 49, 49, 50,
     52, 52, 53, 54, 54, 56, 56, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64,
     65, 66, 67, 68, 69, 70, 71, 72, 72, 73, 75, 75, 76, 77, 78, 80, 81,
     82, 82, 83, 84, 85, 86, 88, 89, 90, 91, 94, 95, 96, 98, 99, 100, 101,
     103, 105, 106, 107, 110, 111, 112, 115, 116, 118, 120, 121, 124, 126,
     127, 131, 133, 134, 138, 140, 141, 146, 148, 151, 154, 156, 160, 163,
     166, 169, 174, 177, 182, 187, 194, 203, 215, 255}
};

private const Gamma gammat890 =
{
/* Lookup values for cyan */
{0, 2, 3, 5, 7, 8, 10, 12, 13, 15, 16, 18, 20, 21, 23, 25, 26, 28, 29,
31, 32, 34, 36, 37, 39, 40, 42, 43, 45, 46, 48, 50, 51, 53, 54, 56, 57,
59, 60, 62, 63, 65, 66, 68, 69, 70, 72, 73, 75, 76, 78, 79, 81, 82, 83,
85, 86, 88, 89, 91, 92, 93, 95, 96, 97, 99, 100, 102, 103, 104, 106,
107, 108, 110, 111, 112, 114, 115, 116, 118, 119, 120, 121, 123, 124,
125, 127, 128, 129, 130, 132, 133, 134, 135, 137, 138, 139, 140, 141,
143, 144, 145, 146, 147, 149, 150, 151, 152, 153, 154, 155, 157, 158,
159, 160, 161, 162, 163, 164, 166, 167, 168, 169, 170, 171, 172, 173,
174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201,
201, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213,
213, 214, 215, 216, 217, 217, 218, 219, 220, 220, 221, 222, 223, 223,
224, 225, 225, 226, 227, 228, 228, 229, 230, 230, 231, 231, 232, 233,
233, 234, 235, 235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 241,
241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 247,
248, 248, 249, 249, 249, 250, 250, 250, 251, 251, 251, 252, 252, 252,
252, 253, 253, 253, 253, 254, 254, 254, 254, 254, 255, 255, 255, 255,
255, 255, 255},

/* Lookup values for magenta */ /* gamma 0.6 */ /* 0.8 */

{0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 53, 54, 55, 56, 57, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 91, 92, 93,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
109, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
122, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 132, 133,
134, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 145, 146,
147, 147, 148, 149, 150, 151, 152, 153, 153, 154, 155, 156, 157, 158,
158, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 168, 169,
170, 171, 172, 172, 173, 174, 175, 176, 176, 177, 178, 179, 179, 180,
181, 182, 182, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 191,
191, 192, 193, 193, 194, 195, 196, 196, 197, 198, 198, 199, 200, 200,
201, 202, 202, 203, 204, 204, 205, 205, 206, 207, 207, 208, 209, 209,
210, 210, 211, 211, 212, 213, 213, 214, 214, 215, 215, 216, 216, 217,
217, 218, 218, 218, 219, 219, 219, 220, 220},

/* Lookup values for yellow */ 
/* gamma 0.7 */

{0, 1, 3, 4, 6, 7, 9, 10, 11, 13, 14, 16, 17, 18, 20, 21, 23, 24, 25,
27, 28, 29, 31, 32, 34, 35, 36, 38, 39, 40, 42, 43, 44, 46, 47, 48, 50,
51, 52, 54, 55, 56, 58, 59, 60, 62, 63, 64, 66, 67, 68, 70, 71, 72, 73,
75, 76, 77, 79, 80, 81, 82, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96,
97, 99, 100, 101, 102, 104, 105, 106, 107, 109, 110, 111, 112, 113, 115,
116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 129, 130, 131,
132, 133, 134, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147,
148, 149, 150, 151, 152, 153, 154, 155, 157, 158, 159, 160, 161, 162,
163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
191, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200, 201, 202, 203,
204, 205, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -