aboutsummaryrefslogtreecommitdiff
path: root/print/ghostscript8/files/patch-pcl3_eprn_eprnrend.c
blob: 69dd96167b0c3ac31be867fff8fdb13820521b59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
51
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
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
--- pcl3/eprn/eprnrend.c.orig	Wed Aug  1 14:12:56 2001
+++ pcl3/eprn/eprnrend.c	Tue May 24 20:19:18 2005
@@ -161,8 +161,11 @@
 ******************************************************************************/
 
 gx_color_index eprn_map_rgb_color_for_RGB(gx_device *device,
-  gx_color_value red, gx_color_value green, gx_color_value blue)
+  const gx_color_value cv[])
 {
+  gx_color_value red = cv[0]; 
+  gx_color_value green = cv[1]; 
+  gx_color_value blue = cv[2];
   static const gx_color_value half = gx_max_color_value/2;
   gx_color_index value = 0;
   const eprn_Device *dev = (eprn_Device *)device;
@@ -197,8 +200,11 @@
 ******************************************************************************/
 
 gx_color_index eprn_map_rgb_color_for_CMY_or_K(gx_device *device,
-  gx_color_value red, gx_color_value green, gx_color_value blue)
+  const gx_color_value cv[])
 {
+  gx_color_value red = cv[0];
+  gx_color_value green = cv[1];
+  gx_color_value blue = cv[2];
   static const gx_color_value half = gx_max_color_value/2;
   gx_color_index value = (CYAN_BIT | MAGENTA_BIT | YELLOW_BIT);
   const eprn_Device *dev = (eprn_Device *)device;
@@ -240,8 +246,11 @@
 ******************************************************************************/
 
 gx_color_index eprn_map_rgb_color_for_RGB_flex(gx_device *device,
-  gx_color_value red, gx_color_value green, gx_color_value blue)
+  const gx_color_value cv[])
 {
+  gx_color_value red = cv[0]; 
+  gx_color_value green = cv[1]; 
+  gx_color_value blue = cv[2];
   gx_color_index value = 0;
   gx_color_value step;
   unsigned int level;
@@ -284,8 +293,12 @@
 ******************************************************************************/
 
 gx_color_index eprn_map_rgb_color_for_CMY_or_K_flex(gx_device *device,
-  gx_color_value red, gx_color_value green, gx_color_value blue)
+  const gx_color_value cv[])
 {
+  gx_color_value red = cv[0];
+  gx_color_value green = cv[1];
+  gx_color_value blue = cv[2];
+  gx_color_value tmpcv[4];
   const eprn_Device *dev = (eprn_Device *)device;
 
 #ifdef EPRN_TRACE
@@ -298,11 +311,17 @@
   /* Treat pure grey levels differently if we have black. This implies that for
      CMY+K only "true" grey shades will be printed with black ink, all others
      will be mixed from CMY. */
-  if (dev->eprn.colour_model != eprn_DeviceCMY && red == green && green == blue)
-    return eprn_map_cmyk_color_flex(device, 0, 0, 0, gx_max_color_value - red);
+  if (dev->eprn.colour_model != eprn_DeviceCMY && red == green && green == blue) {
+    tmpcv[0] = 0; tmpcv[1] = 0; tmpcv[2] = 0;
+    tmpcv[3] = gx_max_color_value - red;
+    return eprn_map_cmyk_color_flex(device, tmpcv);
 
-  return eprn_map_cmyk_color_flex(device, gx_max_color_value - red,
-    gx_max_color_value - green, gx_max_color_value - blue, 0);
+  }
+  tmpcv[0] = gx_max_color_value - red; 
+  tmpcv[1] = gx_max_color_value - green; 
+  tmpcv[2] = gx_max_color_value - blue; 
+  tmpcv[3] = 0;
+  return eprn_map_cmyk_color_flex(device, tmpcv);
 }
 
 /******************************************************************************
@@ -315,8 +334,11 @@
 ******************************************************************************/
 
 gx_color_index eprn_map_rgb_color_for_RGB_max(gx_device *device,
-  gx_color_value red, gx_color_value green, gx_color_value blue)
+  const gx_color_value cv[])
 {
+  gx_color_value red = cv[0]; 
+  gx_color_value green = cv[1];
+  gx_color_value blue = cv[2];
   gx_color_index value;
 
 #ifdef EPRN_TRACE
@@ -345,8 +367,12 @@
 ******************************************************************************/
 
 gx_color_index eprn_map_rgb_color_for_CMY_or_K_max(gx_device *device,
-  gx_color_value red, gx_color_value green, gx_color_value blue)
+  const gx_color_value cv[])
 {
+  gx_color_value red = cv[0];
+  gx_color_value green = cv[1];
+  gx_color_value blue = cv[2];
+  gx_color_value tmpcv[4];
   const eprn_Device *dev = (eprn_Device *)device;
 
 #ifdef EPRN_TRACE
@@ -356,13 +382,18 @@
     red, green, blue);
 #endif
 
-  if (dev->eprn.colour_model == eprn_DeviceGray)
-    return eprn_map_cmyk_color_max(device, 0, 0, 0, gx_max_color_value - red);
-
+  if (dev->eprn.colour_model == eprn_DeviceGray) {
+    tmpcv[0] = 0; tmpcv[1] = 0; tmpcv[2] = 0;
+    tmpcv[3] = gx_max_color_value - red;
+    return eprn_map_cmyk_color_max(device, tmpcv);
+  }
   /* Note that the conversion from composite black to true black for CMY+K can
      only happen at the output pixel level, not here. */
-  return eprn_map_cmyk_color_max(device, gx_max_color_value - red,
-    gx_max_color_value - green, gx_max_color_value - blue, 0);
+  tmpcv[0] = gx_max_color_value - red; 
+  tmpcv[1] = gx_max_color_value - green; 
+  tmpcv[2] = gx_max_color_value - blue; 
+  tmpcv[3] = 0;
+  return eprn_map_cmyk_color_max(device, tmpcv);
 }
 
 /******************************************************************************
@@ -389,7 +420,7 @@
 ******************************************************************************/
 
 int eprn_map_color_rgb(gx_device *device, gx_color_index color,
-  gx_color_value rgb[3])
+  gx_color_value rgb[])
 {
 #ifdef EPRN_TRACE
   if_debug1(EPRN_TRACE_CHAR,
@@ -415,9 +446,12 @@
 ******************************************************************************/
 
 gx_color_index eprn_map_cmyk_color(gx_device *device,
-  gx_color_value cyan, gx_color_value magenta, gx_color_value yellow,
-  gx_color_value black)
+  const gx_color_value cv[])
 {
+  gx_color_value cyan = cv[0];
+  gx_color_value magenta = cv[1];
+  gx_color_value yellow = cv[2];
+  gx_color_value black = cv[3];
   gx_color_index value = 0;
   static const gx_color_value threshold = gx_max_color_value/2;
 
@@ -449,9 +483,12 @@
 ******************************************************************************/
 
 gx_color_index eprn_map_cmyk_color_flex(gx_device *device,
-  gx_color_value cyan, gx_color_value magenta, gx_color_value yellow,
-  gx_color_value black)
+  const gx_color_value cv[])
 {
+  gx_color_value cyan = cv[0];
+  gx_color_value magenta = cv[1];
+  gx_color_value yellow = cv[2];
+  gx_color_value black = cv[3];
   gx_color_index value = 0;
   gx_color_value step;
   unsigned int level;
@@ -530,9 +567,12 @@
 ******************************************************************************/
 
 gx_color_index eprn_map_cmyk_color_max(gx_device *device,
-  gx_color_value cyan, gx_color_value magenta, gx_color_value yellow,
-  gx_color_value black)
+  const gx_color_value cv[])
 {
+  gx_color_value cyan = cv[0];
+  gx_color_value magenta = cv[1];
+  gx_color_value yellow = cv[2];
+  gx_color_value black = cv[3];
   gx_color_index value;
 
 #ifdef EPRN_TRACE