aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/dpstk/CSBwraps.psw
blob: 02a2041ee118347d291f6b0cceab7eeb13a4e34c (plain)
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
/* 
 * CSBwraps.psw
 *
 * (c) Copyright 1993-1994 Adobe Systems Incorporated.
 * All rights reserved.
 * 
 * Permission to use, copy, modify, distribute, and sublicense this software
 * and its documentation for any purpose and without fee is hereby granted,
 * provided that the above copyright notices appear in all copies and that
 * both those copyright notices and this permission notice appear in
 * supporting documentation and that the name of Adobe Systems Incorporated
 * not be used in advertising or publicity pertaining to distribution of the
 * software without specific, written prior permission.  No trademark license
 * to use the Adobe trademarks is hereby granted.  If the Adobe trademark
 * "Display PostScript"(tm) is used to describe this software, its
 * functionality or for any other purpose, such use shall be limited to a
 * statement that this software works in conjunction with the Display
 * PostScript system.  Proper trademark attribution to reflect Adobe's
 * ownership of the trademark shall be given whenever any such reference to
 * the Display PostScript system is made.
 * 
 * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
 * ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
 * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NON- INFRINGEMENT OF THIRD PARTY RIGHTS.  IN NO EVENT SHALL ADOBE BE LIABLE
 * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
 * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.  ADOBE WILL NOT
 * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
 * 
 * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
 * Incorporated which may be registered in certain jurisdictions
 * 
 * Author:  Adobe Systems Incorporated
 */

defineps _DPSCColormapMatch(DPSContext ctxt; int colormap | boolean *match)
    currentXgcdrawablecolor	% gc draw x y [....colormap...]
    10 get colormap eq match    % gc draw x y
    pop pop pop pop
endps

defineps _DPSCTriangle(DPSContext ctxt; double h, w)
    newpath
    0 0 moveto
    w 0 rlineto
    0 h rlineto
    closepath
    fill
endps

defineps _DPSCShowFillMe(DPSContext ctxt; char *str)
    /Helvetica-Bold 12 selectfont
    2 5 moveto
    0 setgray
    (str) show
endps

defineps _DPSCShowMessage(DPSContext ctxt; char *str)
    1 setgray
    0 0 1000 1000 rectfill
    /Helvetica-Bold 12 selectfont
    10 2 moveto
    0 setgray
    (str) show
endps

defineps _DPSCRGBBlend(DPSContext ctxt; double x, y, width, height;
		       char *function; int steps)
    gsave
    x y translate
    width steps div
    0 1 steps 1 sub {
	steps div (function) cvx exec setrgbcolor
	dup 0 0 3 -1 roll height rectfill
	dup 0 translate
    } for
    pop
    grestore
endps

defineps _DPSCHSBBlend(DPSContext ctxt; double x, y, width, height;
		       char *function; int steps)
    gsave
    x y translate
    width steps div
    0 1 steps 1 sub {
	steps div (function) cvx exec sethsbcolor
	dup 0 0 3 -1 roll height rectfill
	dup 0 translate
    } for
    pop
    grestore
endps

defineps _DPSCCMYKBlend(DPSContext ctxt; double x, y, width, height;
			char *function; int steps)
    gsave
    x y translate
    width steps div
    0 1 steps 1 sub {
	steps div (function) cvx exec setcmykcolor
	dup 0 0 3 -1 roll height rectfill
	dup 0 translate
    } for
    pop
    grestore
endps

defineps _DPSCGrayBlend(DPSContext ctxt; double x, y, width, height;
			char *function; int steps)
    gsave
    x y translate
    width steps div
    0 1 steps 1 sub {
	steps div (function) cvx exec setgray
	dup 0 0 3 -1 roll height rectfill
	dup 0 translate
    } for
    pop
    grestore
endps

defineps _DPSCGetInvCTM(DPSContext ctxt; | float invctm[6])
    matrix currentmatrix matrix invertmatrix invctm
endps

defineps _DPSCDoRGBColorPalette(DPSContext ctxt; char *func;
				double red, green, blue; double width, height;
				int steps | boolean *success)
    mark {
	gsave
	0 0 translate
	width steps div
	0 1 steps 1 sub {
	    steps div red green blue 4 -1 roll func setrgbcolor
	    dup 0 0 3 -1 roll height rectfill
	    dup 0 translate
	} for
	pop
	grestore
    } stopped not success cleartomark
endps

defineps _DPSCDoCMYKColorPalette(DPSContext ctxt; char *func;
				 double cyan, magenta, yellow, black;
				 double width, height;
				 int steps | boolean *success)
    mark {
	gsave
	0 0 translate
	width steps div
	0 1 steps 1 sub {
	    steps div cyan magenta yellow black 5 -1 roll func setcmykcolor
	    dup 0 0 3 -1 roll height rectfill
	    dup 0 translate
	} for
	pop
	grestore
    } stopped not success cleartomark
endps

defineps _DPSCDoHSBColorPalette(DPSContext ctxt; char *func;
				double hue, sat, bright;
				double width, height;
				int steps | boolean *success)
    mark {
	gsave
	0 0 translate
	width steps div
	0 1 steps 1 sub {
	    steps div hue sat bright 4 -1 roll func sethsbcolor
	    dup 0 0 3 -1 roll height rectfill
	    dup 0 translate
	} for
	pop
	grestore
    } stopped not success cleartomark
endps

defineps _DPSCDoGrayColorPalette(DPSContext ctxt; char *func;
				 double gray; double width, height;
				 int steps | boolean *success)
    mark {
	gsave
	0 0 translate
	width steps div
	0 1 steps 1 sub {
	    steps div gray exch func setgray
	    dup 0 0 3 -1 roll height rectfill
	    dup 0 translate
	} for
	pop
	grestore
    } stopped not success cleartomark
endps


defineps _DPSCDoRGBPalette(DPSContext ctxt; char *func;
			   double width, height;
			   int steps | boolean *success)
    mark {
	gsave
	0 0 translate
	width steps div
	0 1 steps 1 sub {
	    steps div func setrgbcolor
	    dup 0 0 3 -1 roll height rectfill
	    dup 0 translate
	} for
	pop
	grestore
    } stopped not success cleartomark
endps

defineps _DPSCDoCMYKPalette(DPSContext ctxt; char *func;
			    double width, height;
			    int steps | boolean *success)
    mark {
	gsave
	0 0 translate
	width steps div
	0 1 steps 1 sub {
	    steps div func setcmykcolor
	    dup 0 0 3 -1 roll height rectfill
	    dup 0 translate
	} for
	pop
	grestore
    } stopped not success cleartomark
endps

defineps _DPSCDoHSBPalette(DPSContext ctxt; char *func;
			   double width, height;
			   int steps | boolean *success)
    mark {
	gsave
	0 0 translate
	width steps div
	0 1 steps 1 sub {
	    steps div func sethsbcolor
	    dup 0 0 3 -1 roll height rectfill
	    dup 0 translate
	} for
	pop
	grestore
    } stopped not success cleartomark
endps

defineps _DPSCDoGrayPalette(DPSContext ctxt; char *func;
			    double width, height;
			    int steps | boolean *success)
    mark {
	gsave
	0 0 translate
	width steps div
	0 1 steps 1 sub {
	    steps div func setgray
	    dup 0 0 3 -1 roll height rectfill
	    dup 0 translate
	} for
	pop
	grestore
    } stopped not success cleartomark
endps

defineps _DPSCQueryRGBColorPalette(DPSContext ctxt; char *func;
				   double pct, red, green, blue; |
				   float *redOut, *greenOut, *blueOut;
				   boolean *success)
    mark {
	red green blue pct func
    } stopped dup not success {0 0 0} if
    blueOut greenOut redOut cleartomark
endps

defineps _DPSCQueryCMYKColorPalette(DPSContext ctxt; char *func;
				    double pct, cyan, magenta, yellow, black; |
				    float *cyanOut, *magentaOut, *yellowOut,
				    *blackOut; boolean *success)
    mark {
	cyan magenta yellow black pct func
    } stopped dup not success {0 0 0 0} if
    blackOut yellowOut magentaOut cyanOut cleartomark
endps

defineps _DPSCQueryHSBColorPalette(DPSContext ctxt; char *func;
				   double pct, hue, sat, bright; |
				   float *hueOut, *satOut, *brightOut;
				   boolean *success)
    mark {
	hue sat bright pct func
    } stopped dup not success {0 0 0} if
    brightOut satOut hueOut cleartomark
endps

defineps _DPSCQueryGrayColorPalette(DPSContext ctxt; char *func;
				    double pct, gray; |
				    float *grayOut; boolean *success)
    mark {
	gray pct func
    } stopped dup not success {0} if
    grayOut cleartomark
endps


defineps _DPSCQueryRGBPalette(DPSContext ctxt; char *func; double pct; |
			      float *redOut, *greenOut, *blueOut;
			      boolean *success)
    mark {
	pct func
    } stopped dup not success {0 0 0} if
    blueOut greenOut redOut cleartomark
endps

defineps _DPSCQueryCMYKPalette(DPSContext ctxt; char *func; double pct; |
			       float *cyanOut, *magentaOut, *yellowOut,
			       *blackOut; boolean *success)
    mark {
	pct func 
    } stopped dup not success {0 0 0 0} if
    blackOut yellowOut magentaOut cyanOut cleartomark
endps

defineps _DPSCQueryHSBPalette(DPSContext ctxt; char *func; double pct; |
			      float *hueOut, *satOut, *brightOut;
			      boolean *success)
    mark {
	pct func
    } stopped dup not success {0 0 0} if
    brightOut satOut hueOut cleartomark
endps

defineps _DPSCQueryGrayPalette(DPSContext ctxt; char *func; double pct; |
			       float *grayOut; boolean *success)
    mark {
	pct func
    } stopped dup not success {0} if
    grayOut cleartomark
endps