]> git.wh0rd.org - ICEs.git/blob - sh-ghostscript/gdevifno.i.0
more
[ICEs.git] / sh-ghostscript / gdevifno.i.0
1 typedef unsigned char __u_char;
2 typedef unsigned short int __u_short;
3 typedef unsigned int __u_int;
4 typedef unsigned long int __u_long;
5 typedef signed char __int8_t;
6 typedef unsigned char __uint8_t;
7 typedef signed short int __int16_t;
8 typedef unsigned short int __uint16_t;
9 typedef signed int __int32_t;
10 typedef unsigned int __uint32_t;
11 __extension__ typedef signed long long int __int64_t;
12 __extension__ typedef unsigned long long int __uint64_t;
13 __extension__ typedef long long int __quad_t;
14 __extension__ typedef unsigned long long int __u_quad_t;
15 __extension__ typedef __u_quad_t __dev_t;
16 __extension__ typedef unsigned int __uid_t;
17 __extension__ typedef unsigned int __gid_t;
18 __extension__ typedef unsigned long int __ino_t;
19 __extension__ typedef __u_quad_t __ino64_t;
20 __extension__ typedef unsigned int __mode_t;
21 __extension__ typedef unsigned int __nlink_t;
22 __extension__ typedef long int __off_t;
23 __extension__ typedef __quad_t __off64_t;
24 __extension__ typedef int __pid_t;
25 __extension__ typedef struct { int __val[2]; } __fsid_t;
26 __extension__ typedef long int __clock_t;
27 __extension__ typedef unsigned long int __rlim_t;
28 __extension__ typedef __u_quad_t __rlim64_t;
29 __extension__ typedef unsigned int __id_t;
30 __extension__ typedef long int __time_t;
31 __extension__ typedef unsigned int __useconds_t;
32 __extension__ typedef long int __suseconds_t;
33 __extension__ typedef int __daddr_t;
34 __extension__ typedef long int __swblk_t;
35 __extension__ typedef int __key_t;
36 __extension__ typedef int __clockid_t;
37 __extension__ typedef void * __timer_t;
38 __extension__ typedef long int __blksize_t;
39 __extension__ typedef long int __blkcnt_t;
40 __extension__ typedef __quad_t __blkcnt64_t;
41 __extension__ typedef unsigned long int __fsblkcnt_t;
42 __extension__ typedef __u_quad_t __fsblkcnt64_t;
43 __extension__ typedef unsigned long int __fsfilcnt_t;
44 __extension__ typedef __u_quad_t __fsfilcnt64_t;
45 __extension__ typedef int __ssize_t;
46 typedef __off64_t __loff_t;
47 typedef __quad_t *__qaddr_t;
48 typedef char *__caddr_t;
49 __extension__ typedef int __intptr_t;
50 __extension__ typedef unsigned int __socklen_t;
51 typedef __u_char u_char;
52 typedef __u_short u_short;
53 typedef __u_int u_int;
54 typedef __u_long u_long;
55 typedef __quad_t quad_t;
56 typedef __u_quad_t u_quad_t;
57 typedef __fsid_t fsid_t;
58 typedef __loff_t loff_t;
59 typedef __ino_t ino_t;
60 typedef __ino64_t ino64_t;
61 typedef __dev_t dev_t;
62 typedef __gid_t gid_t;
63 typedef __mode_t mode_t;
64 typedef __nlink_t nlink_t;
65 typedef __uid_t uid_t;
66 typedef __off_t off_t;
67 typedef __off64_t off64_t;
68 typedef __pid_t pid_t;
69 typedef __id_t id_t;
70 typedef __ssize_t ssize_t;
71 typedef __daddr_t daddr_t;
72 typedef __caddr_t caddr_t;
73 typedef __key_t key_t;
74 typedef __time_t time_t;
75 typedef __clockid_t clockid_t;
76 typedef __timer_t timer_t;
77 typedef unsigned int size_t;
78 typedef unsigned long int ulong_;
79 typedef unsigned short int ushort_;
80 typedef unsigned int uint_;
81 typedef int int8_t __attribute__ ((__mode__ (__QI__)));
82 typedef int int16_t __attribute__ ((__mode__ (__HI__)));
83 typedef int int32_t __attribute__ ((__mode__ (__SI__)));
84 typedef int int64_t __attribute__ ((__mode__ (__DI__)));
85 typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
86 typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
87 typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
88 typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
89 typedef int register_t __attribute__ ((__mode__ (__word__)));
90 typedef int __sig_atomic_t;
91 typedef struct
92 {
93 unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
94 } __sigset_t;
95 typedef __sigset_t sigset_t;
96 struct timespec
97 {
98 __time_t tv_sec;
99 long int tv_nsec;
100 };
101 struct timeval
102 {
103 __time_t tv_sec;
104 __suseconds_t tv_usec;
105 };
106 typedef __suseconds_t suseconds_t;
107 typedef long int __fd_mask;
108 typedef struct
109 {
110 __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))];
111 } fd_set;
112 typedef __fd_mask fd_mask;
113 extern int select (int __nfds, fd_set *__restrict __readfds,
114 fd_set *__restrict __writefds,
115 fd_set *__restrict __exceptfds,
116 struct timeval *__restrict __timeout);
117 extern int pselect (int __nfds, fd_set *__restrict __readfds,
118 fd_set *__restrict __writefds,
119 fd_set *__restrict __exceptfds,
120 const struct timespec *__restrict __timeout,
121 const __sigset_t *__restrict __sigmask);
122 __extension__
123 extern unsigned int gnu_dev_major (unsigned long long int __dev)
124 __attribute__ ((__nothrow__));
125 __extension__
126 extern unsigned int gnu_dev_minor (unsigned long long int __dev)
127 __attribute__ ((__nothrow__));
128 __extension__
129 extern unsigned long long int gnu_dev_makedev (unsigned int __major,
130 unsigned int __minor)
131 __attribute__ ((__nothrow__));
132 __extension__ extern __inline unsigned int
133 __attribute__ ((__nothrow__)) gnu_dev_major (unsigned long long int __dev)
134 {
135 return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
136 }
137 __extension__ extern __inline unsigned int
138 __attribute__ ((__nothrow__)) gnu_dev_minor (unsigned long long int __dev)
139 {
140 return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
141 }
142 __extension__ extern __inline unsigned long long int
143 __attribute__ ((__nothrow__)) gnu_dev_makedev (unsigned int __major, unsigned int __minor)
144 {
145 return ((__minor & 0xff) | ((__major & 0xfff) << 8)
146 | (((unsigned long long int) (__minor & ~0xff)) << 12)
147 | (((unsigned long long int) (__major & ~0xfff)) << 32));
148 }
149 typedef __blkcnt_t blkcnt_t;
150 typedef __fsblkcnt_t fsblkcnt_t;
151 typedef __fsfilcnt_t fsfilcnt_t;
152 typedef __blkcnt64_t blkcnt64_t;
153 typedef __fsblkcnt64_t fsblkcnt64_t;
154 typedef __fsfilcnt64_t fsfilcnt64_t;
155 typedef unsigned long int pthread_t;
156 typedef union
157 {
158 char __size[36];
159 long int __align;
160 } pthread_attr_t;
161 typedef struct __pthread_internal_slist
162 {
163 struct __pthread_internal_slist *__next;
164 } __pthread_slist_t;
165 typedef union
166 {
167 struct __pthread_mutex_s
168 {
169 int __lock;
170 unsigned int __count;
171 int __owner;
172 int __kind;
173 unsigned int __nusers;
174 __extension__ union
175 {
176 int __spins;
177 __pthread_slist_t __list;
178 };
179 } __data;
180 char __size[24];
181 long int __align;
182 } pthread_mutex_t;
183 typedef union
184 {
185 char __size[4];
186 long int __align;
187 } pthread_mutexattr_t;
188 typedef union
189 {
190 struct
191 {
192 int __lock;
193 unsigned int __futex;
194 __extension__ unsigned long long int __total_seq;
195 __extension__ unsigned long long int __wakeup_seq;
196 __extension__ unsigned long long int __woken_seq;
197 void *__mutex;
198 unsigned int __nwaiters;
199 unsigned int __broadcast_seq;
200 } __data;
201 char __size[48];
202 __extension__ long long int __align;
203 } pthread_cond_t;
204 typedef union
205 {
206 char __size[4];
207 long int __align;
208 } pthread_condattr_t;
209 typedef unsigned int pthread_key_t;
210 typedef int pthread_once_t;
211 typedef union
212 {
213 struct
214 {
215 int __lock;
216 unsigned int __nr_readers;
217 unsigned int __readers_wakeup;
218 unsigned int __writer_wakeup;
219 unsigned int __nr_readers_queued;
220 unsigned int __nr_writers_queued;
221 unsigned char __flags;
222 unsigned char __shared;
223 unsigned char __pad1;
224 unsigned char __pad2;
225 pthread_t __writer;
226 } __data;
227 char __size[32];
228 long int __align;
229 } pthread_rwlock_t;
230 typedef union
231 {
232 char __size[8];
233 long int __align;
234 } pthread_rwlockattr_t;
235 typedef volatile int pthread_spinlock_t;
236 typedef union
237 {
238 char __size[20];
239 long int __align;
240 } pthread_barrier_t;
241 typedef union
242 {
243 char __size[4];
244 int __align;
245 } pthread_barrierattr_t;
246 typedef int bool;
247 typedef const char *ptr_ord_t;
248 typedef double floatp;
249 typedef const char *client_name_t;
250 typedef unsigned short bits16;
251 typedef unsigned int bits32;
252 struct _IO_FILE;
253 typedef struct _IO_FILE FILE;
254 typedef struct _IO_FILE __FILE;
255 typedef struct
256 {
257 int __count;
258 union
259 {
260 unsigned int __wch;
261 char __wchb[4];
262 } __value;
263 } __mbstate_t;
264 typedef struct
265 {
266 __off_t __pos;
267 __mbstate_t __state;
268 } _G_fpos_t;
269 typedef struct
270 {
271 __off64_t __pos;
272 __mbstate_t __state;
273 } _G_fpos64_t;
274 typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
275 typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
276 typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
277 typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
278 typedef __builtin_va_list __gnuc_va_list;
279 struct _IO_jump_t; struct _IO_FILE;
280 typedef void _IO_lock_t;
281 struct _IO_marker {
282 struct _IO_marker *_next;
283 struct _IO_FILE *_sbuf;
284 int _pos;
285 };
286 enum __codecvt_result
287 {
288 __codecvt_ok,
289 __codecvt_partial,
290 __codecvt_error,
291 __codecvt_noconv
292 };
293 struct _IO_FILE {
294 int _flags;
295 char* _IO_read_ptr;
296 char* _IO_read_end;
297 char* _IO_read_base;
298 char* _IO_write_base;
299 char* _IO_write_ptr;
300 char* _IO_write_end;
301 char* _IO_buf_base;
302 char* _IO_buf_end;
303 char *_IO_save_base;
304 char *_IO_backup_base;
305 char *_IO_save_end;
306 struct _IO_marker *_markers;
307 struct _IO_FILE *_chain;
308 int _fileno;
309 int _flags2;
310 __off_t _old_offset;
311 unsigned short _cur_column;
312 signed char _vtable_offset;
313 char _shortbuf[1];
314 _IO_lock_t *_lock;
315 __off64_t _offset;
316 void *__pad1;
317 void *__pad2;
318 void *__pad3;
319 void *__pad4;
320 size_t __pad5;
321 int _mode;
322 char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
323 };
324 typedef struct _IO_FILE _IO_FILE;
325 struct _IO_FILE_plus;
326 extern struct _IO_FILE_plus _IO_2_1_stdin_;
327 extern struct _IO_FILE_plus _IO_2_1_stdout_;
328 extern struct _IO_FILE_plus _IO_2_1_stderr_;
329 typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
330 typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
331 size_t __n);
332 typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
333 typedef int __io_close_fn (void *__cookie);
334 extern int __underflow (_IO_FILE *);
335 extern int __uflow (_IO_FILE *);
336 extern int __overflow (_IO_FILE *, int);
337 extern int _IO_getc (_IO_FILE *__fp);
338 extern int _IO_putc (int __c, _IO_FILE *__fp);
339 extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__));
340 extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__));
341 extern int _IO_peekc_locked (_IO_FILE *__fp);
342 extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__));
343 extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__));
344 extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__));
345 extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
346 __gnuc_va_list, int *__restrict);
347 extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
348 __gnuc_va_list);
349 extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
350 extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
351 extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
352 extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
353 extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__));
354 typedef _G_fpos_t fpos_t;
355 typedef _G_fpos64_t fpos64_t;
356 extern struct _IO_FILE *stdin;
357 extern struct _IO_FILE *stdout;
358 extern struct _IO_FILE *stderr;
359 extern int remove (__const char *__filename) __attribute__ ((__nothrow__));
360 extern int rename (__const char *__old, __const char *__new) __attribute__ ((__nothrow__));
361 extern FILE *tmpfile (void) ;
362 extern FILE *tmpfile64 (void) ;
363 extern char *tmpnam (char *__s) __attribute__ ((__nothrow__)) ;
364 extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__)) ;
365 extern char *tempnam (__const char *__dir, __const char *__pfx)
366 __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
367 extern int fclose (FILE *__stream);
368 extern int fflush (FILE *__stream);
369 extern int fflush_unlocked (FILE *__stream);
370 extern FILE *fopen (__const char *__restrict __filename,
371 __const char *__restrict __modes) ;
372 extern FILE *freopen (__const char *__restrict __filename,
373 __const char *__restrict __modes,
374 FILE *__restrict __stream) ;
375 extern FILE *fopen64 (__const char *__restrict __filename,
376 __const char *__restrict __modes) ;
377 extern FILE *freopen64 (__const char *__restrict __filename,
378 __const char *__restrict __modes,
379 FILE *__restrict __stream) ;
380 extern FILE *fdopen (int __fd, __const char *__modes) __attribute__ ((__nothrow__)) ;
381 extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__));
382 extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
383 int __modes, size_t __n) __attribute__ ((__nothrow__));
384 extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
385 size_t __size) __attribute__ ((__nothrow__));
386 extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__));
387 extern int fprintf (FILE *__restrict __stream,
388 __const char *__restrict __format, ...);
389 extern int printf (__const char *__restrict __format, ...);
390 extern int sprintf (char *__restrict __s,
391 __const char *__restrict __format, ...) __attribute__ ((__nothrow__));
392 extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
393 __gnuc_va_list __arg);
394 extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
395 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
396 __gnuc_va_list __arg) __attribute__ ((__nothrow__));
397 extern int snprintf (char *__restrict __s, size_t __maxlen,
398 __const char *__restrict __format, ...)
399 __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));
400 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
401 __const char *__restrict __format, __gnuc_va_list __arg)
402 __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0)));
403 extern int fscanf (FILE *__restrict __stream,
404 __const char *__restrict __format, ...) ;
405 extern int scanf (__const char *__restrict __format, ...) ;
406 extern int sscanf (__const char *__restrict __s,
407 __const char *__restrict __format, ...) __attribute__ ((__nothrow__));
408 extern int fgetc (FILE *__stream);
409 extern int getc (FILE *__stream);
410 extern int getchar (void);
411 extern int getc_unlocked (FILE *__stream);
412 extern int getchar_unlocked (void);
413 extern int fgetc_unlocked (FILE *__stream);
414 extern int fputc (int __c, FILE *__stream);
415 extern int putc (int __c, FILE *__stream);
416 extern int putchar (int __c);
417 extern int fputc_unlocked (int __c, FILE *__stream);
418 extern int putc_unlocked (int __c, FILE *__stream);
419 extern int putchar_unlocked (int __c);
420 extern int getw (FILE *__stream);
421 extern int putw (int __w, FILE *__stream);
422 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
423 ;
424 extern char *gets (char *__s) ;
425 extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
426 extern int puts (__const char *__s);
427 extern int ungetc (int __c, FILE *__stream);
428 extern size_t fread (void *__restrict __ptr, size_t __size,
429 size_t __n, FILE *__restrict __stream) ;
430 extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
431 size_t __n, FILE *__restrict __s) ;
432 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
433 size_t __n, FILE *__restrict __stream) ;
434 extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
435 size_t __n, FILE *__restrict __stream) ;
436 extern int fseek (FILE *__stream, long int __off, int __whence);
437 extern long int ftell (FILE *__stream) ;
438 extern void rewind (FILE *__stream);
439 extern int fseeko (FILE *__stream, __off_t __off, int __whence);
440 extern __off_t ftello (FILE *__stream) ;
441 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
442 extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
443 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
444 extern __off64_t ftello64 (FILE *__stream) ;
445 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
446 extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
447 extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__));
448 extern int feof (FILE *__stream) __attribute__ ((__nothrow__)) ;
449 extern int ferror (FILE *__stream) __attribute__ ((__nothrow__)) ;
450 extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__));
451 extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ;
452 extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ;
453 extern void perror (__const char *__s);
454 extern int sys_nerr;
455 extern __const char *__const sys_errlist[];
456 extern int fileno (FILE *__stream) __attribute__ ((__nothrow__)) ;
457 extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ;
458 extern FILE *popen (__const char *__command, __const char *__modes) ;
459 extern int pclose (FILE *__stream);
460 extern char *ctermid (char *__s) __attribute__ ((__nothrow__));
461 extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__));
462 extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__)) ;
463 extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__));
464 extern __inline int
465 vprintf (__const char *__restrict __fmt, __gnuc_va_list __arg)
466 {
467 return vfprintf (stdout, __fmt, __arg);
468 }
469 extern __inline int
470 getchar (void)
471 {
472 return _IO_getc (stdin);
473 }
474 extern __inline int
475 fgetc_unlocked (FILE *__fp)
476 {
477 return (__builtin_expect (((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end), 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
478 }
479 extern __inline int
480 getc_unlocked (FILE *__fp)
481 {
482 return (__builtin_expect (((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end), 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
483 }
484 extern __inline int
485 getchar_unlocked (void)
486 {
487 return (__builtin_expect (((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end), 0) ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++);
488 }
489 extern __inline int
490 putchar (int __c)
491 {
492 return _IO_putc (__c, stdout);
493 }
494 extern __inline int
495 fputc_unlocked (int __c, FILE *__stream)
496 {
497 return (__builtin_expect (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end), 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
498 }
499 extern __inline int
500 putc_unlocked (int __c, FILE *__stream)
501 {
502 return (__builtin_expect (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end), 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
503 }
504 extern __inline int
505 putchar_unlocked (int __c)
506 {
507 return (__builtin_expect (((stdout)->_IO_write_ptr >= (stdout)->_IO_write_end), 0) ? __overflow (stdout, (unsigned char) (__c)) : (unsigned char) (*(stdout)->_IO_write_ptr++ = (__c)));
508 }
509 extern __inline int
510 __attribute__ ((__nothrow__)) feof_unlocked (FILE *__stream)
511 {
512 return (((__stream)->_flags & 0x10) != 0);
513 }
514 extern __inline int
515 __attribute__ ((__nothrow__)) ferror_unlocked (FILE *__stream)
516 {
517 return (((__stream)->_flags & 0x20) != 0);
518 }
519 typedef struct gs_memory_s gs_memory_t;
520 int outwrite(const gs_memory_t *mem, const char *str, int len);
521 int errwrite(const char *str, int len);
522 void outflush(const gs_memory_t *mem);
523 void errflush(void);
524 int outprintf(const gs_memory_t *mem, const char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3)));
525 int errprintf(const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2)));
526 void dprintf_file_and_line(const char *, int);
527 void dflush(void);
528 void printf_program_ident(const gs_memory_t *mem, const char *program_name, long revision_number);
529 void eprintf_program_ident(const char *program_name, long revision_number);
530 const char *gs_program_name(void);
531 long gs_revision_number(void);
532 void lprintf_file_and_line(const char *, int);
533 extern void *memcpy (void *__restrict __dest,
534 __const void *__restrict __src, size_t __n)
535 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
536 extern void *memmove (void *__dest, __const void *__src, size_t __n)
537 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
538 extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
539 int __c, size_t __n)
540 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
541 extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
542 extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
543 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
544 extern void *memchr (__const void *__s, int __c, size_t __n)
545 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
546 extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
547 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
548 extern char *strncpy (char *__restrict __dest,
549 __const char *__restrict __src, size_t __n)
550 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
551 extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
552 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
553 extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
554 size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
555 extern int strcmp (__const char *__s1, __const char *__s2)
556 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
557 extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
558 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
559 extern int strcoll (__const char *__s1, __const char *__s2)
560 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
561 extern size_t strxfrm (char *__restrict __dest,
562 __const char *__restrict __src, size_t __n)
563 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
564 extern char *strdup (__const char *__s)
565 __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
566 extern char *strchr (__const char *__s, int __c)
567 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
568 extern char *strrchr (__const char *__s, int __c)
569 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
570 extern size_t strcspn (__const char *__s, __const char *__reject)
571 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
572 extern size_t strspn (__const char *__s, __const char *__accept)
573 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
574 extern char *strpbrk (__const char *__s, __const char *__accept)
575 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
576 extern char *strstr (__const char *__haystack, __const char *__needle)
577 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
578 extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
579 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
580 extern char *__strtok_r (char *__restrict __s,
581 __const char *__restrict __delim,
582 char **__restrict __save_ptr)
583 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
584 extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
585 char **__restrict __save_ptr)
586 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
587 extern size_t strlen (__const char *__s)
588 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
589 extern char *strerror (int __errnum) __attribute__ ((__nothrow__));
590 extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
591 extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
592 extern void bcopy (__const void *__src, void *__dest, size_t __n)
593 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
594 extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
595 extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
596 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
597 extern char *index (__const char *__s, int __c)
598 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
599 extern char *rindex (__const char *__s, int __c)
600 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
601 extern int ffs (int __i) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
602 extern int strcasecmp (__const char *__s1, __const char *__s2)
603 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
604 extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
605 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
606 extern char *strsep (char **__restrict __stringp,
607 __const char *__restrict __delim)
608 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
609 typedef struct { unsigned char __arr[2]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR2;
610 typedef struct { unsigned char __arr[3]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR3;
611 typedef struct { unsigned char __arr[4]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR4;
612 typedef struct { unsigned char __arr[5]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR5;
613 typedef struct { unsigned char __arr[6]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR6;
614 typedef struct { unsigned char __arr[7]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR7;
615 typedef struct { unsigned char __arr[8]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR8;
616 extern void *__rawmemchr (const void *__s, int __c);
617 extern __inline size_t __strcspn_c1 (__const char *__s, int __reject);
618 extern __inline size_t
619 __strcspn_c1 (__const char *__s, int __reject)
620 {
621 register size_t __result = 0;
622 while (__s[__result] != '\0' && __s[__result] != __reject)
623 ++__result;
624 return __result;
625 }
626 extern __inline size_t __strcspn_c2 (__const char *__s, int __reject1,
627 int __reject2);
628 extern __inline size_t
629 __strcspn_c2 (__const char *__s, int __reject1, int __reject2)
630 {
631 register size_t __result = 0;
632 while (__s[__result] != '\0' && __s[__result] != __reject1
633 && __s[__result] != __reject2)
634 ++__result;
635 return __result;
636 }
637 extern __inline size_t __strcspn_c3 (__const char *__s, int __reject1,
638 int __reject2, int __reject3);
639 extern __inline size_t
640 __strcspn_c3 (__const char *__s, int __reject1, int __reject2,
641 int __reject3)
642 {
643 register size_t __result = 0;
644 while (__s[__result] != '\0' && __s[__result] != __reject1
645 && __s[__result] != __reject2 && __s[__result] != __reject3)
646 ++__result;
647 return __result;
648 }
649 extern __inline size_t __strspn_c1 (__const char *__s, int __accept);
650 extern __inline size_t
651 __strspn_c1 (__const char *__s, int __accept)
652 {
653 register size_t __result = 0;
654 while (__s[__result] == __accept)
655 ++__result;
656 return __result;
657 }
658 extern __inline size_t __strspn_c2 (__const char *__s, int __accept1,
659 int __accept2);
660 extern __inline size_t
661 __strspn_c2 (__const char *__s, int __accept1, int __accept2)
662 {
663 register size_t __result = 0;
664 while (__s[__result] == __accept1 || __s[__result] == __accept2)
665 ++__result;
666 return __result;
667 }
668 extern __inline size_t __strspn_c3 (__const char *__s, int __accept1,
669 int __accept2, int __accept3);
670 extern __inline size_t
671 __strspn_c3 (__const char *__s, int __accept1, int __accept2, int __accept3)
672 {
673 register size_t __result = 0;
674 while (__s[__result] == __accept1 || __s[__result] == __accept2
675 || __s[__result] == __accept3)
676 ++__result;
677 return __result;
678 }
679 extern __inline char *__strpbrk_c2 (__const char *__s, int __accept1,
680 int __accept2);
681 extern __inline char *
682 __strpbrk_c2 (__const char *__s, int __accept1, int __accept2)
683 {
684 while (*__s != '\0' && *__s != __accept1 && *__s != __accept2)
685 ++__s;
686 return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
687 }
688 extern __inline char *__strpbrk_c3 (__const char *__s, int __accept1,
689 int __accept2, int __accept3);
690 extern __inline char *
691 __strpbrk_c3 (__const char *__s, int __accept1, int __accept2,
692 int __accept3)
693 {
694 while (*__s != '\0' && *__s != __accept1 && *__s != __accept2
695 && *__s != __accept3)
696 ++__s;
697 return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
698 }
699 extern __inline char *__strtok_r_1c (char *__s, char __sep, char **__nextp);
700 extern __inline char *
701 __strtok_r_1c (char *__s, char __sep, char **__nextp)
702 {
703 char *__result;
704 if (__s == ((void *)0))
705 __s = *__nextp;
706 while (*__s == __sep)
707 ++__s;
708 __result = ((void *)0);
709 if (*__s != '\0')
710 {
711 __result = __s++;
712 while (*__s != '\0')
713 if (*__s++ == __sep)
714 {
715 __s[-1] = '\0';
716 break;
717 }
718 *__nextp = __s;
719 }
720 return __result;
721 }
722 extern char *__strsep_g (char **__stringp, __const char *__delim);
723 extern __inline char *__strsep_1c (char **__s, char __reject);
724 extern __inline char *
725 __strsep_1c (char **__s, char __reject)
726 {
727 register char *__retval = *__s;
728 if (__retval != ((void *)0) && (*__s = (__extension__ (__builtin_constant_p (__reject) && !__builtin_constant_p (__retval) && (__reject) == '\0' ? (char *) __rawmemchr (__retval, __reject) : __builtin_strchr (__retval, __reject)))) != ((void *)0))
729 *(*__s)++ = '\0';
730 return __retval;
731 }
732 extern __inline char *__strsep_2c (char **__s, char __reject1, char __reject2);
733 extern __inline char *
734 __strsep_2c (char **__s, char __reject1, char __reject2)
735 {
736 register char *__retval = *__s;
737 if (__retval != ((void *)0))
738 {
739 register char *__cp = __retval;
740 while (1)
741 {
742 if (*__cp == '\0')
743 {
744 __cp = ((void *)0);
745 break;
746 }
747 if (*__cp == __reject1 || *__cp == __reject2)
748 {
749 *__cp++ = '\0';
750 break;
751 }
752 ++__cp;
753 }
754 *__s = __cp;
755 }
756 return __retval;
757 }
758 extern __inline char *__strsep_3c (char **__s, char __reject1, char __reject2,
759 char __reject3);
760 extern __inline char *
761 __strsep_3c (char **__s, char __reject1, char __reject2, char __reject3)
762 {
763 register char *__retval = *__s;
764 if (__retval != ((void *)0))
765 {
766 register char *__cp = __retval;
767 while (1)
768 {
769 if (*__cp == '\0')
770 {
771 __cp = ((void *)0);
772 break;
773 }
774 if (*__cp == __reject1 || *__cp == __reject2 || *__cp == __reject3)
775 {
776 *__cp++ = '\0';
777 break;
778 }
779 ++__cp;
780 }
781 *__s = __cp;
782 }
783 return __retval;
784 }
785 extern void *malloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
786 extern void *calloc (size_t __nmemb, size_t __size)
787 __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
788 extern char *__strdup (__const char *__string) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__));
789 extern char *__strndup (__const char *__string, size_t __n)
790 __attribute__ ((__nothrow__)) __attribute__ ((__malloc__));
791 int unlink(const char *);
792 int gs_log_error(int, const char *, int);
793 const char *gs_errstr(int code);
794 int gs_throw_imp(const char *func, const char *file, int line,
795 int op, int code, const char *fmt, ...) __attribute__((__format__ (__printf__, 6, 7)));
796 typedef unsigned long gs_id;
797 typedef struct gs_string_s {
798 unsigned char *data; unsigned int size;
799 } gs_string;
800 typedef struct gs_const_string_s {
801 const unsigned char *data; unsigned int size;
802 } gs_const_string;
803 typedef struct gs_param_string_s {
804 const unsigned char *data; unsigned int size;
805 bool persistent;
806 } gs_param_string;
807 typedef struct gs_bytestring_s {
808 unsigned char *data; unsigned int size;
809 unsigned char *bytes;
810 } gs_bytestring;
811 typedef struct gs_const_bytestring_s {
812 const unsigned char *data; unsigned int size;
813 const unsigned char *bytes;
814 } gs_const_bytestring;
815 typedef struct gs_point_s {
816 double x, y;
817 } gs_point;
818 typedef struct gs_int_point_s {
819 int x, y;
820 } gs_int_point;
821 typedef struct gs_log2_scale_point_s {
822 int x, y;
823 } gs_log2_scale_point;
824 typedef struct gs_rect_s {
825 gs_point p, q;
826 } gs_rect;
827 typedef struct gs_int_rect_s {
828 gs_int_point p, q;
829 } gs_int_rect;
830 typedef struct gs_range_s {
831 float rmin, rmax;
832 } gs_range_t;
833 typedef struct name_table_s *name_table_ptr;
834 typedef struct gs_lib_ctx_s
835 {
836 gs_memory_t *memory;
837 FILE *fstdin;
838 FILE *fstdout;
839 FILE *fstderr;
840 FILE *fstdout2;
841 bool stdout_is_redirected;
842 bool stdout_to_stderr;
843 bool stdin_is_interactive;
844 void *caller_handle;
845 void *custom_color_callback;
846 int ( *stdin_fn)(void *caller_handle, char *buf, int len);
847 int ( *stdout_fn)(void *caller_handle, const char *str, int len);
848 int ( *stderr_fn)(void *caller_handle, const char *str, int len);
849 int ( *poll_fn)(void *caller_handle);
850 unsigned long gs_next_id;
851 void *top_of_system;
852 name_table_ptr gs_name_table;
853 bool dict_auto_expand;
854 } gs_lib_ctx_t;
855 int gs_lib_ctx_init( gs_memory_t *mem );
856 void *gs_lib_ctx_get_interp_instance( gs_memory_t *mem );
857 gs_memory_t * gs_lib_ctx_get_non_gc_memory_t(void);
858 typedef struct gs_memory_struct_type_s gs_memory_struct_type_t;
859 typedef const gs_memory_struct_type_t *gs_memory_type_ptr_t;
860 typedef struct gs_ptr_procs_s gs_ptr_procs_t;
861 typedef const gs_ptr_procs_t *gs_ptr_type_t;
862 typedef struct gs_gc_root_s gs_gc_root_t;
863 typedef client_name_t struct_name_t;
864 unsigned int gs_struct_type_size(gs_memory_type_ptr_t);
865 struct_name_t gs_struct_type_name(gs_memory_type_ptr_t);
866 typedef struct gs_memory_status_s {
867 unsigned long allocated;
868 unsigned long used;
869 } gs_memory_status_t;
870 typedef struct gs_memory_procs_s {
871 unsigned char *(*alloc_bytes_immovable)(gs_memory_t *mem, unsigned int nbytes, client_name_t cname); void *(*resize_object)(gs_memory_t *mem, void *obj, unsigned int new_num_elements, client_name_t cname); void (*free_object)(gs_memory_t *mem, void *data, client_name_t cname); gs_memory_t *(*stable)(gs_memory_t *mem); void (*status)(gs_memory_t *mem, gs_memory_status_t *status); void (*free_all)(gs_memory_t *mem, unsigned int free_mask, client_name_t cname); void (*consolidate_free)(gs_memory_t *mem);
872 unsigned char *(*alloc_bytes)(gs_memory_t *mem, unsigned int nbytes, client_name_t cname);
873 void *(*alloc_struct)(gs_memory_t *mem, gs_memory_type_ptr_t pstype, client_name_t cname);
874 void *(*alloc_struct_immovable)(gs_memory_t *mem, gs_memory_type_ptr_t pstype, client_name_t cname);
875 unsigned char *(*alloc_byte_array)(gs_memory_t *mem, unsigned int num_elements, unsigned int elt_size, client_name_t cname);
876 unsigned char *(*alloc_byte_array_immovable)(gs_memory_t *mem, unsigned int num_elements, unsigned int elt_size, client_name_t cname);
877 void *(*alloc_struct_array)(gs_memory_t *mem, unsigned int num_elements, gs_memory_type_ptr_t pstype, client_name_t cname);
878 void *(*alloc_struct_array_immovable)(gs_memory_t *mem, unsigned int num_elements, gs_memory_type_ptr_t pstype, client_name_t cname);
879 unsigned int (*object_size)(gs_memory_t *mem, const void *obj);
880 gs_memory_type_ptr_t (*object_type)(const gs_memory_t *mem, const void *obj);
881 unsigned char *(*alloc_string)(gs_memory_t *mem, unsigned int nbytes, client_name_t cname);
882 unsigned char *(*alloc_string_immovable)(gs_memory_t *mem, unsigned int nbytes, client_name_t cname);
883 unsigned char *(*resize_string)(gs_memory_t *mem, unsigned char *data, unsigned int old_num, unsigned int new_num, client_name_t cname);
884 void (*free_string)(gs_memory_t *mem, unsigned char *data, unsigned int nbytes, client_name_t cname);
885 int (*register_root)(gs_memory_t *mem, gs_gc_root_t *root, gs_ptr_type_t ptype, void **pp, client_name_t cname);
886 void (*unregister_root)(gs_memory_t *mem, gs_gc_root_t *root, client_name_t cname);
887 void (*enable_free)(gs_memory_t *mem, bool enable);
888 } gs_memory_procs_t;
889 void gs_free_const_object(gs_memory_t *mem, const void *data,
890 client_name_t cname);
891 void gs_free_const_string(gs_memory_t *mem, const unsigned char *data, unsigned int nbytes,
892 client_name_t cname);
893 void gs_free_bytestring(gs_memory_t *mem, gs_bytestring *pbs,
894 client_name_t cname);
895 void gs_free_const_bytestring(gs_memory_t *mem, gs_const_bytestring *pbs,
896 client_name_t cname);
897 void *gs_resize_struct_array(gs_memory_t *mem, void *obj, unsigned int num_elements,
898 gs_memory_type_ptr_t pstype,
899 client_name_t cname);
900 int gs_register_struct_root(gs_memory_t *mem, gs_gc_root_t *root,
901 void **pp, client_name_t cname);
902 void gs_ignore_free_object(gs_memory_t *mem, void *data, client_name_t cname);
903 void gs_ignore_free_string(gs_memory_t *mem, unsigned char *data, unsigned int nbytes, client_name_t cname);
904 void gs_ignore_consolidate_free(gs_memory_t *mem);
905 void *gs_raw_alloc_struct_immovable(gs_memory_t * rmem,
906 gs_memory_type_ptr_t pstype,
907 client_name_t cname);
908 typedef struct pl_mem_node_s pl_mem_node_t;
909 struct gs_memory_s {
910 gs_memory_t *stable_memory; gs_memory_procs_t procs; gs_lib_ctx_t *gs_lib_ctx; pl_mem_node_t *head; gs_memory_t *non_gc_memory;
911 };
912 extern char gs_debug[128];
913 bool gs_debug_c(int );
914 extern FILE *gs_debug_out;
915 void debug_dump_bytes(const unsigned char * from, const unsigned char * to,
916 const char *msg);
917 void debug_dump_bitmap(const unsigned char * from, unsigned int raster, unsigned int height,
918 const char *msg);
919 void debug_print_string(const unsigned char * str, unsigned int len);
920 void debug_print_string_hex(const unsigned char * str, unsigned int len);
921 typedef struct gs_imager_state_s gs_imager_state;
922 typedef struct gs_state_s gs_state;
923 int gp_getenv(const char *key, char *ptr, int *plen);
924 typedef struct stream_s stream;
925 extern int sreadline(stream *s_in, stream *s_out, void *readline_data, gs_const_string *prompt, gs_string *buf, gs_memory_t *bufmem, unsigned int *pcount, bool *pin_eol, bool (*is_stdin)(const stream *));
926 typedef unsigned char uint8_t;
927 typedef unsigned short int uint16_t;
928 typedef unsigned int uint32_t;
929 __extension__
930 typedef unsigned long long int uint64_t;
931 typedef signed char int_least8_t;
932 typedef short int int_least16_t;
933 typedef int int_least32_t;
934 __extension__
935 typedef long long int int_least64_t;
936 typedef unsigned char uint_least8_t;
937 typedef unsigned short int uint_least16_t;
938 typedef unsigned int uint_least32_t;
939 __extension__
940 typedef unsigned long long int uint_least64_t;
941 typedef signed char int_fast8_t;
942 typedef int int_fast16_t;
943 typedef int int_fast32_t;
944 __extension__
945 typedef long long int int_fast64_t;
946 typedef unsigned char uint_fast8_t;
947 typedef unsigned int uint_fast16_t;
948 typedef unsigned int uint_fast32_t;
949 __extension__
950 typedef unsigned long long int uint_fast64_t;
951 typedef int intptr_t;
952 typedef unsigned int uintptr_t;
953 __extension__
954 typedef long long int intmax_t;
955 __extension__
956 typedef unsigned long long int uintmax_t;
957 void gp_init(void);
958 void gp_exit(int exit_status, int code);
959 void gp_do_exit(int exit_status);
960 const char *gp_strerror(int);
961 void gp_get_realtime(long ptm[2]);
962 void gp_get_usertime(long ptm[2]);
963 int gp_readline_init(void **preadline_data, gs_memory_t *mem);
964 int gp_readline(stream *s_in, stream *s_out, void *readline_data,
965 gs_const_string *prompt, gs_string *buf,
966 gs_memory_t *bufmem, unsigned int *pcount, bool *pin_eol,
967 bool (*is_stdin)(const stream *));
968 void gp_readline_finit(void *readline_data);
969 int gp_stdin_read(char *buf, int len, int interactive, FILE *f);
970 const char *gp_getenv_display(void);
971 extern const char gp_file_name_list_separator;
972 extern const char gp_scratch_file_name_prefix[];
973 extern const char gp_null_file_name[];
974 extern const char gp_current_directory_name[];
975 extern const char gp_fmode_binary_suffix[];
976 extern const char gp_fmode_rb[];
977 extern const char gp_fmode_wb[];
978 FILE *gp_open_scratch_file(const char *prefix,
979 char fname[260],
980 const char *mode);
981 FILE *gp_fopen(const char *fname, const char *mode);
982 int gp_setmode_binary(FILE * pfile, bool mode);
983 typedef enum {
984 gp_combine_small_buffer = -1,
985 gp_combine_cant_handle = 0,
986 gp_combine_success = 1
987 } gp_file_name_combine_result;
988 gp_file_name_combine_result gp_file_name_combine(const char *prefix, unsigned int plen,
989 const char *fname, unsigned int flen, bool no_sibling, char *buffer, unsigned int *blen);
990 unsigned int gp_file_name_root(const char *fname, unsigned int len);
991 unsigned int gs_file_name_check_separator(const char *fname, int len, const char *item);
992 bool gp_file_name_is_parent(const char *fname, unsigned int len);
993 bool gp_file_name_is_current(const char *fname, unsigned int len);
994 const char *gp_file_name_current(void);
995 const char *gp_file_name_separator(void);
996 const char *gp_file_name_directory_separator(void);
997 const char *gp_file_name_parent(void);
998 bool gp_file_name_is_partent_allowed(void);
999 bool gp_file_name_is_empty_item_meanful(void);
1000 int gp_read_macresource(unsigned char *buf, const char *fname,
1001 const unsigned int type, const unsigned short id);
1002 int gp_cache_insert(int type, unsigned char *key, int keylen, void *buffer, int buflen);
1003 typedef void *(*gp_cache_alloc)(void *userdata, int bytes);
1004 int gp_cache_query(int type, unsigned char* key, int keylen, void **buffer,
1005 gp_cache_alloc alloc, void *userdata);
1006 FILE *gp_open_printer(char fname[260], int binary_mode);
1007 void gp_close_printer(FILE * pfile, const char *fname);
1008 typedef struct file_enum_s file_enum;
1009 file_enum *gp_enumerate_files_init(const char *pat, unsigned int patlen,
1010 gs_memory_t * memory);
1011 unsigned int gp_enumerate_files_next(file_enum * pfen, char *ptr, unsigned int maxlen);
1012 void gp_enumerate_files_close(file_enum * pfen);
1013 void *gp_enumerate_fonts_init(gs_memory_t *mem);
1014 int gp_enumerate_fonts_next(void *enum_state, char **fontname, char **path);
1015 void gp_enumerate_fonts_free(void *enum_state);
1016 FILE *gp_fopen_64(const char *filename, const char *mode);
1017 FILE *gp_open_scratch_file_64(const char *prefix,
1018 char fname[260],
1019 const char *mode);
1020 FILE *gp_open_printer_64(char fname[260], int binary_mode);
1021 int64_t gp_ftell_64(FILE *strm);
1022 int gp_fseek_64(FILE *strm, int64_t offset, int origin);
1023 struct gs_matrix_s {
1024 float xx, xy, yx, yy, tx, ty;
1025 };
1026 struct gs_matrix_double_s {
1027 double xx, xy, yx, yy, tx, ty;
1028 };
1029 typedef struct gs_matrix_s gs_matrix;
1030 typedef struct gs_matrix_double_s gs_matrix_double;
1031 void gs_make_identity(gs_matrix *);
1032 int gs_make_translation(floatp, floatp, gs_matrix *),
1033 gs_make_scaling(floatp, floatp, gs_matrix *),
1034 gs_make_rotation(floatp, gs_matrix *);
1035 int gs_matrix_multiply(const gs_matrix *, const gs_matrix *, gs_matrix *),
1036 gs_matrix_multiply_double(const gs_matrix_double *, const gs_matrix *, gs_matrix_double *),
1037 gs_matrix_invert(const gs_matrix *, gs_matrix *),
1038 gs_matrix_invert_to_double(const gs_matrix *, gs_matrix_double *),
1039 gs_matrix_translate(const gs_matrix *, floatp, floatp, gs_matrix *),
1040 gs_matrix_scale(const gs_matrix *, floatp, floatp, gs_matrix *),
1041 gs_matrix_rotate(const gs_matrix *, floatp, gs_matrix *);
1042 int gs_point_transform(floatp, floatp, const gs_matrix *, gs_point *),
1043 gs_point_transform_inverse(floatp, floatp, const gs_matrix *, gs_point *),
1044 gs_distance_transform(floatp, floatp, const gs_matrix *, gs_point *),
1045 gs_distance_transform_inverse(floatp, floatp, const gs_matrix *, gs_point *),
1046 gs_points_bbox(const gs_point[4], gs_rect *),
1047 gs_bbox_transform_only(const gs_rect *, const gs_matrix *, gs_point[4]),
1048 gs_bbox_transform(const gs_rect *, const gs_matrix *, gs_rect *),
1049 gs_bbox_transform_inverse(const gs_rect *, const gs_matrix *, gs_rect *);
1050 int sget_matrix(stream *, gs_matrix *);
1051 int sput_matrix(stream *, const gs_matrix *);
1052 gs_id gs_next_ids(const gs_memory_t *mem, unsigned int count);
1053 void memflip8x8(const unsigned char * inp, int line_size, unsigned char * outp, int dist);
1054 unsigned long get_u32_msb(const unsigned char *p);
1055 int bytes_compare(const unsigned char * str1, unsigned int len1,
1056 const unsigned char * str2, unsigned int len2);
1057 typedef struct string_match_params_s {
1058 int any_substring;
1059 int any_char;
1060 int quote_next;
1061 bool ignore_case;
1062 bool slash_equiv;
1063 } string_match_params;
1064 extern const string_match_params string_match_params_default;
1065 bool string_match(const unsigned char * str, unsigned int len,
1066 const unsigned char * pstr, unsigned int plen,
1067 const string_match_params * psmp);
1068 typedef enum {
1069 GS_DEVICE_DOESNT_SUPPORT_TAGS = 0,
1070 GS_UNKNOWN_TAG = 0x1,
1071 GS_TEXT_TAG = 0x2,
1072 GS_IMAGE_TAG = 0x4,
1073 GS_PATH_TAG = 0x8,
1074 GS_UNTOUCHED_TAG = 0x10
1075 } gs_object_tag_type_t;
1076 gs_object_tag_type_t gs_current_object_tag(void);
1077 typedef struct gc_state_s gc_state_t;
1078 typedef struct enum_ptr_s {
1079 const void *ptr;
1080 unsigned int size;
1081 } enum_ptr_t;
1082 typedef struct struct_shared_procs_s struct_shared_procs_t;
1083 struct gs_memory_struct_type_s {
1084 unsigned int ssize;
1085 struct_name_t sname;
1086 const struct_shared_procs_t *shared;
1087 void (*clear_marks)(const gs_memory_t *cmem, void *pre, unsigned int size, const gs_memory_struct_type_t *pstype);
1088 gs_ptr_type_t (*enum_ptrs)(const gs_memory_t *mem, const void *ptr, unsigned int size, int index, enum_ptr_t *pep, const gs_memory_struct_type_t *pstype, gc_state_t *gcst);
1089 void (*reloc_ptrs)(void *ptr, unsigned int size, const gs_memory_struct_type_t *pstype, gc_state_t *gcst);
1090 void (*finalize)(void *ptr);
1091 const void *proc_data;
1092 };
1093 typedef struct gs_pattern_instance_s gs_pattern_instance_t;
1094 typedef struct gs_paint_color_s {
1095 float values[(8)];
1096 } gs_paint_color;
1097 typedef struct gs_client_color_s gs_client_color;
1098 struct gs_client_color_s {
1099 gs_pattern_instance_t *pattern;
1100 gs_paint_color paint;
1101 };
1102 extern const gs_memory_struct_type_t st_client_color;
1103 typedef struct gx_image_type_s gx_image_type_t;
1104 typedef struct gs_image_common_s {
1105 const gx_image_type_t *type; gs_matrix ImageMatrix;
1106 } gs_image_common_t;
1107 typedef struct gs_data_image_s {
1108 const gx_image_type_t *type; gs_matrix ImageMatrix; int Width; int Height; int BitsPerComponent; float Decode[((8) + 1) * 2]; bool Interpolate;
1109 } gs_data_image_t;
1110 typedef enum {
1111 gs_image_format_chunky = 0,
1112 gs_image_format_component_planar = 1,
1113 gs_image_format_bit_planar = 2
1114 } gs_image_format_t;
1115 typedef struct gs_color_space_s gs_color_space;
1116 typedef struct gs_pixel_image_s {
1117 const gx_image_type_t *type; gs_matrix ImageMatrix; int Width; int Height; int BitsPerComponent; float Decode[((8) + 1) * 2]; bool Interpolate; gs_image_format_t format; bool CombineWithColor; gs_color_space *ColorSpace;
1118 } gs_pixel_image_t;
1119 extern const gs_memory_struct_type_t st_gs_pixel_image;
1120 typedef enum {
1121 gs_image_alpha_none = 0,
1122 gs_image_alpha_first,
1123 gs_image_alpha_last
1124 } gs_image_alpha_t;
1125 typedef struct gs_image1_s {
1126 const gx_image_type_t *type; gs_matrix ImageMatrix; int Width; int Height; int BitsPerComponent; float Decode[((8) + 1) * 2]; bool Interpolate; gs_image_format_t format; bool CombineWithColor; gs_color_space *ColorSpace;
1127 bool ImageMask;
1128 bool adjust;
1129 gs_image_alpha_t Alpha;
1130 } gs_image1_t;
1131 extern const gs_memory_struct_type_t st_gs_image1;
1132 typedef gs_image1_t gs_image_t;
1133 void
1134 gs_image_common_t_init(gs_image_common_t * pic),
1135 gs_data_image_t_init(gs_data_image_t * pim, int num_components),
1136 gs_pixel_image_t_init(gs_pixel_image_t * pim,
1137 gs_color_space * color_space);
1138 void gs_image_t_init_adjust(gs_image_t * pim, gs_color_space * pcs,
1139 bool adjust);
1140 void gs_image_t_init_mask_adjust(gs_image_t * pim, bool write_1s,
1141 bool adjust);
1142 typedef struct rc_header_s rc_header;
1143 struct rc_header_s {
1144 long ref_count;
1145 gs_memory_t *memory;
1146 void (*free)(gs_memory_t *, void *, client_name_t);
1147 };
1148 void rc_free_struct_only(gs_memory_t *, void *, client_name_t);
1149 typedef enum {
1150 gs_color_space_index_DeviceGray = 0,
1151 gs_color_space_index_DeviceRGB,
1152 gs_color_space_index_DeviceCMYK,
1153 gs_color_space_index_DevicePixel,
1154 gs_color_space_index_DeviceN,
1155 gs_color_space_index_CIEDEFG,
1156 gs_color_space_index_CIEDEF,
1157 gs_color_space_index_CIEABC,
1158 gs_color_space_index_CIEA,
1159 gs_color_space_index_Separation,
1160 gs_color_space_index_Indexed,
1161 gs_color_space_index_Pattern,
1162 gs_color_space_index_CIEICC
1163 } gs_color_space_index;
1164 typedef struct gs_color_space_type_s gs_color_space_type;
1165 typedef struct gs_device_pixel_params_s {
1166 int depth;
1167 } gs_device_pixel_params;
1168 typedef struct gs_cie_a_s gs_cie_a;
1169 typedef struct gs_cie_abc_s gs_cie_abc;
1170 typedef struct gs_cie_def_s gs_cie_def;
1171 typedef struct gs_cie_defg_s gs_cie_defg;
1172 typedef struct gs_cie_icc_s gs_cie_icc;
1173 typedef struct gs_cieicc_params_s {
1174 gs_cie_icc * picc_info;
1175 } gs_icc_params;
1176 typedef struct gs_device_n_map_s gs_device_n_map;
1177 typedef struct gs_device_n_attributes_s gs_device_n_attributes;
1178 typedef unsigned long gs_separation_name;
1179 typedef int (gs_callback_func_get_colorname_string)
1180 (const gs_memory_t *mem, gs_separation_name colorname, unsigned char **ppstr, unsigned int *plen);
1181 typedef enum { SEP_NONE, SEP_ALL, SEP_OTHER } separation_type;
1182 typedef struct gs_separation_params_s {
1183 gs_separation_name sep_name;
1184 gs_device_n_map *map;
1185 separation_type sep_type;
1186 bool use_alt_cspace;
1187 gs_callback_func_get_colorname_string *get_colorname_string;
1188 } gs_separation_params;
1189 typedef struct gs_device_n_params_s {
1190 gs_separation_name *names;
1191 unsigned int num_components;
1192 gs_device_n_map *map;
1193 gs_device_n_attributes *colorants;
1194 bool use_alt_cspace;
1195 gs_callback_func_get_colorname_string *get_colorname_string;
1196 } gs_device_n_params;
1197 typedef struct client_color_space_data_s client_color_space_data_t;
1198 typedef struct gs_indexed_map_s gs_indexed_map;
1199 typedef struct gs_indexed_params_s {
1200 int hival;
1201 int n_comps;
1202 union {
1203 gs_const_string table;
1204 gs_indexed_map *map;
1205 } lookup;
1206 bool use_proc;
1207 } gs_indexed_params;
1208 typedef struct gs_pattern_params_s {
1209 bool has_base_space;
1210 } gs_pattern_params;
1211 struct gs_color_space_s {
1212 const gs_color_space_type *type;
1213 rc_header rc;
1214 gs_id id;
1215 gs_color_space *base_space;
1216 client_color_space_data_t *pclient_color_space_data;
1217 union {
1218 gs_device_pixel_params pixel;
1219 gs_cie_defg * defg;
1220 gs_cie_def * def;
1221 gs_cie_abc * abc;
1222 gs_cie_a * a;
1223 gs_separation_params separation;
1224 gs_device_n_params device_n;
1225 gs_indexed_params indexed;
1226 gs_pattern_params pattern;
1227 gs_icc_params icc;
1228 } params;
1229 };
1230 gs_color_space *gs_cspace_new_DeviceGray(gs_memory_t *mem);
1231 gs_color_space *gs_cspace_new_DeviceRGB(gs_memory_t *mem);
1232 gs_color_space *gs_cspace_new_DeviceCMYK(gs_memory_t *mem);
1233 gs_color_space_index gs_color_space_get_index(const gs_color_space *);
1234 int gs_color_space_num_components(const gs_color_space *);
1235 bool gs_color_space_equal(const gs_color_space *pcs1,
1236 const gs_color_space *pcs2);
1237 void gs_color_space_restrict_color(gs_client_color *, const gs_color_space *);
1238 const gs_color_space *gs_cspace_base_space(const gs_color_space * pcspace);
1239 gs_memory_t *gs_state_memory(const gs_state *);
1240 gs_state *gs_state_saved(const gs_state *);
1241 gs_state *gs_state_swap_saved(gs_state *, gs_state *);
1242 gs_memory_t *gs_state_swap_memory(gs_state *, gs_memory_t *);
1243 typedef void *(*gs_state_alloc_proc_t) (gs_memory_t * mem);
1244 typedef int (*gs_state_copy_proc_t) (void *to, const void *from);
1245 typedef void (*gs_state_free_proc_t) (void *old, gs_memory_t * mem);
1246 typedef enum {
1247 copy_for_gsave,
1248 copy_for_grestore,
1249 copy_for_gstate,
1250 copy_for_setgstate,
1251 copy_for_copygstate,
1252 copy_for_currentgstate
1253 } gs_state_copy_reason_t;
1254 typedef int (*gs_state_copy_for_proc_t) (void *to, void *from,
1255 gs_state_copy_reason_t reason);
1256 typedef struct gs_state_client_procs_s {
1257 gs_state_alloc_proc_t alloc;
1258 gs_state_copy_proc_t copy;
1259 gs_state_free_proc_t free;
1260 gs_state_copy_for_proc_t copy_for;
1261 } gs_state_client_procs;
1262 void gs_state_set_client(gs_state *, void *, const gs_state_client_procs *,
1263 bool client_has_pattern_streams);
1264 void *gs_state_client_data(const gs_state *);
1265 gs_id gx_get_clip_path_id(gs_state *);
1266 void gs_set_object_tag(gs_state * pgs, const gs_object_tag_type_t tag);
1267 void gs_enable_object_tagging(void);
1268 typedef struct gs_composite_s gs_composite_t;
1269 gs_id gs_composite_id(const gs_composite_t * pcte);
1270 int imod(int m, int n);
1271 int igcd(int x, int y);
1272 int idivmod(int a, int b, int m);
1273 int ilog2(int n);
1274 typedef gs_id gs_bitmap_id;
1275 typedef struct gs_bitmap_s {
1276 unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id;
1277 } gs_bitmap;
1278 typedef struct gs_const_bitmap_s {
1279 const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id;
1280 } gs_const_bitmap;
1281 typedef struct gs_tile_bitmap_s {
1282 unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height;
1283 } gs_tile_bitmap;
1284 typedef struct gs_const_tile_bitmap_s {
1285 const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height;
1286 } gs_const_tile_bitmap;
1287 typedef struct gs_depth_bitmap_s {
1288 unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned char pix_depth; unsigned char num_comps;
1289 } gs_depth_bitmap;
1290 typedef struct gs_const_depth_bitmap_s {
1291 const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned char pix_depth; unsigned char num_comps;
1292 } gs_const_depth_bitmap;
1293 typedef struct gs_tile_depth_bitmap_s {
1294 unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height; unsigned char pix_depth; unsigned char num_comps;
1295 } gs_tile_depth_bitmap;
1296 typedef struct gs_const_tile_depth_bitmap_s {
1297 const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height; unsigned char pix_depth; unsigned char num_comps;
1298 } gs_const_tile_depth_bitmap;
1299 extern const gs_memory_struct_type_t st_gs_bitmap;
1300 extern const gs_memory_struct_type_t st_gs_tile_bitmap;
1301 extern const gs_memory_struct_type_t st_gs_depth_bitmap;
1302 extern const gs_memory_struct_type_t st_gs_tile_depth_bitmap;
1303 typedef gs_bitmap_id gx_bitmap_id;
1304 typedef struct gx_bitmap_s {
1305 unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id;
1306 } gx_bitmap;
1307 typedef struct gx_const_bitmap_s {
1308 const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id;
1309 } gx_const_bitmap;
1310 typedef struct gx_tile_bitmap_s {
1311 unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height;
1312 } gx_tile_bitmap;
1313 typedef struct gx_const_tile_bitmap_s {
1314 const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height;
1315 } gx_const_tile_bitmap;
1316 typedef struct gx_strip_bitmap_s {
1317 unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height; unsigned short rep_shift; unsigned short shift;
1318 } gx_strip_bitmap;
1319 typedef struct gx_const_strip_bitmap_s {
1320 const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height; unsigned short rep_shift; unsigned short shift;
1321 } gx_const_strip_bitmap;
1322 extern const gs_memory_struct_type_t st_gx_strip_bitmap;
1323 typedef struct gx_ht_tile_s gx_ht_tile;
1324 struct gx_ht_tile_s {
1325 gx_strip_bitmap tiles;
1326 int level;
1327 unsigned int index;
1328 };
1329 void bits_fill_rectangle(unsigned char * dest, int dest_bit, unsigned int raster,
1330 unsigned int pattern, int width_bits, int height);
1331 void bits_fill_rectangle_masked(unsigned char * dest, int dest_bit, unsigned int raster,
1332 unsigned int pattern, unsigned int src_mask,
1333 int width_bits, int height);
1334 void bits_replicate_horizontally(unsigned char * data, unsigned int width, unsigned int height,
1335 unsigned int raster, unsigned int replicated_width, unsigned int replicated_raster);
1336 void bits_replicate_vertically(unsigned char * data, unsigned int height, unsigned int raster,
1337 unsigned int replicated_height);
1338 void bits_bounding_box(const unsigned char * data, unsigned int height, unsigned int raster,
1339 gs_int_rect * pbox);
1340 void bits_compress_scaled(const unsigned char * src, int srcx, unsigned int width,
1341 unsigned int height, unsigned int sraster, unsigned char * dest, unsigned int draster,
1342 const gs_log2_scale_point * plog2_scale, int log2_out_bits);
1343 typedef struct bits_plane_s {
1344 union bpd_ {
1345 unsigned char *write;
1346 const unsigned char *read;
1347 } data;
1348 int raster;
1349 int depth;
1350 int x;
1351 } bits_plane_t;
1352 int bits_extract_plane(const bits_plane_t *dest ,
1353 const bits_plane_t *source , int shift, int width, int height);
1354 int bits_expand_plane(const bits_plane_t *dest ,
1355 const bits_plane_t *source , int shift, int width, int height);
1356 void bytes_fill_rectangle(unsigned char * dest, unsigned int raster,
1357 unsigned char value, int width_bytes, int height);
1358 void bytes_copy_rectangle(unsigned char * dest, unsigned int dest_raster,
1359 const unsigned char * src, unsigned int src_raster, int width_bytes, int height);
1360 typedef unsigned long long gx_color_index_data;
1361 typedef gx_color_index_data gx_color_index;
1362 typedef bits16 wts_screen_sample_t;
1363 typedef struct wts_screen_s wts_screen_t;
1364 typedef enum {
1365 WTS_SCREEN_RAT,
1366 WTS_SCREEN_J,
1367 WTS_SCREEN_H
1368 } wts_screen_type;
1369 struct wts_screen_s {
1370 wts_screen_type type;
1371 int cell_width;
1372 int cell_height;
1373 int cell_shift;
1374 wts_screen_sample_t *samples;
1375 };
1376 typedef struct {
1377 int tag;
1378 int x;
1379 int y;
1380 int nsamples;
1381 } wts_j_cache_el;
1382 typedef struct {
1383 wts_screen_t base;
1384 int pa;
1385 int pb;
1386 int pc;
1387 int pd;
1388 int XA;
1389 int YA;
1390 int XB;
1391 int YB;
1392 int XC;
1393 int YC;
1394 int XD;
1395 int YD;
1396 wts_j_cache_el xcache[512];
1397 wts_j_cache_el ycache[512];
1398 } wts_screen_j_t;
1399 typedef struct {
1400 wts_screen_t base;
1401 double px;
1402 double py;
1403 int x1;
1404 int y1;
1405 } wts_screen_h_t;
1406 int
1407 wts_get_samples(wts_screen_t *ws, int x, int y,
1408 int *pcellx, int *pcelly, int *p_nsamples);
1409 typedef struct gx_device_color_s gx_device_color;
1410 typedef struct gx_device_color_saved_s gx_device_color_saved;
1411 typedef struct gx_device_halftone_s gx_device_halftone;
1412 bool gx_device_color_equal(const gx_device_color *pdevc1,
1413 const gx_device_color *pdevc2);
1414 void gx_complete_halftone(gx_device_color *pdevc, int num_comps,
1415 gx_device_halftone *pdht);
1416 typedef struct gx_color_tile_s gx_color_tile;
1417 typedef struct gx_device_color_type_s gx_device_color_type_t;
1418 typedef const gx_device_color_type_t *gx_device_color_type;
1419 struct gx_device_color_s {
1420 gx_device_color_type type;
1421 union _c {
1422 gx_color_index pure;
1423 struct _bin {
1424 const gx_device_halftone *b_ht;
1425 gx_color_index color[2];
1426 unsigned int b_level;
1427 int b_index;
1428 gx_ht_tile *b_tile;
1429 } binary;
1430 struct _col {
1431 gx_device_halftone *c_ht;
1432 unsigned short num_components;
1433 unsigned char c_base[(8 * 8)];
1434 unsigned int c_level[(8 * 8)];
1435 unsigned short alpha;
1436 gx_color_index plane_mask;
1437 } colored;
1438 struct _wts {
1439 const gx_device_halftone *w_ht;
1440 wts_screen_sample_t levels[(8 * 8)];
1441 unsigned short num_components;
1442 gx_color_index plane_vector[(8 * 8)];
1443 } wts;
1444 struct _pat {
1445 gx_color_tile *p_tile;
1446 } pattern;
1447 } colors;
1448 gs_int_point phase;
1449 bool ccolor_valid;
1450 gs_client_color ccolor;
1451 struct _mask {
1452 struct mp_ {
1453 short x, y;
1454 } m_phase;
1455 gx_bitmap_id id;
1456 gx_color_tile *m_tile;
1457 } mask;
1458 };
1459 struct gx_device_color_saved_s {
1460 gx_device_color_type type;
1461 union _svc {
1462 gx_color_index pure;
1463 struct _svbin {
1464 gx_color_index b_color[2];
1465 unsigned int b_level;
1466 int b_index;
1467 } binary;
1468 struct _svcol {
1469 unsigned char c_base[(8 * 8)];
1470 unsigned int c_level[(8 * 8)];
1471 unsigned short alpha;
1472 } colored;
1473 struct _swts {
1474 wts_screen_sample_t levels[(8 * 8)];
1475 } wts;
1476 struct _pattern {
1477 gs_id id;
1478 gs_int_point phase;
1479 } pattern;
1480 struct _pattern2 {
1481 gs_id id;
1482 bool shfill;
1483 } pattern2;
1484 } colors;
1485 gs_int_point phase;
1486 };
1487 extern const gx_device_color_type_t *const gx_dc_type_none;
1488 extern const gx_device_color_type_t *const gx_dc_type_null;
1489 extern const gx_device_color_type_t *const gx_dc_type_pure;
1490 extern const gx_device_color_type_t *const gx_dc_type_ht_binary;
1491 extern const gx_device_color_type_t *const gx_dc_type_ht_colored;
1492 extern const gx_device_color_type_t *const gx_dc_type_wts;
1493 typedef enum {
1494 rop2_0 = 0,
1495 rop2_S = 0xc,
1496 rop2_D = 0xa,
1497 rop2_1 = 0xf,
1498 rop2_default = rop2_S
1499 } gs_rop2_t;
1500 typedef enum {
1501 rop3_0 = 0,
1502 rop3_T = 0xf0,
1503 rop3_S = 0xcc,
1504 rop3_D = 0xaa,
1505 rop3_1 = 0xff,
1506 rop3_default = rop3_T | rop3_S
1507 } gs_rop3_t;
1508 typedef unsigned int gs_logical_operation_t;
1509 typedef unsigned long rop_operand;
1510 typedef rop_operand (*rop_proc)(rop_operand D, rop_operand S, rop_operand T);
1511 typedef enum {
1512 rop_usage_none = 0,
1513 rop_usage_D = 1,
1514 rop_usage_S = 2,
1515 rop_usage_DS = 3,
1516 rop_usage_T = 4,
1517 rop_usage_DT = 5,
1518 rop_usage_ST = 6,
1519 rop_usage_DST = 7
1520 } rop_usage_t;
1521 extern const rop_proc rop_proc_table[256];
1522 extern const unsigned char rop_usage_table[256];
1523 typedef struct obj_header_s obj_header_t;
1524 struct gs_ptr_procs_s {
1525 void (*unmark)(enum_ptr_t *, gc_state_t *);
1526 bool (*mark)(enum_ptr_t *, gc_state_t *);
1527 void *(*reloc)(const void *, gc_state_t *);
1528 };
1529 extern const gs_ptr_procs_t ptr_struct_procs;
1530 extern const gs_ptr_procs_t ptr_string_procs;
1531 extern const gs_ptr_procs_t ptr_const_string_procs;
1532 struct gs_gc_root_s {
1533 gs_gc_root_t *next;
1534 gs_ptr_type_t ptype;
1535 void **p;
1536 bool free_on_unregister;
1537 };
1538 typedef struct gc_procs_common_s {
1539 void *(*reloc_struct_ptr)(const void *, gc_state_t *); void (*reloc_string)(gs_string *, gc_state_t *); void (*reloc_const_string)(gs_const_string *, gc_state_t *); void (*reloc_param_string)(gs_param_string *, gc_state_t *);
1540 } gc_procs_common_t;
1541 gs_ptr_type_t gs_no_struct_enum_ptrs(const gs_memory_t *mem, const void *ptr, unsigned int size, int index, enum_ptr_t *pep, const gs_memory_struct_type_t *pstype, gc_state_t *gcst);
1542 void gs_no_struct_reloc_ptrs(void *ptr, unsigned int size, const gs_memory_struct_type_t *pstype, gc_state_t *gcst);
1543 extern const gs_memory_struct_type_t st_free;
1544 extern const gs_memory_struct_type_t st_bytes;
1545 extern const gs_memory_struct_type_t st_gc_root_t;
1546 extern const gs_memory_struct_type_t st_const_string_element;
1547 typedef enum {
1548 GC_ELT_OBJ,
1549 GC_ELT_STRING,
1550 GC_ELT_CONST_STRING
1551 } gc_ptr_type_index_t;
1552 typedef struct gc_ptr_element_s {
1553 unsigned short type;
1554 unsigned short offset;
1555 } gc_ptr_element_t;
1556 typedef struct gc_struct_data_s {
1557 unsigned short num_ptrs;
1558 unsigned short super_offset;
1559 const gs_memory_struct_type_t *super_type;
1560 const gc_ptr_element_t *ptrs;
1561 } gc_struct_data_t;
1562 gs_ptr_type_t basic_enum_ptrs(const gs_memory_t *mem, const void *ptr, unsigned int size, int index, enum_ptr_t *pep, const gs_memory_struct_type_t *pstype, gc_state_t *gcst);
1563 void basic_reloc_ptrs(void *ptr, unsigned int size, const gs_memory_struct_type_t *pstype, gc_state_t *gcst);
1564 extern gs_ptr_type_t
1565 enum_bytestring(enum_ptr_t *pep, const gs_bytestring *pbs);
1566 extern gs_ptr_type_t
1567 enum_const_bytestring(enum_ptr_t *pep, const gs_const_bytestring *pbs);
1568 extern void reloc_bytestring(gs_bytestring *pbs, gc_state_t *gcst);
1569 extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
1570 typedef enum {
1571 BLEND_MODE_Compatible,
1572 BLEND_MODE_Normal,
1573 BLEND_MODE_Multiply,
1574 BLEND_MODE_Screen,
1575 BLEND_MODE_Difference,
1576 BLEND_MODE_Darken,
1577 BLEND_MODE_Lighten,
1578 BLEND_MODE_ColorDodge,
1579 BLEND_MODE_ColorBurn,
1580 BLEND_MODE_Exclusion,
1581 BLEND_MODE_HardLight,
1582 BLEND_MODE_Overlay,
1583 BLEND_MODE_SoftLight,
1584 BLEND_MODE_Luminosity,
1585 BLEND_MODE_Hue,
1586 BLEND_MODE_Saturation,
1587 BLEND_MODE_Color
1588 } gs_blend_mode_t;
1589 typedef enum {
1590 TRANSPARENCY_STATE_Group = 1,
1591 TRANSPARENCY_STATE_Mask
1592 } gs_transparency_state_type_t;
1593 typedef struct gs_transparency_state_s gs_transparency_state_t;
1594 struct gs_transparency_state_s {
1595 gs_transparency_state_t *saved; gs_transparency_state_type_t type;
1596 };
1597 typedef struct gs_transparency_mask_s {
1598 rc_header rc;
1599 } gs_transparency_mask_t;
1600 typedef struct gs_function_s gs_function_t;
1601 typedef struct gs_transparency_group_params_s {
1602 const gs_color_space *ColorSpace;
1603 bool Isolated;
1604 bool Knockout;
1605 bool image_with_SMask;
1606 bool idle;
1607 unsigned int mask_id;
1608 } gs_transparency_group_params_t;
1609 typedef enum {
1610 TRANSPARENCY_MASK_Alpha,
1611 TRANSPARENCY_MASK_Luminosity
1612 } gs_transparency_mask_subtype_t;
1613 typedef struct gs_transparency_mask_params_s {
1614 gs_transparency_mask_subtype_t subtype;
1615 int Background_components;
1616 float Background[(8)];
1617 float GrayBackground;
1618 int (*TransferFunction)(floatp in, float *out, void *proc_data);
1619 gs_function_t *TransferFunction_data;
1620 bool replacing;
1621 } gs_transparency_mask_params_t;
1622 typedef struct gx_transparency_mask_params_s {
1623 gs_transparency_mask_subtype_t subtype;
1624 int Background_components;
1625 float Background[(8)];
1626 float GrayBackground;
1627 bool function_is_identity;
1628 bool idle;
1629 bool replacing;
1630 unsigned int mask_id;
1631 unsigned char transfer_fn[256];
1632 } gx_transparency_mask_params_t;
1633 typedef enum {
1634 TRANSPARENCY_CHANNEL_Opacity = 0,
1635 TRANSPARENCY_CHANNEL_Shape = 1
1636 } gs_transparency_channel_selector_t;
1637 typedef unsigned long gx_xglyph;
1638 struct gx_xfont_procs_s;
1639 typedef struct gx_xfont_procs_s gx_xfont_procs;
1640 struct gx_xfont_s;
1641 typedef struct gx_xfont_s gx_xfont;
1642 typedef unsigned short gx_color_value;
1643 typedef long fixed;
1644 typedef unsigned long ufixed;
1645 fixed fixed_mult_quo(fixed A, fixed B, fixed C);
1646 bool
1647 gx_intersect_small_bars(fixed q0x, fixed q0y, fixed q1x, fixed q1y, fixed q2x, fixed q2y,
1648 fixed q3x, fixed q3y, fixed *ry, fixed *ey);
1649 typedef struct gs_fixed_point_s {
1650 fixed x, y;
1651 } gs_fixed_point;
1652 typedef struct gs_fixed_rect_s {
1653 gs_fixed_point p, q;
1654 } gs_fixed_rect;
1655 typedef unsigned long gs_char;
1656 typedef unsigned long gs_glyph;
1657 typedef bool (*gs_glyph_mark_proc_t)(const gs_memory_t *mem, gs_glyph glyph, void *proc_data);
1658 typedef enum {
1659 ENCODING_INDEX_UNKNOWN = -1,
1660 ENCODING_INDEX_STANDARD = 0,
1661 ENCODING_INDEX_ISOLATIN1,
1662 ENCODING_INDEX_SYMBOL,
1663 ENCODING_INDEX_DINGBATS,
1664 ENCODING_INDEX_WINANSI,
1665 ENCODING_INDEX_MACROMAN,
1666 ENCODING_INDEX_MACEXPERT,
1667 ENCODING_INDEX_MACGLYPH,
1668 ENCODING_INDEX_ALOGLYPH,
1669 ENCODING_INDEX_ALXGLYPH,
1670 ENCODING_INDEX_CFFSTRINGS
1671 } gs_encoding_index_t;
1672 typedef enum gs_glyph_space_s {
1673 GLYPH_SPACE_NAME,
1674 GLYPH_SPACE_INDEX,
1675 GLYPH_SPACE_NOGEN
1676 } gs_glyph_space_t;
1677 typedef int (*gs_glyph_name_proc_t)(const gs_memory_t *mem,
1678 gs_glyph glyph, gs_const_string *pstr,
1679 void *proc_data);
1680 typedef enum {
1681 cpm_show,
1682 cpm_charwidth,
1683 cpm_false_charpath,
1684 cpm_true_charpath,
1685 cpm_false_charboxpath,
1686 cpm_true_charboxpath
1687 } gs_char_path_mode;
1688 typedef enum {
1689 CACHE_DEVICE_NONE = 0,
1690 CACHE_DEVICE_NOT_CACHING,
1691 CACHE_DEVICE_NONE_AND_CLIP,
1692 CACHE_DEVICE_CACHING
1693 } gs_in_cache_device_t;
1694 typedef struct gs_text_params_s {
1695 unsigned int operation;
1696 union sd_ {
1697 const unsigned char *bytes;
1698 const gs_char *chars;
1699 const gs_glyph *glyphs;
1700 gs_char d_char;
1701 gs_glyph d_glyph;
1702 } data;
1703 unsigned int size;
1704 gs_point delta_all;
1705 gs_point delta_space;
1706 union s_ {
1707 gs_char s_char;
1708 gs_glyph s_glyph;
1709 } space;
1710 const float *x_widths;
1711 const float *y_widths;
1712 unsigned int widths_size;
1713 } gs_text_params_t;
1714 int gs_text_replaced_width(const gs_text_params_t *text, unsigned int index,
1715 gs_point *pwidth);
1716 typedef struct gs_text_enum_s gs_text_enum_t;
1717 typedef struct gx_device_s gx_device;
1718 typedef struct gs_font_s gs_font;
1719 typedef struct gx_path_s gx_path;
1720 typedef struct gx_clip_path_s gx_clip_path;
1721 int gx_device_text_begin(gx_device *dev, gs_imager_state *pis, const gs_text_params_t *text, gs_font *font, gx_path *path, const gx_device_color *pdcolor, const gx_clip_path *pcpath, gs_memory_t *memory, gs_text_enum_t **ppte);
1722 int gs_text_begin(gs_state * pgs, const gs_text_params_t * text,
1723 gs_memory_t * mem, gs_text_enum_t ** ppenum);
1724 int gs_text_update_dev_color(gs_state * pgs, gs_text_enum_t * pte);
1725 int
1726 gs_show_begin(gs_state *, const unsigned char *, unsigned int,
1727 gs_memory_t *, gs_text_enum_t **),
1728 gs_ashow_begin(gs_state *, floatp, floatp, const unsigned char *, unsigned int,
1729 gs_memory_t *, gs_text_enum_t **),
1730 gs_widthshow_begin(gs_state *, floatp, floatp, gs_char,
1731 const unsigned char *, unsigned int,
1732 gs_memory_t *, gs_text_enum_t **),
1733 gs_awidthshow_begin(gs_state *, floatp, floatp, gs_char,
1734 floatp, floatp, const unsigned char *, unsigned int,
1735 gs_memory_t *, gs_text_enum_t **),
1736 gs_kshow_begin(gs_state *, const unsigned char *, unsigned int,
1737 gs_memory_t *, gs_text_enum_t **),
1738 gs_xyshow_begin(gs_state *, const unsigned char *, unsigned int,
1739 const float *, const float *, unsigned int,
1740 gs_memory_t *, gs_text_enum_t **),
1741 gs_glyphshow_begin(gs_state *, gs_glyph,
1742 gs_memory_t *, gs_text_enum_t **),
1743 gs_cshow_begin(gs_state *, const unsigned char *, unsigned int,
1744 gs_memory_t *, gs_text_enum_t **),
1745 gs_stringwidth_begin(gs_state *, const unsigned char *, unsigned int,
1746 gs_memory_t *, gs_text_enum_t **),
1747 gs_charpath_begin(gs_state *, const unsigned char *, unsigned int, bool,
1748 gs_memory_t *, gs_text_enum_t **),
1749 gs_glyphpath_begin(gs_state *, gs_glyph, bool,
1750 gs_memory_t *, gs_text_enum_t **),
1751 gs_glyphwidth_begin(gs_state *, gs_glyph,
1752 gs_memory_t *, gs_text_enum_t **),
1753 gs_charboxpath_begin(gs_state *, const unsigned char *, unsigned int, bool,
1754 gs_memory_t *, gs_text_enum_t **);
1755 int gs_text_size(gs_state * pgs, gs_text_params_t *text, gs_memory_t * mem);
1756 gs_text_params_t *gs_get_text_params(gs_text_enum_t *pte);
1757 int gs_text_restart(gs_text_enum_t *pte, const gs_text_params_t *text);
1758 int gs_text_resync(gs_text_enum_t *pte, const gs_text_enum_t *pfrom);
1759 int gs_text_process(gs_text_enum_t *pte);
1760 gs_font *gs_text_current_font(const gs_text_enum_t *pte);
1761 gs_char gs_text_current_char(const gs_text_enum_t *pte);
1762 gs_char gs_text_next_char(const gs_text_enum_t *pte);
1763 gs_glyph gs_text_current_glyph(const gs_text_enum_t *pte);
1764 int gs_text_total_width(const gs_text_enum_t *pte, gs_point *pwidth);
1765 bool gs_text_is_width_only(const gs_text_enum_t *pte);
1766 int gs_text_current_width(const gs_text_enum_t *pte, gs_point *pwidth);
1767 typedef enum {
1768 TEXT_SET_CHAR_WIDTH,
1769 TEXT_SET_CACHE_DEVICE,
1770 TEXT_SET_CACHE_DEVICE2
1771 } gs_text_cache_control_t;
1772 int
1773 gs_text_set_cache(gs_text_enum_t *pte, const double *values,
1774 gs_text_cache_control_t control),
1775 gs_text_setcharwidth(gs_text_enum_t *pte, const double wxy[2]),
1776 gs_text_setcachedevice(gs_text_enum_t *pte, const double wbox[6]),
1777 gs_text_setcachedevice2(gs_text_enum_t *pte, const double wbox2[10]);
1778 int gs_text_retry(gs_text_enum_t *pte);
1779 void gs_text_release(gs_text_enum_t *pte, client_name_t cname);
1780 int gs_text_count_chars(gs_state * pgs, gs_text_params_t *text, gs_memory_t * mem);
1781 typedef struct gs_text_enum_procs_s gs_text_enum_procs_t;
1782 typedef struct cached_fm_pair_s cached_fm_pair;
1783 typedef struct gs_text_returned_s {
1784 gs_char current_char;
1785 gs_glyph current_glyph;
1786 gs_point total_width;
1787 } gs_text_returned_t;
1788 typedef struct gx_font_stack_item_s {
1789 gs_font *font;
1790 unsigned int index;
1791 } gx_font_stack_item_t;
1792 typedef struct gx_font_stack_s {
1793 int depth;
1794 gx_font_stack_item_t items[1 + 5];
1795 } gx_font_stack_t;
1796 void rc_free_text_enum(gs_memory_t *, void *, client_name_t);
1797 struct gs_text_enum_s {
1798 gs_text_params_t text; gx_device *dev; gx_device *imaging_dev; gs_imager_state *pis; gs_font *orig_font; gx_path *path; const gx_device_color *pdcolor; const gx_clip_path *pcpath; gs_memory_t *memory; const gs_text_enum_procs_t *procs; rc_header rc; void *enum_client_data; gs_font *current_font; gs_glyph outer_CID; bool is_pure_color; gs_log2_scale_point log2_scale; cached_fm_pair *pair; unsigned int index; unsigned int xy_index; gx_font_stack_t fstack; int cmap_code; gs_point FontBBox_as_Metrics2; unsigned long text_enum_id; bool device_disabled_grid_fitting; gs_text_returned_t returned;
1799 };
1800 int gs_text_enum_init(gs_text_enum_t *pte,
1801 const gs_text_enum_procs_t *procs,
1802 gx_device *dev, gs_imager_state *pis,
1803 const gs_text_params_t *text,
1804 gs_font *font, gx_path *path,
1805 const gx_device_color *pdcolor,
1806 const gx_clip_path *pcpath,
1807 gs_memory_t *mem);
1808 void gs_text_enum_copy_dynamic(gs_text_enum_t *pto,
1809 const gs_text_enum_t *pfrom,
1810 bool for_return);
1811 struct gs_text_enum_procs_s {
1812 int (*resync)(gs_text_enum_t *pte, const gs_text_enum_t *pfrom);
1813 int (*process)(gs_text_enum_t *pte);
1814 bool (*is_width_only)(const gs_text_enum_t *pte);
1815 int (*current_width)(const gs_text_enum_t *pte, gs_point *pwidth);
1816 int (*set_cache)(gs_text_enum_t *pte, const double *values, gs_text_cache_control_t control);
1817 int (*retry)(gs_text_enum_t *pte);
1818 void (*release)(gs_text_enum_t *pte, client_name_t cname);
1819 };
1820 void gx_default_text_release(gs_text_enum_t *pte, client_name_t cname);
1821 typedef enum {
1822 gs_color_select_all = -1,
1823 gs_color_select_texture = 0,
1824 gs_color_select_source = 1
1825 } gs_color_select_t;
1826 typedef short frac;
1827 typedef short signed_frac;
1828 typedef struct gx_transfer_map_s gx_transfer_map;
1829 typedef float (*gs_mapping_proc) (floatp, const gx_transfer_map *);
1830 typedef float (*gs_mapping_closure_proc_t) (floatp value,
1831 const gx_transfer_map * pmap,
1832 const void *proc_data);
1833 typedef struct gs_mapping_closure_s {
1834 gs_mapping_closure_proc_t proc;
1835 const void *data;
1836 } gs_mapping_closure_t;
1837 struct gx_transfer_map_s {
1838 rc_header rc;
1839 gs_mapping_proc proc;
1840 gs_mapping_closure_t closure;
1841 gs_id id;
1842 frac values[(1 << 8)];
1843 };
1844 extern const gs_memory_struct_type_t st_transfer_map;
1845 void gx_set_identity_transfer(gx_transfer_map *);
1846 frac gx_color_frac_map(frac, const frac *);
1847 float gs_mapped_transfer(floatp, const gx_transfer_map *);
1848 float gs_identity_transfer(floatp, const gx_transfer_map *);
1849 struct gx_cm_color_map_procs_s {
1850 void (*map_gray) (gx_device * dev, frac gray, frac * out);
1851 void (*map_rgb) (gx_device * dev, const gs_imager_state *pis, frac r, frac g, frac b, frac * out);
1852 void (*map_cmyk) (gx_device * dev, frac c, frac m, frac y, frac k, frac * out);
1853 };
1854 typedef struct gx_cm_color_map_procs_s gx_cm_color_map_procs;
1855 void gray_cs_to_gray_cm (gx_device * dev, frac gray, frac * out);
1856 void rgb_cs_to_rgb_cm (gx_device * dev, const gs_imager_state *pis, frac r, frac g, frac b, frac * out);
1857 void cmyk_cs_to_cmyk_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out);
1858 struct gx_color_map_procs_s {
1859 void (*map_gray)(frac, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1860 void (*map_rgb)(frac, frac, frac, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1861 void (*map_cmyk)(frac, frac, frac, frac, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1862 void (*map_rgb_alpha)(frac, frac, frac, frac, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1863 void (*map_separation)(frac, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1864 void (*map_devicen)(const frac *, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1865 bool (*is_halftoned)(const gs_imager_state *, gx_device *);
1866 };
1867 typedef struct gx_color_map_procs_s gx_color_map_procs;
1868 const gx_color_map_procs *
1869 gx_get_cmap_procs(const gs_imager_state *, const gx_device *);
1870 const gx_color_map_procs *
1871 gx_default_get_cmap_procs(const gs_imager_state *, const gx_device *);
1872 void gx_set_cmap_procs(gs_imager_state *, const gx_device *);
1873 extern void gx_default_gray_cs_to_gray_cm (gx_device * dev, frac gray, frac * out);
1874 extern void gx_default_rgb_cs_to_gray_cm (gx_device * dev, const gs_imager_state *pis, frac r, frac g, frac b, frac * out);
1875 extern void gx_default_cmyk_cs_to_gray_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out);
1876 extern void gx_default_gray_cs_to_rgb_cm (gx_device * dev, frac gray, frac * out);
1877 extern void gx_default_rgb_cs_to_rgb_cm (gx_device * dev, const gs_imager_state *pis, frac r, frac g, frac b, frac * out);
1878 extern void gx_default_cmyk_cs_to_rgb_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out);
1879 extern void gx_default_gray_cs_to_cmyk_cm (gx_device * dev, frac gray, frac * out);
1880 extern void gx_default_rgb_cs_to_cmyk_cm (gx_device * dev, const gs_imager_state *pis, frac r, frac g, frac b, frac * out);
1881 extern void gx_default_cmyk_cs_to_cmyk_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out);
1882 extern void gx_default_gray_cs_to_cmyk_cm (gx_device * dev, frac gray, frac * out);
1883 extern void gx_default_rgb_cs_to_cmyk_cm (gx_device * dev, const gs_imager_state *pis, frac r, frac g, frac b, frac * out);
1884 extern void gx_default_cmyk_cs_to_cmyk_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out);
1885 extern void gx_error_gray_cs_to_cmyk_cm (gx_device * dev, frac gray, frac * out);
1886 extern void gx_error_rgb_cs_to_cmyk_cm (gx_device * dev, const gs_imager_state *pis, frac r, frac g, frac b, frac * out);
1887 extern void gx_error_cmyk_cs_to_cmyk_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out);
1888 int (gx_error_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type);
1889 int (gx_default_DevGray_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type);
1890 int (gx_default_DevRGB_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type);
1891 int (gx_default_DevCMYK_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type);
1892 int (gx_default_DevRGBK_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type);
1893 const gx_cm_color_map_procs * (gx_error_get_color_mapping_procs)(const gx_device * dev);
1894 const gx_cm_color_map_procs * (gx_default_DevGray_get_color_mapping_procs)(const gx_device * dev);
1895 const gx_cm_color_map_procs * (gx_default_DevRGB_get_color_mapping_procs)(const gx_device * dev);
1896 const gx_cm_color_map_procs * (gx_default_DevCMYK_get_color_mapping_procs)(const gx_device * dev);
1897 const gx_cm_color_map_procs * (gx_default_DevRGBK_get_color_mapping_procs)(const gx_device * dev);
1898 gx_color_index (gx_error_encode_color)(gx_device * dev, const gx_color_value colors[]);
1899 gx_color_index (gx_default_encode_color)(gx_device * dev, const gx_color_value colors[]);
1900 gx_color_index (gx_default_gray_fast_encode)(gx_device * dev, const gx_color_value colors[]);
1901 gx_color_index (gx_default_gray_encode)(gx_device * dev, const gx_color_value colors[]);
1902 gx_color_index (gx_backwards_compatible_gray_encode)(gx_device * dev, const gx_color_value colors[]);
1903 int (gx_error_decode_color)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]);
1904 int (gx_default_decode_color)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]);
1905 frac gx_unit_frac(float fvalue);
1906 struct gs_color_space_type_s {
1907 gs_color_space_index index;
1908 bool can_be_base_space;
1909 bool can_be_alt_space;
1910 gs_memory_type_ptr_t stype;
1911 int (*num_components)(const gs_color_space *);
1912 void (*init_color)(gs_client_color *, const gs_color_space *);
1913 void (*restrict_color)(gs_client_color *, const gs_color_space *);
1914 const gs_color_space *(*concrete_space)(const gs_color_space *, const gs_imager_state *);
1915 int (*concretize_color)(const gs_client_color *, const gs_color_space *, frac *, const gs_imager_state *);
1916 int (*remap_concrete_color)(const frac *, const gs_color_space * pcs, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1917 int (*remap_color)(const gs_client_color *, const gs_color_space *, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1918 int (*install_cspace)(gs_color_space *, gs_state *);
1919 int (*set_overprint)(const gs_color_space *, gs_state *);
1920 void (*final)(const gs_color_space *);
1921 void (*adjust_color_count)(const gs_client_color *, const gs_color_space *, int);
1922 int (*serialize)(const gs_color_space *, stream *);
1923 int (*is_linear)(const gs_color_space *cs, const gs_imager_state * pis, gx_device *dev, const gs_client_color *c0, const gs_client_color *c1, const gs_client_color *c2, const gs_client_color *c3, float smoothness);
1924 };
1925 extern const gs_memory_struct_type_t st_base_color_space;
1926 int gx_num_components_1(const gs_color_space *);
1927 int gx_num_components_3(const gs_color_space *);
1928 int gx_num_components_4(const gs_color_space *);
1929 void gx_init_paint_1(gs_client_color *, const gs_color_space *);
1930 void gx_init_paint_3(gs_client_color *, const gs_color_space *);
1931 void gx_init_paint_4(gs_client_color *, const gs_color_space *);
1932 void gx_restrict01_paint_1(gs_client_color *, const gs_color_space *);
1933 void gx_restrict01_paint_3(gs_client_color *, const gs_color_space *);
1934 void gx_restrict01_paint_4(gs_client_color *, const gs_color_space *);
1935 const gs_color_space *gx_no_concrete_space(const gs_color_space *, const gs_imager_state *);
1936 const gs_color_space *gx_same_concrete_space(const gs_color_space *, const gs_imager_state *);
1937 int gx_no_concretize_color(const gs_client_color *, const gs_color_space *, frac *, const gs_imager_state *);
1938 int gx_default_remap_color(const gs_client_color *, const gs_color_space *, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1939 int gx_no_install_cspace(gs_color_space *, gs_state *);
1940 int gx_spot_colors_set_overprint(const gs_color_space *, gs_state *);
1941 void gx_no_adjust_color_count(const gs_client_color *, const gs_color_space *, int);
1942 int gx_serialize_cspace_type(const gs_color_space *, stream *);
1943 int gx_cspace_no_linear(const gs_color_space *cs, const gs_imager_state * pis, gx_device *dev, const gs_client_color *c0, const gs_client_color *c1, const gs_client_color *c2, const gs_client_color *c3, float smoothness);
1944 int gx_cspace_is_linear_default(const gs_color_space *cs, const gs_imager_state * pis, gx_device *dev, const gs_client_color *c0, const gs_client_color *c1, const gs_client_color *c2, const gs_client_color *c3, float smoothness);
1945 int gx_remap_DeviceGray(const gs_client_color *, const gs_color_space *, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1946 int gx_concretize_DeviceGray(const gs_client_color *, const gs_color_space *, frac *, const gs_imager_state *);
1947 int gx_remap_concrete_DGray(const frac *, const gs_color_space * pcs, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1948 int gx_remap_DeviceRGB(const gs_client_color *, const gs_color_space *, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1949 int gx_concretize_DeviceRGB(const gs_client_color *, const gs_color_space *, frac *, const gs_imager_state *);
1950 int gx_remap_concrete_DRGB(const frac *, const gs_color_space * pcs, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1951 int gx_remap_DeviceCMYK(const gs_client_color *, const gs_color_space *, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1952 int gx_concretize_DeviceCMYK(const gs_client_color *, const gs_color_space *, frac *, const gs_imager_state *);
1953 int gx_remap_concrete_DCMYK(const frac *, const gs_color_space * pcs, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t);
1954 extern const gs_memory_struct_type_t st_color_space;
1955 gs_color_space *
1956 gs_cspace_alloc(gs_memory_t *mem, const gs_color_space_type *pcstype);
1957 gx_color_index check_cmyk_color_model_comps(gx_device * dev);
1958 typedef struct gs_context_state_s i_ctx_t;
1959 typedef struct gs_param_list_s gs_param_list;
1960 int custom_color_callback_put_params(gs_state * pgs, gs_param_list * plist);
1961 int custom_color_callback_get_params(gs_state * pgs, gs_param_list * plist);
1962 bool custom_color_callback_install_Separation(gs_color_space * pcs,
1963 gs_state * pgs);
1964 bool custom_color_callback_install_DeviceN(gs_color_space * pcs, gs_state * pgs);
1965 int gx_remap_concrete_custom_color_Separation(const frac * pconc,
1966 const gs_color_space * pcs, gx_device_color * pdc,
1967 const gs_imager_state * pis, gx_device * dev, gs_color_select_t select);
1968 int gx_remap_concrete_custom_color_DeviceN(const frac * pconc,
1969 const gs_color_space * pcs, gx_device_color * pdc,
1970 const gs_imager_state * pis, gx_device * dev, gs_color_select_t select);
1971 typedef struct client_custom_color_params_s {
1972 struct client_custom_color_procs_s * client_procs;
1973 void * data;
1974 } client_custom_color_params_t;
1975 typedef struct client_color_space_data_s {
1976 void (*client_adjust_cspace_count)(const gs_color_space *, int);
1977 } client_color_space__data_t;
1978 typedef struct client_custom_color_procs_s {
1979 bool (* install_DeviceGray)(client_custom_color_params_t * pparams,
1980 gs_color_space * pcs, gs_state * pgs);
1981 int (* remap_DeviceGray)(client_custom_color_params_t * pparams,
1982 const frac * pconc, const gs_color_space * pcs,
1983 gx_device_color * pdc, const gs_imager_state * pis,
1984 gx_device * dev, gs_color_select_t select);
1985 bool (* install_DeviceRGB)(client_custom_color_params_t * pparams,
1986 gs_color_space * pcs, gs_state * pgs);
1987 int (* remap_DeviceRGB)(client_custom_color_params_t * pparams,
1988 const frac * pconc, const gs_color_space * pcs,
1989 gx_device_color * pdc, const gs_imager_state * pis,
1990 gx_device * dev, gs_color_select_t select);
1991 bool (* install_DeviceCMYK)(client_custom_color_params_t * pparams,
1992 gs_color_space * pcs, gs_state * pgs);
1993 int (* remap_DeviceCMYK)(client_custom_color_params_t * pparams,
1994 const frac * pconc, const gs_color_space * pcs,
1995 gx_device_color * pdc, const gs_imager_state * pis,
1996 gx_device * dev, gs_color_select_t select);
1997 bool (* install_Separation)(client_custom_color_params_t * pparams,
1998 gs_color_space * pcs, gs_state * pgs);
1999 int (* remap_Separation)(client_custom_color_params_t * pparams,
2000 const frac * pconc, const gs_color_space * pcs,
2001 gx_device_color * pdc, const gs_imager_state * pis,
2002 gx_device * dev, gs_color_select_t select);
2003 bool (* install_DeviceN)(client_custom_color_params_t * pparams,
2004 gs_color_space * pcs, gs_state * pgs);
2005 int (* remap_DeviceN)(client_custom_color_params_t * pparams,
2006 const frac * pconc, const gs_color_space * pcs,
2007 gx_device_color * pdc, const gs_imager_state * pis,
2008 gx_device * dev, gs_color_select_t select);
2009 bool (* install_CIEBasedA)(client_custom_color_params_t * pparams,
2010 gs_color_space * pcs, gs_state * pgs);
2011 int (* remap_CIEBasedA)(client_custom_color_params_t * pparams,
2012 const gs_client_color * pc, const gs_color_space * pcs,
2013 gx_device_color * pdc, const gs_imager_state * pis,
2014 gx_device * dev, gs_color_select_t select);
2015 bool (* install_CIEBasedABC)(client_custom_color_params_t * pparams,
2016 gs_color_space * pcs, gs_state * pgs);
2017 int (* remap_CIEBasedABC)(client_custom_color_params_t * pparams,
2018 const gs_client_color * pc, const gs_color_space * pcs,
2019 gx_device_color * pdc, const gs_imager_state * pis,
2020 gx_device * dev, gs_color_select_t select);
2021 bool (* install_CIEBasedDEF)(client_custom_color_params_t * pparams,
2022 gs_color_space * pcs, gs_state * pgs);
2023 int (* remap_CIEBasedDEF)(client_custom_color_params_t * pparams,
2024 const gs_client_color * pc, const gs_color_space * pcs,
2025 gx_device_color * pdc, const gs_imager_state * pis,
2026 gx_device * dev, gs_color_select_t select);
2027 bool (* install_CIEBasedDEFG)(client_custom_color_params_t * pparams,
2028 gs_color_space * pcs, gs_state * pgs);
2029 int (* remap_CIEBasedDEFG)(client_custom_color_params_t * pparams,
2030 const gs_client_color * pc, const gs_color_space * pcs,
2031 gx_device_color * pdc, const gs_imager_state * pis,
2032 gx_device * dev, gs_color_select_t select);
2033 bool (* install_ICCBased)(client_custom_color_params_t * pparams,
2034 gs_color_space * pcs, gs_state * pgs);
2035 int (* remap_ICCBased)(client_custom_color_params_t * pparams,
2036 const gs_client_color * pc, const gs_color_space * pcs,
2037 gx_device_color * pdc, const gs_imager_state * pis,
2038 gx_device * dev, gs_color_select_t select);
2039 } client_custom_color_procs_t;
2040 typedef struct gx_fill_params_s gx_fill_params;
2041 typedef struct gx_stroke_params_s gx_stroke_params;
2042 typedef struct patch_fill_state_s patch_fill_state_t;
2043 typedef struct gx_image_enum_common_s gx_image_enum_common_t;
2044 typedef struct gs_pattern1_instance_s gs_pattern1_instance_t;
2045 typedef gx_device_color gx_drawing_color;
2046 typedef enum {
2047 go_text,
2048 go_graphics
2049 } graphics_object_type;
2050 typedef struct gs_fixed_edge_s {
2051 gs_fixed_point start;
2052 gs_fixed_point end;
2053 } gs_fixed_edge;
2054 typedef struct gs_get_bits_params_s gs_get_bits_params_t;
2055 typedef struct gx_device_anti_alias_info_s {
2056 int text_bits;
2057 int graphics_bits;
2058 } gx_device_anti_alias_info;
2059 typedef int32_t frac31;
2060 typedef struct gs_linear_color_edge_s {
2061 gs_fixed_point start;
2062 gs_fixed_point end;
2063 const frac31 *c0, *c1;
2064 fixed clip_x;
2065 } gs_linear_color_edge;
2066 typedef enum {
2067 GX_CINFO_UNKNOWN_SEP_LIN = -1,
2068 GX_CINFO_SEP_LIN_NONE = 0,
2069 GX_CINFO_SEP_LIN
2070 } gx_color_enc_sep_lin_t;
2071 typedef enum {
2072 GX_CINFO_POLARITY_UNKNOWN = -1,
2073 GX_CINFO_POLARITY_SUBTRACTIVE = 0,
2074 GX_CINFO_POLARITY_ADDITIVE
2075 } gx_color_polarity_t;
2076 typedef enum {
2077 GX_CINFO_OPMODE_UNKNOWN = -1,
2078 GX_CINFO_OPMODE_NOT = 0,
2079 GX_CINFO_OPMODE
2080 } gx_cm_opmode_t;
2081 typedef struct gx_device_color_info_s {
2082 int max_components;
2083 int num_components;
2084 gx_color_polarity_t polarity;
2085 unsigned char depth;
2086 unsigned char gray_index;
2087 unsigned int max_gray;
2088 unsigned int max_color;
2089 unsigned int dither_grays;
2090 unsigned int dither_colors;
2091 gx_device_anti_alias_info anti_alias;
2092 gx_color_enc_sep_lin_t separable_and_linear;
2093 unsigned char comp_shift[(8 * 8)];
2094 unsigned char comp_bits[(8 * 8)];
2095 gx_color_index comp_mask[(8 * 8)];
2096 const char * cm_name;
2097 gx_cm_opmode_t opmode;
2098 gx_color_index process_comps;
2099 int black_component;
2100 } gx_device_color_info;
2101 typedef struct gx_device_procs_s gx_device_procs;
2102 typedef struct gx_page_device_procs_s {
2103 int (*install)(gx_device *dev, gs_state *pgs);
2104 int (*begin_page)(gx_device *dev, gs_state *pgs);
2105 int (*end_page)(gx_device *dev, int reason, gs_state *pgs);
2106 } gx_page_device_procs;
2107 int gx_default_install(gx_device *dev, gs_state *pgs);
2108 int gx_default_begin_page(gx_device *dev, gs_state *pgs);
2109 int gx_default_end_page(gx_device *dev, int reason, gs_state *pgs);
2110 typedef struct gx_stroked_gradient_recognizer_s {
2111 bool stroke_stored;
2112 gs_fixed_point orig[4], adjusted[4];
2113 } gx_stroked_gradient_recognizer_t;
2114 typedef struct gx_device_cached_colors_s {
2115 gx_color_index black, white;
2116 } gx_device_cached_colors_t;
2117 typedef enum {
2118 pattern_manage__can_accum,
2119 pattern_manage__start_accum,
2120 pattern_manage__finish_accum,
2121 pattern_manage__load,
2122 pattern_manage__shading_area,
2123 pattern_manage__is_cpath_accum,
2124 pattern_manage__shfill_doesnt_need_path,
2125 pattern_manage__handles_clip_path
2126 } pattern_manage_t;
2127 typedef struct gs_fill_attributes_s {
2128 const gs_fixed_rect *clip;
2129 bool swap_axes;
2130 const gx_device_halftone *ht;
2131 gs_logical_operation_t lop;
2132 fixed ystart, yend;
2133 patch_fill_state_t *pfs;
2134 } gs_fill_attributes;
2135 typedef struct gs_devn_params_s gs_devn_params;
2136 typedef struct gx_image_plane_s {
2137 const unsigned char *data;
2138 int data_x;
2139 unsigned int raster;
2140 } gx_image_plane_t;
2141 int gx_image_data(gx_image_enum_common_t *info, const unsigned char **planes,
2142 int data_x, unsigned int raster, int height);
2143 int gx_image_plane_data(gx_image_enum_common_t *info,
2144 const gx_image_plane_t *planes, int height);
2145 int gx_image_plane_data_rows(gx_image_enum_common_t *info,
2146 const gx_image_plane_t *planes, int height,
2147 int *rows_used);
2148 int gx_image_flush(gx_image_enum_common_t *info);
2149 bool gx_image_planes_wanted(const gx_image_enum_common_t *info, unsigned char *wanted);
2150 int gx_image_end(gx_image_enum_common_t *info, bool draw_last);
2151 struct gx_device_procs_s { int (*open_device)(gx_device *dev); void (*get_initial_matrix)(gx_device *dev, gs_matrix *pmat); int (*sync_output)(gx_device *dev); int (*output_page)(gx_device *dev, int num_copies, int flush); int (*close_device)(gx_device *dev); gx_color_index (*map_rgb_color)(gx_device *dev, const gx_color_value cv[]); int (*map_color_rgb)(gx_device *dev, gx_color_index color, gx_color_value rgb[3]); int (*fill_rectangle)(gx_device *dev, int x, int y, int width, int height, gx_color_index color); int (*tile_rectangle)(gx_device *dev, const gx_tile_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y); int (*copy_mono)(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1); int (*copy_color)(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height); int (*obsolete_draw_line)(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color); int (*get_bits)(gx_device *dev, int y, unsigned char *data, unsigned char **actual_data); int (*get_params)(gx_device *dev, gs_param_list *plist); int (*put_params)(gx_device *dev, gs_param_list *plist); gx_color_index (*map_cmyk_color)(gx_device *dev, const gx_color_value cv[]); const gx_xfont_procs *(*get_xfont_procs)(gx_device *dev); gx_device *(*get_xfont_device)(gx_device *dev); gx_color_index (*map_rgb_alpha_color)(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue, gx_color_value alpha); gx_device *(*get_page_device)(gx_device *dev); int (*get_alpha_bits)(gx_device *dev, graphics_object_type type); int (*copy_alpha)(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color, int depth); int (*get_band)(gx_device *dev, int y, int *band_start); int (*copy_rop)(gx_device *dev, const unsigned char *sdata, int sourcex, unsigned int sraster, gx_bitmap_id id, const gx_color_index *scolors, const gx_tile_bitmap *texture, const gx_color_index *tcolors, int x, int y, int width, int height, int phase_x, int phase_y, gs_logical_operation_t lop); int (*fill_path)(gx_device *dev, const gs_imager_state *pis, gx_path *ppath, const gx_fill_params *params, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath); int (*stroke_path)(gx_device *dev, const gs_imager_state *pis, gx_path *ppath, const gx_stroke_params *params, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath); int (*fill_mask)(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, const gx_drawing_color *pdcolor, int depth, gs_logical_operation_t lop, const gx_clip_path *pcpath); int (*fill_trapezoid)(gx_device *dev, const gs_fixed_edge *left, const gs_fixed_edge *right, fixed ybot, fixed ytop, bool swap_axes, const gx_drawing_color *pdcolor, gs_logical_operation_t lop); int (*fill_parallelogram)(gx_device *dev, fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by, const gx_drawing_color *pdcolor, gs_logical_operation_t lop); int (*fill_triangle)(gx_device *dev, fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by, const gx_drawing_color *pdcolor, gs_logical_operation_t lop); int (*draw_thin_line)(gx_device *dev, fixed fx0, fixed fy0, fixed fx1, fixed fy1, const gx_drawing_color *pdcolor, gs_logical_operation_t lop); int (*begin_image)(gx_device *dev, const gs_imager_state *pis, const gs_image_t *pim, gs_image_format_t format, const gs_int_rect *prect, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath, gs_memory_t *memory, gx_image_enum_common_t **pinfo); int (*image_data)(gx_device *dev, gx_image_enum_common_t *info, const unsigned char **planes, int data_x, unsigned int raster, int height); int (*end_image)(gx_device *dev, gx_image_enum_common_t *info, bool draw_last); int (*strip_tile_rectangle)(gx_device *dev, const gx_strip_bitmap *tiles, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y); int (*strip_copy_rop)(gx_device *dev, const unsigned char *sdata, int sourcex, unsigned int sraster, gx_bitmap_id id, const gx_color_index *scolors, const gx_strip_bitmap *textures, const gx_color_index *tcolors, int x, int y, int width, int height, int phase_x, int phase_y, gs_logical_operation_t lop); void (*get_clipping_box)(gx_device *dev, gs_fixed_rect *pbox); int (*begin_typed_image)(gx_device *dev, const gs_imager_state *pis, const gs_matrix *pmat, const gs_image_common_t *pim, const gs_int_rect *prect, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath, gs_memory_t *memory, gx_image_enum_common_t **pinfo); int (*get_bits_rectangle)(gx_device *dev, const gs_int_rect *prect, gs_get_bits_params_t *params, gs_int_rect **unread); int (*map_color_rgb_alpha)(gx_device *dev, gx_color_index color, gx_color_value rgba[4]); int (*create_compositor)(gx_device *dev, gx_device **pcdev, const gs_composite_t *pcte, gs_imager_state *pis, gs_memory_t *memory); int (*get_hardware_params)(gx_device *dev, gs_param_list *plist); int (*text_begin)(gx_device *dev, gs_imager_state *pis, const gs_text_params_t *text, gs_font *font, gx_path *path, const gx_device_color *pdcolor, const gx_clip_path *pcpath, gs_memory_t *memory, gs_text_enum_t **ppte); int (*finish_copydevice)(gx_device *dev, const gx_device *from_dev); int (*begin_transparency_group)(gx_device *dev, const gs_transparency_group_params_t *ptgp, const gs_rect *pbbox, gs_imager_state *pis, gs_transparency_state_t **ppts, gs_memory_t *mem); int (*end_transparency_group)(gx_device *dev, gs_imager_state *pis, gs_transparency_state_t **ppts); int (*begin_transparency_mask)(gx_device *dev, const gx_transparency_mask_params_t *ptmp, const gs_rect *pbbox, gs_imager_state *pis, gs_transparency_state_t **ppts, gs_memory_t *mem); int (*end_transparency_mask)(gx_device *dev, gs_transparency_mask_t **pptm); int (*discard_transparency_layer)(gx_device *dev, gs_transparency_state_t **ppts); const gx_cm_color_map_procs * ((*get_color_mapping_procs))(const gx_device * dev); int ((*get_color_comp_index))(gx_device * dev, const char * pname, int name_size, int component_type); gx_color_index ((*encode_color))(gx_device * dev, const gx_color_value colors[]); int ((*decode_color))(gx_device * dev, gx_color_index cindex, gx_color_value colors[]); int (*pattern_manage)(gx_device *pdev, gx_bitmap_id id, gs_pattern1_instance_t *pinst, pattern_manage_t function); int (*fill_rectangle_hl_color)(gx_device *dev, const gs_fixed_rect *rect, const gs_imager_state *pis, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath); int (*include_color_space)(gx_device *dev, gs_color_space *cspace, const unsigned char *res_name, int name_length); int (*fill_linear_color_scanline)(gx_device *dev, const gs_fill_attributes *fa, int i, int j, int w, const frac31 *c0, const int32_t *c0_f, const int32_t *cg_num, int32_t cg_den ); int (*fill_linear_color_trapezoid)(gx_device *dev, const gs_fill_attributes *fa, const gs_fixed_point *p0, const gs_fixed_point *p1, const gs_fixed_point *p2, const gs_fixed_point *p3, const frac31 *c0, const frac31 *c1, const frac31 *c2, const frac31 *c3); int (*fill_linear_color_triangle)(gx_device *dev, const gs_fill_attributes *fa, const gs_fixed_point *p0, const gs_fixed_point *p1, const gs_fixed_point *p2, const frac31 *c0, const frac31 *c1, const frac31 *c2); int (*update_spot_equivalent_colors)(gx_device *dev, const gs_state * pgs); gs_devn_params * (*ret_devn_params)(gx_device *dev); };
2152 int gx_copy_mono_unaligned(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1);
2153 int gx_copy_color_unaligned(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height);
2154 int gx_copy_alpha_unaligned(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color, int depth);
2155 struct gx_device_s {
2156 int params_size; const gx_device_procs *static_procs; const char *dname; gs_memory_t *memory; gs_memory_type_ptr_t stype; bool stype_is_dynamic; void (*finalize)(gx_device *); rc_header rc; bool retained; bool is_open; int max_fill_band; gx_device_color_info color_info; gx_device_cached_colors_t cached_colors; int width; int height; int LeadingEdge; float MediaSize[2]; float ImagingBBox[4]; bool ImagingBBox_set; float HWResolution[2]; float MarginsHWResolution[2]; float Margins[2]; float HWMargins[4]; long PageCount; long ShowpageCount; int NumCopies; bool NumCopies_set; bool IgnoreNumCopies; bool UseCIEColor; bool LockSafetyParams; long band_offset_x; long band_offset_y; gx_stroked_gradient_recognizer_t sgr; gx_page_device_procs page_procs; gx_device_procs procs;
2157 };
2158 extern const gs_memory_struct_type_t st_device;
2159 void gx_device_finalize(void *ptr);
2160 gx_device *gx_device_enum_ptr(gx_device *);
2161 gx_device *gx_device_reloc_ptr(gx_device *, gc_state_t *);
2162 typedef gx_color_index (*dev_proc_map_rgb_color_t)(gx_device *dev, const gx_color_value cv[]);
2163 typedef int (*dev_proc_map_color_rgb_t)(gx_device *dev, gx_color_index color, gx_color_value rgb[3]);
2164 typedef struct gx_device_forward_s {
2165 int params_size; const gx_device_procs *static_procs; const char *dname; gs_memory_t *memory; gs_memory_type_ptr_t stype; bool stype_is_dynamic; void (*finalize)(gx_device *); rc_header rc; bool retained; bool is_open; int max_fill_band; gx_device_color_info color_info; gx_device_cached_colors_t cached_colors; int width; int height; int LeadingEdge; float MediaSize[2]; float ImagingBBox[4]; bool ImagingBBox_set; float HWResolution[2]; float MarginsHWResolution[2]; float Margins[2]; float HWMargins[4]; long PageCount; long ShowpageCount; int NumCopies; bool NumCopies_set; bool IgnoreNumCopies; bool UseCIEColor; bool LockSafetyParams; long band_offset_x; long band_offset_y; gx_stroked_gradient_recognizer_t sgr; gx_page_device_procs page_procs; gx_device_procs procs; gx_device *target;
2166 } gx_device_forward;
2167 extern const gs_memory_struct_type_t st_device_forward;
2168 typedef struct gx_device_null_s gx_device_null;
2169 struct gx_device_null_s {
2170 int params_size; const gx_device_procs *static_procs; const char *dname; gs_memory_t *memory; gs_memory_type_ptr_t stype; bool stype_is_dynamic; void (*finalize)(gx_device *); rc_header rc; bool retained; bool is_open; int max_fill_band; gx_device_color_info color_info; gx_device_cached_colors_t cached_colors; int width; int height; int LeadingEdge; float MediaSize[2]; float ImagingBBox[4]; bool ImagingBBox_set; float HWResolution[2]; float MarginsHWResolution[2]; float Margins[2]; float HWMargins[4]; long PageCount; long ShowpageCount; int NumCopies; bool NumCopies_set; bool IgnoreNumCopies; bool UseCIEColor; bool LockSafetyParams; long band_offset_x; long band_offset_y; gx_stroked_gradient_recognizer_t sgr; gx_page_device_procs page_procs; gx_device_procs procs; gx_device *target;
2171 };
2172 extern const gx_device_null gs_null_device;
2173 extern const gs_memory_struct_type_t st_device_null;
2174 void gx_device_init(gx_device * dev, const gx_device * proto,
2175 gs_memory_t * mem, bool internal);
2176 void gs_make_null_device(gx_device_null *dev_null, gx_device *target,
2177 gs_memory_t *mem);
2178 bool gs_is_null_device(gx_device *dev);
2179 void gx_device_set_target(gx_device_forward *fdev, gx_device *target);
2180 void gx_device_retain(gx_device *dev, bool retained);
2181 unsigned int gx_device_raster(const gx_device * dev, bool pad_to_word);
2182 int gx_device_adjust_resolution(gx_device * dev, int actual_width, int actual_height, int fit);
2183 void gx_device_set_margins(gx_device * dev, const float *margins ,
2184 bool move_origin);
2185 void gx_device_set_width_height(gx_device * dev, int width, int height);
2186 void gx_device_set_resolution(gx_device * dev, floatp x_dpi, floatp y_dpi);
2187 void gx_device_set_media_size(gx_device * dev, floatp media_width, floatp media_height);
2188 void gx_set_device_only(gs_state *, gx_device *);
2189 int gs_closedevice(gx_device *);
2190 void gx_device_free_local(gx_device *);
2191 typedef struct gx_device_type_s {
2192 gs_memory_type_ptr_t stype;
2193 int (*initialize)(gx_device *);
2194 } gx_device_type;
2195 typedef struct gx_io_device_s gx_io_device;
2196 typedef struct gs_parsed_file_name_s {
2197 gs_memory_t *memory;
2198 gx_io_device *iodev;
2199 const char *fname;
2200 unsigned int len;
2201 } gs_parsed_file_name_t;
2202 int gs_parse_file_name(gs_parsed_file_name_t *, const char *, unsigned int);
2203 int gs_parse_real_file_name(gs_parsed_file_name_t *, const char *, unsigned int,
2204 gs_memory_t *, client_name_t);
2205 int gs_terminate_file_name(gs_parsed_file_name_t *, gs_memory_t *,
2206 client_name_t);
2207 void gs_free_file_name(gs_parsed_file_name_t *, client_name_t);
2208 typedef const char *gs_param_name;
2209 typedef enum {
2210 gs_param_type_null, gs_param_type_bool, gs_param_type_int,
2211 gs_param_type_long, gs_param_type_float,
2212 gs_param_type_string, gs_param_type_name,
2213 gs_param_type_int_array, gs_param_type_float_array,
2214 gs_param_type_string_array, gs_param_type_name_array,
2215 gs_param_type_dict, gs_param_type_dict_int_keys, gs_param_type_array
2216 } gs_param_type;
2217 typedef struct gs_param_int_array_s { const int *data; unsigned int size; bool persistent; } gs_param_int_array;
2218 typedef struct gs_param_float_array_s { const float *data; unsigned int size; bool persistent; } gs_param_float_array;
2219 typedef struct gs_param_string_array_s { const gs_param_string *data; unsigned int size; bool persistent; } gs_param_string_array;
2220 typedef struct gs_param_collection_s {
2221 gs_param_list *list;
2222 unsigned int size;
2223 } gs_param_collection;
2224 typedef gs_param_collection gs_param_dict;
2225 typedef gs_param_collection gs_param_array;
2226 extern const unsigned char gs_param_type_sizes[];
2227 extern const unsigned char gs_param_type_base_sizes[];
2228 typedef union gs_param_value_s {
2229 bool b; int i; long l; float f; gs_param_string s; gs_param_string n; gs_param_int_array ia; gs_param_float_array fa; gs_param_string_array sa; gs_param_string_array na; gs_param_collection d;
2230 } gs_param_value;
2231 typedef struct gs_param_typed_value_s {
2232 gs_param_value value;
2233 gs_param_type type;
2234 } gs_param_typed_value;
2235 gs_ptr_type_t gs_param_typed_value_enum_ptrs(const gs_memory_t *mem, const void *ptr, unsigned int size, int index, enum_ptr_t *pep, const gs_memory_struct_type_t *pstype, gc_state_t *gcst);
2236 void gs_param_typed_value_reloc_ptrs(void *ptr, unsigned int size, const gs_memory_struct_type_t *pstype, gc_state_t *gcst);
2237 typedef enum {
2238 gs_param_collection_dict_any = 0,
2239 gs_param_collection_dict_int_keys = 1,
2240 gs_param_collection_array = 2
2241 } gs_param_collection_type_t;
2242 typedef union gs_param_enumerator_s {
2243 int intval;
2244 long longval;
2245 void *pvoid;
2246 char *pchar;
2247 } gs_param_enumerator_t;
2248 typedef gs_param_string gs_param_key_t;
2249 typedef struct gs_param_list_procs_s {
2250 int (*xmit_typed)(gs_param_list *, gs_param_name, gs_param_typed_value *);
2251 int (*begin_xmit_collection)(gs_param_list *, gs_param_name, gs_param_dict *, gs_param_collection_type_t);
2252 int (*end_xmit_collection)(gs_param_list *, gs_param_name, gs_param_dict *);
2253 int (*next_key)(gs_param_list *, gs_param_enumerator_t *, gs_param_key_t *);
2254 int (*request)(gs_param_list *, gs_param_name);
2255 int (*requested)(const gs_param_list *, gs_param_name);
2256 int (*get_policy)(gs_param_list *, gs_param_name);
2257 int (*signal_error)(gs_param_list *, gs_param_name, int);
2258 int (*commit)(gs_param_list *);
2259 } gs_param_list_procs;
2260 int param_read_requested_typed(gs_param_list *, gs_param_name,
2261 gs_param_typed_value *);
2262 int param_read_null(gs_param_list *, gs_param_name);
2263 int param_write_null(gs_param_list *, gs_param_name);
2264 int param_read_bool(gs_param_list *, gs_param_name, bool *);
2265 int param_write_bool(gs_param_list *, gs_param_name, const bool *);
2266 int param_read_int(gs_param_list *, gs_param_name, int *);
2267 int param_write_int(gs_param_list *, gs_param_name, const int *);
2268 int param_read_long(gs_param_list *, gs_param_name, long *);
2269 int param_write_long(gs_param_list *, gs_param_name, const long *);
2270 int param_read_float(gs_param_list *, gs_param_name, float *);
2271 int param_write_float(gs_param_list *, gs_param_name, const float *);
2272 int param_read_string(gs_param_list *, gs_param_name, gs_param_string *);
2273 int param_write_string(gs_param_list *, gs_param_name,
2274 const gs_param_string *);
2275 int param_read_name(gs_param_list *, gs_param_name, gs_param_string *);
2276 int param_write_name(gs_param_list *, gs_param_name,
2277 const gs_param_string *);
2278 int param_read_int_array(gs_param_list *, gs_param_name,
2279 gs_param_int_array *);
2280 int param_write_int_array(gs_param_list *, gs_param_name,
2281 const gs_param_int_array *);
2282 int param_write_int_values(gs_param_list *, gs_param_name,
2283 const int *, unsigned int, bool);
2284 int param_read_float_array(gs_param_list *, gs_param_name,
2285 gs_param_float_array *);
2286 int param_write_float_array(gs_param_list *, gs_param_name,
2287 const gs_param_float_array *);
2288 int param_write_float_values(gs_param_list *, gs_param_name,
2289 const float *, unsigned int, bool);
2290 int param_read_string_array(gs_param_list *, gs_param_name,
2291 gs_param_string_array *);
2292 int param_write_string_array(gs_param_list *, gs_param_name,
2293 const gs_param_string_array *);
2294 int param_read_name_array(gs_param_list *, gs_param_name,
2295 gs_param_string_array *);
2296 int param_write_name_array(gs_param_list *, gs_param_name,
2297 const gs_param_string_array *);
2298 struct gs_param_list_s {
2299 const gs_param_list_procs *procs; gs_memory_t *memory; bool persistent_keys;
2300 };
2301 void gs_param_list_set_persist_keys(gs_param_list *, bool);
2302 void param_init_enumerator(gs_param_enumerator_t * penum);
2303 typedef struct gs_param_item_s {
2304 const char *key;
2305 unsigned char type;
2306 short offset;
2307 } gs_param_item_t;
2308 int gs_param_read_items(gs_param_list * plist, void *obj,
2309 const gs_param_item_t * items);
2310 int gs_param_write_items(gs_param_list * plist, const void *obj,
2311 const void *default_obj,
2312 const gs_param_item_t * items);
2313 void gs_param_list_init(gs_param_list *, const gs_param_list_procs *,
2314 gs_memory_t *);
2315 int param_coerce_typed(gs_param_typed_value * pvalue,
2316 gs_param_type req_type, gs_memory_t * mem);
2317 int gs_param_request_default(gs_param_list *, gs_param_name);
2318 int gs_param_requested_default(const gs_param_list *, gs_param_name);
2319 typedef struct gs_c_param_s gs_c_param;
2320 typedef struct gs_c_param_list_s {
2321 const gs_param_list_procs *procs; gs_memory_t *memory; bool persistent_keys;
2322 gs_c_param *head;
2323 gs_param_list *target;
2324 unsigned int count;
2325 bool any_requested;
2326 gs_param_collection_type_t coll_type;
2327 } gs_c_param_list;
2328 void gs_c_param_list_set_target(gs_c_param_list *, gs_param_list *);
2329 gs_c_param_list *gs_c_param_list_alloc(gs_memory_t *, client_name_t);
2330 void gs_c_param_list_write(gs_c_param_list *, gs_memory_t *);
2331 void gs_c_param_list_write_more(gs_c_param_list *);
2332 void gs_c_param_list_read(gs_c_param_list *);
2333 void gs_c_param_list_release(gs_c_param_list *);
2334 typedef struct {
2335 void *dummy_;
2336 } gp_semaphore;
2337 unsigned int gp_semaphore_sizeof(void);
2338 int gp_semaphore_open(gp_semaphore * sema);
2339 int gp_semaphore_close(gp_semaphore * sema);
2340 int gp_semaphore_wait(gp_semaphore * sema);
2341 int gp_semaphore_signal(gp_semaphore * sema);
2342 typedef struct {
2343 void *dummy_;
2344 } gp_monitor;
2345 unsigned int gp_monitor_sizeof(void);
2346 int gp_monitor_open(gp_monitor * mon);
2347 int gp_monitor_close(gp_monitor * mon);
2348 int gp_monitor_enter(gp_monitor * mon);
2349 int gp_monitor_leave(gp_monitor * mon);
2350 typedef void (*gp_thread_creation_callback_t) (void *);
2351 int gp_create_thread(gp_thread_creation_callback_t, void *);
2352 typedef struct gx_semaphore_s {
2353 gs_memory_t *memory;
2354 gp_semaphore native;
2355 } gx_semaphore_t;
2356 gx_semaphore_t *
2357 gx_semaphore_alloc(
2358 gs_memory_t * memory
2359 );
2360 void
2361 gx_semaphore_free(
2362 gx_semaphore_t * sema
2363 );
2364 typedef struct gx_monitor_s {
2365 gs_memory_t *memory;
2366 gp_monitor native;
2367 } gx_monitor_t;
2368 gx_monitor_t *
2369 gx_monitor_alloc(
2370 gs_memory_t * memory
2371 );
2372 void
2373 gx_monitor_free(
2374 gx_monitor_t * mon
2375 );
2376 typedef struct gs_malloc_block_s gs_malloc_block_t;
2377 typedef struct gs_malloc_memory_s {
2378 gs_memory_t *stable_memory; gs_memory_procs_t procs; gs_lib_ctx_t *gs_lib_ctx; pl_mem_node_t *head; gs_memory_t *non_gc_memory;
2379 gs_malloc_block_t *allocated;
2380 long limit;
2381 long used;
2382 long max_used;
2383 gx_monitor_t *monitor;
2384 } gs_malloc_memory_t;
2385 gs_malloc_memory_t *gs_malloc_memory_init(void);
2386 gs_memory_t * gs_malloc_init(const gs_memory_t *parent);
2387 void gs_malloc_release(gs_memory_t *mem);
2388 int gs_malloc_wrap(gs_memory_t **wrapped, gs_malloc_memory_t *contents);
2389 gs_malloc_memory_t *gs_malloc_wrapped_contents(gs_memory_t *wrapped);
2390 gs_malloc_memory_t *gs_malloc_unwrap(gs_memory_t *wrapped);
2391 int gx_default_open_device(gx_device *dev);
2392 void gx_default_get_initial_matrix(gx_device *dev, gs_matrix *pmat);
2393 void gx_upright_get_initial_matrix(gx_device *dev, gs_matrix *pmat);
2394 int gx_default_sync_output(gx_device *dev);
2395 int gx_default_output_page(gx_device *dev, int num_copies, int flush);
2396 int gx_default_close_device(gx_device *dev);
2397 gx_color_index gx_default_w_b_map_rgb_color(gx_device *dev, const gx_color_value cv[]);
2398 int gx_default_w_b_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]);
2399 int gx_default_tile_rectangle(gx_device *dev, const gx_tile_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y);
2400 int gx_default_copy_mono(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1);
2401 int gx_default_copy_color(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height);
2402 int gx_default_draw_line(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color);
2403 int gx_no_get_bits(gx_device *dev, int y, unsigned char *data, unsigned char **actual_data);
2404 int gx_default_get_bits(gx_device *dev, int y, unsigned char *data, unsigned char **actual_data);
2405 int gx_default_get_params(gx_device *dev, gs_param_list *plist);
2406 int gx_default_put_params(gx_device *dev, gs_param_list *plist);
2407 gx_color_index gx_default_map_cmyk_color(gx_device *dev, const gx_color_value cv[]);
2408 const gx_xfont_procs *gx_default_get_xfont_procs(gx_device *dev);
2409 gx_device *gx_default_get_xfont_device(gx_device *dev);
2410 gx_color_index gx_default_map_rgb_alpha_color(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue, gx_color_value alpha);
2411 gx_device *gx_default_get_page_device(gx_device *dev);
2412 gx_device *gx_page_device_get_page_device(gx_device *dev);
2413 int gx_default_get_alpha_bits(gx_device *dev, graphics_object_type type);
2414 int gx_no_copy_alpha(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color, int depth);
2415 int gx_default_copy_alpha(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color, int depth);
2416 int gx_default_get_band(gx_device *dev, int y, int *band_start);
2417 int gx_no_copy_rop(gx_device *dev, const unsigned char *sdata, int sourcex, unsigned int sraster, gx_bitmap_id id, const gx_color_index *scolors, const gx_tile_bitmap *texture, const gx_color_index *tcolors, int x, int y, int width, int height, int phase_x, int phase_y, gs_logical_operation_t lop);
2418 int gx_default_copy_rop(gx_device *dev, const unsigned char *sdata, int sourcex, unsigned int sraster, gx_bitmap_id id, const gx_color_index *scolors, const gx_tile_bitmap *texture, const gx_color_index *tcolors, int x, int y, int width, int height, int phase_x, int phase_y, gs_logical_operation_t lop);
2419 int gx_default_fill_path(gx_device *dev, const gs_imager_state *pis, gx_path *ppath, const gx_fill_params *params, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath);
2420 int gx_default_stroke_path(gx_device *dev, const gs_imager_state *pis, gx_path *ppath, const gx_stroke_params *params, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath);
2421 int gx_default_fill_mask(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, const gx_drawing_color *pdcolor, int depth, gs_logical_operation_t lop, const gx_clip_path *pcpath);
2422 int gx_default_fill_trapezoid(gx_device *dev, const gs_fixed_edge *left, const gs_fixed_edge *right, fixed ybot, fixed ytop, bool swap_axes, const gx_drawing_color *pdcolor, gs_logical_operation_t lop);
2423 int gx_default_fill_parallelogram(gx_device *dev, fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by, const gx_drawing_color *pdcolor, gs_logical_operation_t lop);
2424 int gx_default_fill_triangle(gx_device *dev, fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by, const gx_drawing_color *pdcolor, gs_logical_operation_t lop);
2425 int gx_default_draw_thin_line(gx_device *dev, fixed fx0, fixed fy0, fixed fx1, fixed fy1, const gx_drawing_color *pdcolor, gs_logical_operation_t lop);
2426 int gx_default_begin_image(gx_device *dev, const gs_imager_state *pis, const gs_image_t *pim, gs_image_format_t format, const gs_int_rect *prect, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath, gs_memory_t *memory, gx_image_enum_common_t **pinfo);
2427 int gx_default_image_data(gx_device *dev, gx_image_enum_common_t *info, const unsigned char **planes, int data_x, unsigned int raster, int height);
2428 int gx_default_end_image(gx_device *dev, gx_image_enum_common_t *info, bool draw_last);
2429 int gx_default_strip_tile_rectangle(gx_device *dev, const gx_strip_bitmap *tiles, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y);
2430 int gx_no_strip_copy_rop(gx_device *dev, const unsigned char *sdata, int sourcex, unsigned int sraster, gx_bitmap_id id, const gx_color_index *scolors, const gx_strip_bitmap *textures, const gx_color_index *tcolors, int x, int y, int width, int height, int phase_x, int phase_y, gs_logical_operation_t lop);
2431 int gx_default_strip_copy_rop(gx_device *dev, const unsigned char *sdata, int sourcex, unsigned int sraster, gx_bitmap_id id, const gx_color_index *scolors, const gx_strip_bitmap *textures, const gx_color_index *tcolors, int x, int y, int width, int height, int phase_x, int phase_y, gs_logical_operation_t lop);
2432 void gx_default_get_clipping_box(gx_device *dev, gs_fixed_rect *pbox);
2433 void gx_get_largest_clipping_box(gx_device *dev, gs_fixed_rect *pbox);
2434 int gx_default_begin_typed_image(gx_device *dev, const gs_imager_state *pis, const gs_matrix *pmat, const gs_image_common_t *pim, const gs_int_rect *prect, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath, gs_memory_t *memory, gx_image_enum_common_t **pinfo);
2435 int gx_no_get_bits_rectangle(gx_device *dev, const gs_int_rect *prect, gs_get_bits_params_t *params, gs_int_rect **unread);
2436 int gx_default_get_bits_rectangle(gx_device *dev, const gs_int_rect *prect, gs_get_bits_params_t *params, gs_int_rect **unread);
2437 int gx_default_map_color_rgb_alpha(gx_device *dev, gx_color_index color, gx_color_value rgba[4]);
2438 int gx_no_create_compositor(gx_device *dev, gx_device **pcdev, const gs_composite_t *pcte, gs_imager_state *pis, gs_memory_t *memory);
2439 int gx_default_create_compositor(gx_device *dev, gx_device **pcdev, const gs_composite_t *pcte, gs_imager_state *pis, gs_memory_t *memory);
2440 int gx_null_create_compositor(gx_device *dev, gx_device **pcdev, const gs_composite_t *pcte, gs_imager_state *pis, gs_memory_t *memory);
2441 int gx_default_get_hardware_params(gx_device *dev, gs_param_list *plist);
2442 int gx_default_text_begin(gx_device *dev, gs_imager_state *pis, const gs_text_params_t *text, gs_font *font, gx_path *path, const gx_device_color *pdcolor, const gx_clip_path *pcpath, gs_memory_t *memory, gs_text_enum_t **ppte);
2443 int gx_default_finish_copydevice(gx_device *dev, const gx_device *from_dev);
2444 int gx_default_pattern_manage(gx_device *pdev, gx_bitmap_id id, gs_pattern1_instance_t *pinst, pattern_manage_t function);
2445 int gx_default_fill_rectangle_hl_color(gx_device *dev, const gs_fixed_rect *rect, const gs_imager_state *pis, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath);
2446 int gx_default_include_color_space(gx_device *dev, gs_color_space *cspace, const unsigned char *res_name, int name_length);
2447 int gx_default_fill_linear_color_scanline(gx_device *dev, const gs_fill_attributes *fa, int i, int j, int w, const frac31 *c0, const int32_t *c0_f, const int32_t *cg_num, int32_t cg_den );
2448 int gx_default_fill_linear_color_trapezoid(gx_device *dev, const gs_fill_attributes *fa, const gs_fixed_point *p0, const gs_fixed_point *p1, const gs_fixed_point *p2, const gs_fixed_point *p3, const frac31 *c0, const frac31 *c1, const frac31 *c2, const frac31 *c3);
2449 int gx_default_fill_linear_color_triangle(gx_device *dev, const gs_fill_attributes *fa, const gs_fixed_point *p0, const gs_fixed_point *p1, const gs_fixed_point *p2, const frac31 *c0, const frac31 *c1, const frac31 *c2);
2450 int gx_default_update_spot_equivalent_colors(gx_device *dev, const gs_state * pgs);
2451 gs_devn_params * gx_default_ret_devn_params(gx_device *dev);
2452 gx_color_index gx_default_b_w_map_rgb_color(gx_device *dev, const gx_color_value cv[]);
2453 int gx_default_b_w_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]);
2454 gx_color_index gx_default_gray_map_rgb_color(gx_device *dev, const gx_color_value cv[]);
2455 int gx_default_gray_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]);
2456 int gx_default_rgb_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]);
2457 gx_color_index gx_default_rgb_map_rgb_color(gx_device *dev, const gx_color_value cv[]);
2458 gx_color_index cmyk_1bit_map_cmyk_color(gx_device *dev, const gx_color_value cv[]);
2459 int cmyk_1bit_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]);
2460 int (cmyk_1bit_map_color_cmyk)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]);
2461 gx_color_index cmyk_8bit_map_cmyk_color(gx_device *dev, const gx_color_value cv[]);
2462 int cmyk_8bit_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]);
2463 int (cmyk_8bit_map_color_cmyk)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]);
2464 gx_color_index (gx_default_8bit_map_gray_color)(gx_device * dev, const gx_color_value colors[]);
2465 int (gx_default_8bit_map_color_gray)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]);
2466 int gx_forward_close_device(gx_device *dev);
2467 void gx_forward_get_initial_matrix(gx_device *dev, gs_matrix *pmat);
2468 int gx_forward_sync_output(gx_device *dev);
2469 int gx_forward_output_page(gx_device *dev, int num_copies, int flush);
2470 gx_color_index gx_forward_map_rgb_color(gx_device *dev, const gx_color_value cv[]);
2471 int gx_forward_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]);
2472 int gx_forward_fill_rectangle(gx_device *dev, int x, int y, int width, int height, gx_color_index color);
2473 int gx_forward_tile_rectangle(gx_device *dev, const gx_tile_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y);
2474 int gx_forward_copy_mono(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1);
2475 int gx_forward_copy_color(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height);
2476 int gx_forward_get_bits(gx_device *dev, int y, unsigned char *data, unsigned char **actual_data);
2477 int gx_forward_get_params(gx_device *dev, gs_param_list *plist);
2478 int gx_forward_put_params(gx_device *dev, gs_param_list *plist);
2479 gx_color_index gx_forward_map_cmyk_color(gx_device *dev, const gx_color_value cv[]);
2480 const gx_xfont_procs *gx_forward_get_xfont_procs(gx_device *dev);
2481 gx_device *gx_forward_get_xfont_device(gx_device *dev);
2482 gx_color_index gx_forward_map_rgb_alpha_color(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue, gx_color_value alpha);
2483 gx_device *gx_forward_get_page_device(gx_device *dev);
2484 int gx_forward_copy_alpha(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color, int depth);
2485 int gx_forward_get_band(gx_device *dev, int y, int *band_start);
2486 int gx_forward_copy_rop(gx_device *dev, const unsigned char *sdata, int sourcex, unsigned int sraster, gx_bitmap_id id, const gx_color_index *scolors, const gx_tile_bitmap *texture, const gx_color_index *tcolors, int x, int y, int width, int height, int phase_x, int phase_y, gs_logical_operation_t lop);
2487 int gx_forward_fill_path(gx_device *dev, const gs_imager_state *pis, gx_path *ppath, const gx_fill_params *params, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath);
2488 int gx_forward_stroke_path(gx_device *dev, const gs_imager_state *pis, gx_path *ppath, const gx_stroke_params *params, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath);
2489 int gx_forward_fill_mask(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, const gx_drawing_color *pdcolor, int depth, gs_logical_operation_t lop, const gx_clip_path *pcpath);
2490 int gx_forward_fill_trapezoid(gx_device *dev, const gs_fixed_edge *left, const gs_fixed_edge *right, fixed ybot, fixed ytop, bool swap_axes, const gx_drawing_color *pdcolor, gs_logical_operation_t lop);
2491 int gx_forward_fill_parallelogram(gx_device *dev, fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by, const gx_drawing_color *pdcolor, gs_logical_operation_t lop);
2492 int gx_forward_fill_triangle(gx_device *dev, fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by, const gx_drawing_color *pdcolor, gs_logical_operation_t lop);
2493 int gx_forward_draw_thin_line(gx_device *dev, fixed fx0, fixed fy0, fixed fx1, fixed fy1, const gx_drawing_color *pdcolor, gs_logical_operation_t lop);
2494 int gx_forward_begin_image(gx_device *dev, const gs_imager_state *pis, const gs_image_t *pim, gs_image_format_t format, const gs_int_rect *prect, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath, gs_memory_t *memory, gx_image_enum_common_t **pinfo);
2495 int gx_forward_strip_tile_rectangle(gx_device *dev, const gx_strip_bitmap *tiles, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y);
2496 int gx_forward_strip_copy_rop(gx_device *dev, const unsigned char *sdata, int sourcex, unsigned int sraster, gx_bitmap_id id, const gx_color_index *scolors, const gx_strip_bitmap *textures, const gx_color_index *tcolors, int x, int y, int width, int height, int phase_x, int phase_y, gs_logical_operation_t lop);
2497 void gx_forward_get_clipping_box(gx_device *dev, gs_fixed_rect *pbox);
2498 int gx_forward_begin_typed_image(gx_device *dev, const gs_imager_state *pis, const gs_matrix *pmat, const gs_image_common_t *pim, const gs_int_rect *prect, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath, gs_memory_t *memory, gx_image_enum_common_t **pinfo);
2499 int gx_forward_get_bits_rectangle(gx_device *dev, const gs_int_rect *prect, gs_get_bits_params_t *params, gs_int_rect **unread);
2500 int gx_forward_map_color_rgb_alpha(gx_device *dev, gx_color_index color, gx_color_value rgba[4]);
2501 int gx_forward_get_hardware_params(gx_device *dev, gs_param_list *plist);
2502 int gx_forward_text_begin(gx_device *dev, gs_imager_state *pis, const gs_text_params_t *text, gs_font *font, gx_path *path, const gx_device_color *pdcolor, const gx_clip_path *pcpath, gs_memory_t *memory, gs_text_enum_t **ppte);
2503 const gx_cm_color_map_procs * (gx_forward_get_color_mapping_procs)(const gx_device * dev);
2504 int (gx_forward_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type);
2505 gx_color_index (gx_forward_encode_color)(gx_device * dev, const gx_color_value colors[]);
2506 int (gx_forward_decode_color)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]);
2507 int gx_forward_pattern_manage(gx_device *pdev, gx_bitmap_id id, gs_pattern1_instance_t *pinst, pattern_manage_t function);
2508 int gx_forward_fill_rectangle_hl_color(gx_device *dev, const gs_fixed_rect *rect, const gs_imager_state *pis, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath);
2509 int gx_forward_include_color_space(gx_device *dev, gs_color_space *cspace, const unsigned char *res_name, int name_length);
2510 int gx_forward_fill_linear_color_scanline(gx_device *dev, const gs_fill_attributes *fa, int i, int j, int w, const frac31 *c0, const int32_t *c0_f, const int32_t *cg_num, int32_t cg_den );
2511 int gx_forward_fill_linear_color_trapezoid(gx_device *dev, const gs_fill_attributes *fa, const gs_fixed_point *p0, const gs_fixed_point *p1, const gs_fixed_point *p2, const gs_fixed_point *p3, const frac31 *c0, const frac31 *c1, const frac31 *c2, const frac31 *c3);
2512 int gx_forward_fill_linear_color_triangle(gx_device *dev, const gs_fill_attributes *fa, const gs_fixed_point *p0, const gs_fixed_point *p1, const gs_fixed_point *p2, const frac31 *c0, const frac31 *c1, const frac31 *c2);
2513 int gx_forward_update_spot_equivalent_colors(gx_device *dev, const gs_state * pgs);
2514 gs_devn_params * gx_forward_ret_devn_params(gx_device *dev);
2515 void gx_device_set_procs(gx_device *);
2516 void gx_device_fill_in_procs(gx_device *);
2517 void gx_device_forward_fill_in_procs(gx_device_forward *);
2518 void gx_device_forward_color_procs(gx_device_forward *);
2519 void check_device_separable(gx_device * dev);
2520 void set_linear_color_bits_mask_shift(gx_device * dev);
2521 void gx_device_copy_color_procs(gx_device *dev, const gx_device *target);
2522 gx_color_index gx_device_black(gx_device *dev);
2523 gx_color_index gx_device_white(gx_device *dev);
2524 void gx_device_decache_colors(gx_device *dev);
2525 void gx_device_copy_color_params(gx_device *dev, const gx_device *target);
2526 void gx_device_copy_params(gx_device *dev, const gx_device *target);
2527 int gx_parse_output_file_name(gs_parsed_file_name_t *pfn,
2528 const char **pfmt, const char *fname,
2529 unsigned int len);
2530 int gx_device_open_output_file(const gx_device * dev, char *fname,
2531 bool binary, bool positionable,
2532 FILE ** pfile);
2533 int gx_device_close_output_file(const gx_device * dev, const char *fname,
2534 FILE *file);
2535 int gx_finish_output_page(gx_device *dev, int num_copies, int flush);
2536 typedef struct gdev_input_media_s {
2537 float PageSize[4];
2538 const char *MediaColor;
2539 float MediaWeight;
2540 const char *MediaType;
2541 } gdev_input_media_t;
2542 extern const gdev_input_media_t gdev_input_media_default;
2543 void gdev_input_media_init(gdev_input_media_t * pim);
2544 int gdev_begin_input_media(gs_param_list * mlist, gs_param_dict * pdict,
2545 int count);
2546 int gdev_write_input_page_size(int index, gs_param_dict * pdict,
2547 floatp width_points, floatp height_points);
2548 int gdev_write_input_media(int index, gs_param_dict * pdict,
2549 const gdev_input_media_t * pim);
2550 int gdev_end_input_media(gs_param_list * mlist, gs_param_dict * pdict);
2551 typedef struct gdev_output_media_s {
2552 const char *OutputType;
2553 } gdev_output_media_t;
2554 extern const gdev_output_media_t gdev_output_media_default;
2555 int gdev_begin_output_media(gs_param_list * mlist, gs_param_dict * pdict,
2556 int count);
2557 int gdev_write_output_media(int index, gs_param_dict * pdict,
2558 const gdev_output_media_t * pom);
2559 int gdev_end_output_media(gs_param_list * mlist, gs_param_dict * pdict);
2560 void gx_device_request_leadingedge(gx_device *dev, int le_req);
2561 typedef struct gx_render_plane_s {
2562 int depth;
2563 int shift;
2564 int index;
2565 } gx_render_plane_t;
2566 int gx_render_plane_init(gx_render_plane_t *render_plane,
2567 const gx_device *dev, int index);
2568 typedef struct gx_device_memory_s gx_device_memory;
2569 struct gx_device_memory_s {
2570 int params_size; const gx_device_procs *static_procs; const char *dname; gs_memory_t *memory; gs_memory_type_ptr_t stype; bool stype_is_dynamic; void (*finalize)(gx_device *); rc_header rc; bool retained; bool is_open; int max_fill_band; gx_device_color_info color_info; gx_device_cached_colors_t cached_colors; int width; int height; int LeadingEdge; float MediaSize[2]; float ImagingBBox[4]; bool ImagingBBox_set; float HWResolution[2]; float MarginsHWResolution[2]; float Margins[2]; float HWMargins[4]; long PageCount; long ShowpageCount; int NumCopies; bool NumCopies_set; bool IgnoreNumCopies; bool UseCIEColor; bool LockSafetyParams; long band_offset_x; long band_offset_y; gx_stroked_gradient_recognizer_t sgr; gx_page_device_procs page_procs; gx_device_procs procs; gx_device *target;
2571 unsigned int raster;
2572 unsigned char *base;
2573 gs_memory_t *bitmap_memory;
2574 bool foreign_bits;
2575 gs_memory_t *line_pointer_memory;
2576 bool foreign_line_pointers;
2577 int num_planes;
2578 gx_render_plane_t planes[(8 * 8)];
2579 gs_matrix initial_matrix;
2580 unsigned char **line_ptrs;
2581 gs_const_string palette;
2582 struct _c24 {
2583 gx_color_index rgb;
2584 bits32 rgbr, gbrg, brgb;
2585 } color24;
2586 struct _c40 {
2587 gx_color_index abcde;
2588 bits32 abcd, bcde, cdea, deab, eabc;
2589 } color40;
2590 struct _c48 {
2591 gx_color_index abcdef;
2592 bits32 abcd, cdef, efab;
2593 } color48;
2594 struct _c56 {
2595 gx_color_index abcdefg;
2596 bits32 abcd, bcde, cdef, defg, efga, fgab, gabc;
2597 } color56;
2598 struct _c64 {
2599 gx_color_index abcdefgh;
2600 bits32 abcd, efgh;
2601 } color64;
2602 gs_log2_scale_point log2_scale;
2603 int log2_alpha_bits;
2604 int mapped_x;
2605 int mapped_y;
2606 int mapped_height;
2607 int mapped_start;
2608 gx_color_index save_color;
2609 int plane_depth;
2610 int band_y;
2611 };
2612 extern const gs_memory_struct_type_t st_device_memory;
2613 int gdev_mem_bits_size(const gx_device_memory *mdev, int width,
2614 int height, unsigned long *size);
2615 unsigned long gdev_mem_line_ptrs_size(const gx_device_memory *mdev, int width,
2616 int height);
2617 int gdev_mem_data_size(const gx_device_memory *mdev, int width,
2618 int height, unsigned long *size);
2619 int gdev_mem_max_height(const gx_device_memory * dev, int width, unsigned long size,
2620 bool page_uses_transparency);
2621 const gx_device_memory *gdev_mem_device_for_bits(int);
2622 const gx_device_memory *gdev_mem_word_device_for_bits(int);
2623 void gs_make_mem_mono_device(gx_device_memory * mdev, gs_memory_t * mem,
2624 gx_device * target);
2625 void gs_make_mem_device(gx_device_memory * mdev,
2626 const gx_device_memory * mdproto,
2627 gs_memory_t * mem, int page_device,
2628 gx_device * target);
2629 void gs_make_mem_abuf_device(gx_device_memory * adev, gs_memory_t * mem,
2630 gx_device * target,
2631 const gs_log2_scale_point * pscale,
2632 int alpha_bits, int mapped_x);
2633 void gs_make_mem_alpha_device(gx_device_memory * adev, gs_memory_t * mem,
2634 gx_device * target, int alpha_bits);
2635 int gdev_mem_open_scan_lines(gx_device_memory *mdev, int setup_height);
2636 int gdev_mem_set_line_ptrs(gx_device_memory *mdev,
2637 unsigned char *base, int raster, unsigned char **line_ptrs,
2638 int setup_height);
2639 void gdev_mem_mono_set_inverted(gx_device_memory * mdev, bool black_is_1);
2640 bool gs_device_is_memory(const gx_device *);
2641 bool gs_device_is_abuf(const gx_device *);
2642 typedef void *clist_file_ptr;
2643 struct clist_io_procs_s {
2644 int (*fopen)(char fname[260], const char *fmode,
2645 clist_file_ptr * pcf,
2646 gs_memory_t * mem, gs_memory_t *data_mem,
2647 bool ok_to_compress);
2648 int (*fclose)(clist_file_ptr cf, const char *fname, bool delete);
2649 int (*unlink)(const char *fname);
2650 int (*fwrite_chars)(const void *data, unsigned int len, clist_file_ptr cf);
2651 int (*fread_chars)(void *data, unsigned int len, clist_file_ptr cf);
2652 int (*set_memory_warning)(clist_file_ptr cf, int bytes_left);
2653 int (*ferror_code)(clist_file_ptr cf);
2654 int64_t (*ftell)(clist_file_ptr cf);
2655 void (*rewind)(clist_file_ptr cf, bool discard_data, const char *fname);
2656 int (*fseek)(clist_file_ptr cf, int64_t offset, int mode, const char *fname);
2657 };
2658 typedef struct clist_io_procs_s clist_io_procs_t;
2659 extern const clist_io_procs_t *clist_io_procs_file_global;
2660 extern const clist_io_procs_t *clist_io_procs_memory_global;
2661 typedef struct gx_band_params_s {
2662 bool page_uses_transparency;
2663 int BandWidth;
2664 int BandHeight;
2665 long BandBufferSpace;
2666 } gx_band_params_t;
2667 typedef struct gx_colors_used_s {
2668 gx_color_index or;
2669 bool slow_rop;
2670 } gx_colors_used_t;
2671 typedef struct gx_band_page_info_s {
2672 char cfname[260];
2673 clist_file_ptr cfile;
2674 char bfname[260];
2675 clist_file_ptr bfile;
2676 const clist_io_procs_t *io_procs;
2677 unsigned int tile_cache_size;
2678 int64_t bfile_end_pos;
2679 gx_band_params_t band_params;
2680 int scan_lines_per_colors_used;
2681 gx_colors_used_t band_colors_used[50];
2682 } gx_band_page_info_t;
2683 typedef struct gx_cached_bits_head_s {
2684 unsigned int size;
2685 unsigned int depth;
2686 } gx_cached_bits_head;
2687 typedef struct gx_cached_bits_s {
2688 gx_cached_bits_head head; unsigned short width, height, shift; unsigned short raster; gx_bitmap_id id;
2689 } gx_cached_bits;
2690 typedef struct gx_bits_cache_chunk_s gx_bits_cache_chunk;
2691 struct gx_bits_cache_chunk_s {
2692 gx_bits_cache_chunk *next;
2693 unsigned char *data;
2694 unsigned int size;
2695 unsigned int allocated;
2696 };
2697 typedef struct gx_bits_cache_s {
2698 gx_bits_cache_chunk *chunks; unsigned int cnext; unsigned int bsize; unsigned int csize;
2699 } gx_bits_cache;
2700 void gx_bits_cache_init(gx_bits_cache *, gx_bits_cache_chunk *);
2701 void gx_bits_cache_chunk_init(gx_bits_cache_chunk *, unsigned char *, unsigned int);
2702 int gx_bits_cache_alloc(gx_bits_cache *, unsigned long, gx_cached_bits_head **);
2703 void gx_bits_cache_shorten(gx_bits_cache *, gx_cached_bits_head *,
2704 unsigned int, gx_bits_cache_chunk *);
2705 void gx_bits_cache_free(gx_bits_cache *, gx_cached_bits_head *,
2706 gx_bits_cache_chunk *);
2707 typedef struct gx_device_buf_space_s {
2708 unsigned long bits;
2709 unsigned long line_ptrs;
2710 unsigned int raster;
2711 } gx_device_buf_space_t;
2712 typedef struct gx_band_complexity_s {
2713 bool uses_color;
2714 bool nontrivial_rops;
2715 } gx_band_complexity_t;
2716 typedef struct gx_device_buf_procs_s {
2717 int (*create_buf_device)(gx_device **pbdev, gx_device *target, int y, const gx_render_plane_t *render_plane, gs_memory_t *mem, gx_band_complexity_t *band_complexity);
2718 int (*size_buf_device)(gx_device_buf_space_t *space, gx_device *target, const gx_render_plane_t *render_plane, int height, bool for_band);
2719 int (*setup_buf_device)(gx_device *bdev, unsigned char *buffer, int bytes_per_line, unsigned char **line_ptrs , int y, int setup_height, int full_height);
2720 void (*destroy_buf_device)(gx_device *bdev);
2721 } gx_device_buf_procs_t;
2722 int gx_default_create_buf_device(gx_device **pbdev, gx_device *target, int y, const gx_render_plane_t *render_plane, gs_memory_t *mem, gx_band_complexity_t *band_complexity);
2723 int gx_default_size_buf_device(gx_device_buf_space_t *space, gx_device *target, const gx_render_plane_t *render_plane, int height, bool for_band);
2724 int gx_default_setup_buf_device(gx_device *bdev, unsigned char *buffer, int bytes_per_line, unsigned char **line_ptrs , int y, int setup_height, int full_height);
2725 void gx_default_destroy_buf_device(gx_device *bdev);
2726 typedef enum {
2727 gs_cap_butt = 0,
2728 gs_cap_round = 1,
2729 gs_cap_square = 2,
2730 gs_cap_triangle = 3,
2731 gs_cap_unknown = 4
2732 } gs_line_cap;
2733 typedef enum {
2734 gs_join_miter = 0,
2735 gs_join_round = 1,
2736 gs_join_bevel = 2,
2737 gs_join_none = 3,
2738 gs_join_triangle = 4,
2739 gs_join_unknown = 5
2740 } gs_line_join;
2741 typedef struct gx_dash_params_s {
2742 float *pattern;
2743 unsigned int pattern_size;
2744 float offset;
2745 bool adapt;
2746 float pattern_length;
2747 bool init_ink_on;
2748 int init_index;
2749 float init_dist_left;
2750 } gx_dash_params;
2751 typedef struct gx_line_params_s {
2752 float half_width;
2753 gs_line_cap cap;
2754 gs_line_join join;
2755 int curve_join;
2756 float miter_limit;
2757 float miter_check;
2758 float dot_length;
2759 bool dot_length_absolute;
2760 gs_matrix dot_orientation;
2761 gx_dash_params dash;
2762 } gx_line_params;
2763 int gx_set_miter_limit(gx_line_params *, floatp);
2764 int gx_set_dash(gx_dash_params *, const float *, unsigned int, floatp, gs_memory_t *);
2765 int gx_set_dot_length(gx_line_params *, floatp, bool);
2766 struct gs_matrix_fixed_s {
2767 float xx, xy, yx, yy, tx, ty;
2768 fixed tx_fixed, ty_fixed;
2769 bool txy_fixed_valid;
2770 };
2771 typedef struct gs_matrix_fixed_s gs_matrix_fixed;
2772 int gs_matrix_fixed_from_matrix(gs_matrix_fixed *, const gs_matrix *);
2773 int gs_point_transform2fixed(const gs_matrix_fixed *, floatp, floatp,
2774 gs_fixed_point *);
2775 int gs_distance_transform2fixed(const gs_matrix_fixed *, floatp, floatp,
2776 gs_fixed_point *);
2777 int gs_point_transform2fixed_rounding(const gs_matrix_fixed * pmat,
2778 floatp x, floatp y, gs_fixed_point * ppt);
2779 typedef struct {
2780 long xx, xy, yx, yy;
2781 int skewed;
2782 int shift;
2783 int max_bits;
2784 fixed round;
2785 } fixed_coeff;
2786 fixed fixed_coeff_mult(fixed, long, const fixed_coeff *, int);
2787 typedef unsigned long gx_bitmap_format_t;
2788 typedef struct gx_device_clist_writer_s gx_device_clist_writer;
2789 typedef struct gs_composite_type_procs_s {
2790 int (*create_default_compositor)(const gs_composite_t *pcte, gx_device **pcdev, gx_device *dev, gs_imager_state *pis, gs_memory_t *mem);
2791 bool (*equal)(const gs_composite_t *pcte, const gs_composite_t *pcte2);
2792 int (*write)(const gs_composite_t *pcte, unsigned char *data, unsigned int *psize, gx_device_clist_writer *cdev);
2793 int (*read)(gs_composite_t **ppcte, const unsigned char *data, unsigned int size, gs_memory_t *mem);
2794 int (*adjust_ctm)(gs_composite_t *pcte, int x0, int y0, gs_imager_state *pis);
2795 int (*is_closing)(const gs_composite_t *this, gs_composite_t **pcte, gx_device *dev);
2796 bool (*is_friendly)(const gs_composite_t *this, unsigned char cmd0, unsigned char cmd1);
2797 int (*clist_compositor_write_update)(const gs_composite_t * pcte, gx_device * dev, gx_device ** pcdev, gs_imager_state * pis, gs_memory_t * mem);
2798 int (*clist_compositor_read_update)(gs_composite_t * pcte, gx_device * cdev, gx_device * tdev, gs_imager_state * pis, gs_memory_t * mem);
2799 int (*get_cropping)(const gs_composite_t * pcte, int *ry, int *rheight);
2800 } gs_composite_type_procs_t;
2801 typedef struct gs_composite_type_s {
2802 unsigned char comp_id;
2803 gs_composite_type_procs_t procs;
2804 } gs_composite_type_t;
2805 int gx_default_composite_clist_write_update(const gs_composite_t * pcte, gx_device * dev, gx_device ** pcdev, gs_imager_state * pis, gs_memory_t * mem);
2806 int gx_default_composite_adjust_ctm(gs_composite_t *pcte, int x0, int y0, gs_imager_state *pis);
2807 int gx_default_composite_is_closing(const gs_composite_t *this, gs_composite_t **pcte, gx_device *dev);
2808 bool gx_default_composite_is_friendly(const gs_composite_t *this, unsigned char cmd0, unsigned char cmd1);
2809 int gx_default_composite_clist_read_update(gs_composite_t * pcte, gx_device * cdev, gx_device * tdev, gs_imager_state * pis, gs_memory_t * mem);
2810 int gx_default_composite_get_cropping(const gs_composite_t * pcte, int *ry, int *rheight);
2811 struct gs_composite_s {
2812 const gs_composite_type_t *type; gs_id id; bool idle; struct gs_composite_s *prev, *next;
2813 };
2814 typedef enum {
2815 PDF14_PUSH_DEVICE,
2816 PDF14_POP_DEVICE,
2817 PDF14_BEGIN_TRANS_GROUP,
2818 PDF14_END_TRANS_GROUP,
2819 PDF14_BEGIN_TRANS_MASK,
2820 PDF14_END_TRANS_MASK,
2821 PDF14_SET_BLEND_PARAMS
2822 } pdf14_compositor_operations;
2823 typedef struct gs_transparency_source_s {
2824 float alpha;
2825 } gs_transparency_source_t;
2826 struct gs_pdf14trans_params_s {
2827 pdf14_compositor_operations pdf14_op;
2828 int num_spot_colors;
2829 int changed;
2830 bool Isolated;
2831 bool Knockout;
2832 bool image_with_SMask;
2833 gs_rect bbox;
2834 gs_transparency_channel_selector_t csel;
2835 gs_transparency_mask_subtype_t subtype;
2836 int Background_components;
2837 bool function_is_identity;
2838 float Background[(8)];
2839 float GrayBackground;
2840 gs_function_t *transfer_function;
2841 unsigned char transfer_fn[256];
2842 gs_blend_mode_t blend_mode;
2843 bool text_knockout;
2844 gs_transparency_source_t opacity;
2845 gs_transparency_source_t shape;
2846 bool mask_is_image;
2847 gs_matrix ctm;
2848 bool replacing;
2849 bool idle;
2850 unsigned int mask_id;
2851 };
2852 typedef struct gs_pdf14trans_params_s gs_pdf14trans_params_t;
2853 typedef struct gs_pdf14trans_s {
2854 const gs_composite_type_t *type; gs_id id; bool idle; struct gs_composite_s *prev, *next;
2855 gs_pdf14trans_params_t params;
2856 } gs_pdf14trans_t;
2857 int gs_setblendmode(gs_state *, gs_blend_mode_t);
2858 gs_blend_mode_t gs_currentblendmode(const gs_state *);
2859 int gs_setopacityalpha(gs_state *, floatp);
2860 float gs_currentopacityalpha(const gs_state *);
2861 int gs_setshapealpha(gs_state *, floatp);
2862 float gs_currentshapealpha(const gs_state *);
2863 int gs_settextknockout(gs_state *, bool);
2864 bool gs_currenttextknockout(const gs_state *);
2865 gs_transparency_state_type_t
2866 gs_current_transparency_type(const gs_state *pgs);
2867 int gs_push_pdf14trans_device(gs_state * pgs);
2868 int gs_pop_pdf14trans_device(gs_state * pgs);
2869 void gs_trans_group_params_init(gs_transparency_group_params_t *ptgp);
2870 int gs_begin_transparency_group(gs_state * pgs,
2871 const gs_transparency_group_params_t *ptgp,
2872 const gs_rect *pbbox);
2873 int gs_end_transparency_group(gs_state *pgs);
2874 void gs_trans_mask_params_init(gs_transparency_mask_params_t *ptmp,
2875 gs_transparency_mask_subtype_t subtype);
2876 int gs_begin_transparency_mask(gs_state *pgs,
2877 const gs_transparency_mask_params_t *ptmp,
2878 const gs_rect *pbbox, bool mask_is_image);
2879 int gs_end_transparency_mask(gs_state *pgs,
2880 gs_transparency_channel_selector_t csel);
2881 int gs_discard_transparency_layer(gs_state *pgs);
2882 int gx_begin_transparency_group(gs_imager_state * pis, gx_device * pdev,
2883 const gs_pdf14trans_params_t * pparams);
2884 int gx_end_transparency_group(gs_imager_state * pis, gx_device * pdev);
2885 int gx_begin_transparency_mask(gs_imager_state * pis, gx_device * pdev,
2886 const gs_pdf14trans_params_t * pparams);
2887 int gx_end_transparency_mask(gs_imager_state * pis, gx_device * pdev,
2888 const gs_pdf14trans_params_t * pparams);
2889 int gx_discard_transparency_layer(gs_imager_state *pis);
2890 int gs_is_pdf14trans_compositor(const gs_composite_t * pct);
2891 typedef struct gs_halftone_s gs_halftone;
2892 typedef struct gx_transfer_s {
2893 int red_component_num;
2894 gx_transfer_map *red;
2895 int green_component_num;
2896 gx_transfer_map *green;
2897 int blue_component_num;
2898 gx_transfer_map *blue;
2899 int gray_component_num;
2900 gx_transfer_map *gray;
2901 } gx_transfer;
2902 typedef struct gs_devicen_color_map_s {
2903 bool use_alt_cspace;
2904 separation_type sep_type;
2905 unsigned int num_components;
2906 unsigned int num_colorants;
2907 gs_id cspace_id;
2908 int color_map[(8)];
2909 } gs_devicen_color_map;
2910 struct gs_imager_state_s {
2911 gs_memory_t *memory; void *client_data; gx_line_params line_params; gs_matrix_fixed ctm; bool current_point_valid; gs_point current_point; gs_point subpath_start; bool clamp_coordinates; gs_logical_operation_t log_op; gx_color_value alpha; gs_blend_mode_t blend_mode; gs_transparency_source_t opacity, shape; gs_id soft_mask_id; bool text_knockout; unsigned int text_rendering_mode; gs_transparency_state_t *transparency_stack; bool overprint; int overprint_mode; int effective_overprint_mode; float flatness; gs_fixed_point fill_adjust; bool stroke_adjust; bool accurate_curves; bool have_pattern_streams; float smoothness; int renderingintent; const gx_color_map_procs * (*get_cmap_procs)(const gs_imager_state *, const gx_device *); gs_halftone *halftone; gs_int_point screen_phase[2]; gx_device_halftone *dev_ht; struct gs_cie_render_s *cie_render; bool cie_to_xyz; gx_transfer_map *black_generation; gx_transfer_map *undercolor_removal; gx_transfer set_transfer; gx_transfer_map *effective_transfer[(8 * 8)]; int object_tag; struct gx_cie_joint_caches_s *cie_joint_caches; const struct gx_color_map_procs_s *cmap_procs; gs_devicen_color_map color_component_map; struct gx_pattern_cache_s *pattern_cache; gs_color_space *devicergb_cs; gs_color_space *devicecmyk_cs;
2912 };
2913 int gs_imager_state_initialize(gs_imager_state * pis, gs_memory_t * mem);
2914 gs_imager_state *
2915 gs_imager_state_copy(const gs_imager_state * pis, gs_memory_t * mem);
2916 void gs_imager_state_copied(gs_imager_state * pis);
2917 void gs_imager_state_pre_assign(gs_imager_state *to,
2918 const gs_imager_state *from);
2919 void gs_imager_state_release(gs_imager_state * pis);
2920 int gs_currentscreenphase_pis(const gs_imager_state *, gs_int_point *, gs_color_select_t);
2921 typedef struct gx_saved_page_s {
2922 gx_device device;
2923 char dname[8 + 1];
2924 gx_band_page_info_t info;
2925 int num_copies;
2926 } gx_saved_page;
2927 typedef struct gx_placed_page_s {
2928 gx_saved_page *page;
2929 gs_int_point offset;
2930 } gx_placed_page;
2931 typedef struct {
2932 unsigned long offset;
2933 } tile_hash;
2934 typedef struct {
2935 gx_cached_bits_head head; unsigned short width, height, shift; unsigned short raster; gx_bitmap_id id;
2936 unsigned char x_reps, y_reps;
2937 unsigned short rep_shift;
2938 unsigned short index;
2939 unsigned short num_bands;
2940 } tile_slot;
2941 typedef struct cmd_prefix_s cmd_prefix;
2942 struct cmd_prefix_s {
2943 cmd_prefix *next;
2944 unsigned int size;
2945 unsigned long id;
2946 };
2947 typedef struct cmd_list_s {
2948 cmd_prefix *head, *tail;
2949 } cmd_list;
2950 extern const gs_imager_state clist_imager_state_initial;
2951 typedef struct gx_clist_state_s gx_clist_state;
2952 typedef struct gx_device_clist_common_s {
2953 int params_size; const gx_device_procs *static_procs; const char *dname; gs_memory_t *memory; gs_memory_type_ptr_t stype; bool stype_is_dynamic; void (*finalize)(gx_device *); rc_header rc; bool retained; bool is_open; int max_fill_band; gx_device_color_info color_info; gx_device_cached_colors_t cached_colors; int width; int height; int LeadingEdge; float MediaSize[2]; float ImagingBBox[4]; bool ImagingBBox_set; float HWResolution[2]; float MarginsHWResolution[2]; float Margins[2]; float HWMargins[4]; long PageCount; long ShowpageCount; int NumCopies; bool NumCopies_set; bool IgnoreNumCopies; bool UseCIEColor; bool LockSafetyParams; long band_offset_x; long band_offset_y; gx_stroked_gradient_recognizer_t sgr; gx_page_device_procs page_procs; gx_device_procs procs; gx_device *target; gx_device_buf_procs_t buf_procs; gs_memory_t *bandlist_memory; unsigned char *data; unsigned int data_size; gx_band_params_t band_params; bool do_not_open_or_close_bandfiles; bool page_uses_transparency; gx_bits_cache_chunk chunk; gx_bits_cache bits; unsigned int tile_hash_mask; unsigned int tile_band_mask_size; tile_hash *tile_table; int ymin, ymax; gx_band_page_info_t page_info; int nbands;
2954 } gx_device_clist_common;
2955 typedef struct clist_writer_cropping_buffer_s clist_writer_cropping_buffer_t;
2956 struct clist_writer_cropping_buffer_s {
2957 int cropping_min, cropping_max;
2958 unsigned int mask_id, temp_mask_id;
2959 clist_writer_cropping_buffer_t *next;
2960 };
2961 typedef struct clist_color_space_s {
2962 unsigned char byte1;
2963 gs_id id;
2964 const gs_color_space *space;
2965 } clist_color_space_t;
2966 struct gx_device_clist_writer_s {
2967 int params_size; const gx_device_procs *static_procs; const char *dname; gs_memory_t *memory; gs_memory_type_ptr_t stype; bool stype_is_dynamic; void (*finalize)(gx_device *); rc_header rc; bool retained; bool is_open; int max_fill_band; gx_device_color_info color_info; gx_device_cached_colors_t cached_colors; int width; int height; int LeadingEdge; float MediaSize[2]; float ImagingBBox[4]; bool ImagingBBox_set; float HWResolution[2]; float MarginsHWResolution[2]; float Margins[2]; float HWMargins[4]; long PageCount; long ShowpageCount; int NumCopies; bool NumCopies_set; bool IgnoreNumCopies; bool UseCIEColor; bool LockSafetyParams; long band_offset_x; long band_offset_y; gx_stroked_gradient_recognizer_t sgr; gx_page_device_procs page_procs; gx_device_procs procs; gx_device *target; gx_device_buf_procs_t buf_procs; gs_memory_t *bandlist_memory; unsigned char *data; unsigned int data_size; gx_band_params_t band_params; bool do_not_open_or_close_bandfiles; bool page_uses_transparency; gx_bits_cache_chunk chunk; gx_bits_cache bits; unsigned int tile_hash_mask; unsigned int tile_band_mask_size; tile_hash *tile_table; int ymin, ymax; gx_band_page_info_t page_info; int nbands;
2968 int error_code;
2969 gx_clist_state *states;
2970 unsigned char *cbuf;
2971 unsigned char *cnext;
2972 unsigned char *cend;
2973 cmd_list *ccl;
2974 cmd_list band_range_list;
2975 int band_range_min, band_range_max;
2976 unsigned int tile_max_size;
2977 unsigned int tile_max_count;
2978 gx_strip_bitmap tile_params;
2979 int tile_depth;
2980 int tile_known_min, tile_known_max;
2981 gs_imager_state imager_state;
2982 float dash_pattern[11];
2983 const gx_clip_path *clip_path;
2984 gs_id clip_path_id;
2985 clist_color_space_t color_space;
2986 gs_id transfer_ids[4];
2987 gs_id black_generation_id;
2988 gs_id undercolor_removal_id;
2989 gs_id device_halftone_id;
2990 gs_id image_enum_id;
2991 int error_is_retryable;
2992 int permanent_error;
2993 int driver_call_nesting;
2994 int ignore_lo_mem_warnings;
2995 int (*free_up_bandlist_memory)(gx_device *dev, bool flush_current);
2996 int disable_mask;
2997 gs_pattern1_instance_t *pinst;
2998 int cropping_min, cropping_max;
2999 int save_cropping_min, save_cropping_max;
3000 int cropping_level;
3001 clist_writer_cropping_buffer_t *cropping_stack;
3002 unsigned long ins_count;
3003 unsigned int mask_id_count;
3004 unsigned int mask_id;
3005 unsigned int temp_mask_id;
3006 };
3007 typedef struct clist_render_thread_control_s clist_render_thread_control_t;
3008 typedef struct gx_device_clist_reader_s {
3009 int params_size; const gx_device_procs *static_procs; const char *dname; gs_memory_t *memory; gs_memory_type_ptr_t stype; bool stype_is_dynamic; void (*finalize)(gx_device *); rc_header rc; bool retained; bool is_open; int max_fill_band; gx_device_color_info color_info; gx_device_cached_colors_t cached_colors; int width; int height; int LeadingEdge; float MediaSize[2]; float ImagingBBox[4]; bool ImagingBBox_set; float HWResolution[2]; float MarginsHWResolution[2]; float Margins[2]; float HWMargins[4]; long PageCount; long ShowpageCount; int NumCopies; bool NumCopies_set; bool IgnoreNumCopies; bool UseCIEColor; bool LockSafetyParams; long band_offset_x; long band_offset_y; gx_stroked_gradient_recognizer_t sgr; gx_page_device_procs page_procs; gx_device_procs procs; gx_device *target; gx_device_buf_procs_t buf_procs; gs_memory_t *bandlist_memory; unsigned char *data; unsigned int data_size; gx_band_params_t band_params; bool do_not_open_or_close_bandfiles; bool page_uses_transparency; gx_bits_cache_chunk chunk; gx_bits_cache bits; unsigned int tile_hash_mask; unsigned int tile_band_mask_size; tile_hash *tile_table; int ymin, ymax; gx_band_page_info_t page_info; int nbands;
3010 gx_render_plane_t yplane;
3011 const gx_placed_page *pages;
3012 int num_pages;
3013 gx_band_complexity_t *band_complexity_array;
3014 void *offset_map;
3015 int num_render_threads;
3016 clist_render_thread_control_t *render_threads;
3017 unsigned char *main_thread_data;
3018 int curr_render_thread;
3019 int thread_lookahead_direction;
3020 } gx_device_clist_reader;
3021 union gx_device_clist_s {
3022 gx_device_clist_common common;
3023 gx_device_clist_reader reader;
3024 gx_device_clist_writer writer;
3025 };
3026 typedef union gx_device_clist_s gx_device_clist;
3027 extern const gs_memory_struct_type_t st_device_clist;
3028 extern const gx_device_procs gs_clist_device_procs;
3029 void clist_init_io_procs(gx_device_clist *pclist_dev, bool in_memory);
3030 int clist_finish_page(gx_device * dev, bool flush);
3031 int clist_close_output_file(gx_device *dev);
3032 int clist_close_page_info(gx_band_page_info_t *ppi);
3033 void clist_compute_colors_used(gx_device_clist_writer *cldev);
3034 typedef struct gx_device_printer_s gx_device_printer;
3035 int clist_setup_params(gx_device *dev);
3036 int clist_render_rectangle(gx_device_clist *cdev,
3037 const gs_int_rect *prect, gx_device *bdev,
3038 const gx_render_plane_t *render_plane,
3039 bool clear);
3040 gx_band_complexity_t *
3041 clist_get_band_complexity(gx_device *dev, int y);
3042 void gx_clist_reader_free_band_complexity_array(gx_device_clist *cldev);
3043 void
3044 clist_copy_band_complexity(gx_band_complexity_t *this, const gx_band_complexity_t *from);
3045 int clist_data_size(const gx_device_clist *cdev, int select);
3046 int clist_get_data(const gx_device_clist *cdev, int select, int offset, unsigned char *buf, int length);
3047 int clist_put_data(const gx_device_clist *cdev, int select, int offset, const unsigned char *buf, int length);
3048 int clist_render_init(gx_device_clist *dev);
3049 int
3050 clist_close_writer_and_init_reader(gx_device_clist *cldev);
3051 void
3052 clist_select_render_plane(gx_device *dev, int y, int height,
3053 gx_render_plane_t *render_plane, int index);
3054 int clist_rasterize_lines(gx_device *dev, int y, int lineCount,
3055 gx_device *bdev,
3056 const gx_render_plane_t *render_plane,
3057 int *pmy);
3058 int
3059 clist_enable_multi_thread_render(gx_device *dev);
3060 void
3061 clist_teardown_render_threads(gx_device *dev);
3062 typedef struct gdev_prn_start_render_params_s gdev_prn_start_render_params;
3063 typedef struct gx_page_queue_s gx_page_queue_t;
3064 typedef struct gdev_prn_space_params_s gdev_prn_space_params;
3065 typedef struct gx_printer_device_procs_s {
3066 int (*print_page)(gx_device_printer *, FILE *);
3067 int (*print_page_copies)(gx_device_printer *, FILE *, int);
3068 gx_device_buf_procs_t buf_procs;
3069 void (*get_space_params)(const gx_device_printer *, gdev_prn_space_params *);
3070 int (*start_render_thread)(gdev_prn_start_render_params *);
3071 int (*open_render_device)(gx_device_printer *);
3072 int (*close_render_device)(gx_device_printer *);
3073 int (*buffer_page)(gx_device_printer *, FILE *, int);
3074 } gx_printer_device_procs;
3075 typedef enum {
3076 BandingAuto = 0,
3077 BandingAlways,
3078 BandingNever
3079 } gdev_prn_banding_type;
3080 struct gdev_prn_space_params_s {
3081 long MaxBitmap;
3082 long BufferSpace;
3083 gx_band_params_t band;
3084 bool params_are_read_only;
3085 gdev_prn_banding_type banding_type;
3086 };
3087 struct gx_device_printer_s {
3088 int params_size; const gx_device_procs *static_procs; const char *dname; gs_memory_t *memory; gs_memory_type_ptr_t stype; bool stype_is_dynamic; void (*finalize)(gx_device *); rc_header rc; bool retained; bool is_open; int max_fill_band; gx_device_color_info color_info; gx_device_cached_colors_t cached_colors; int width; int height; int LeadingEdge; float MediaSize[2]; float ImagingBBox[4]; bool ImagingBBox_set; float HWResolution[2]; float MarginsHWResolution[2]; float Margins[2]; float HWMargins[4]; long PageCount; long ShowpageCount; int NumCopies; bool NumCopies_set; bool IgnoreNumCopies; bool UseCIEColor; bool LockSafetyParams; long band_offset_x; long band_offset_y; gx_stroked_gradient_recognizer_t sgr; gx_page_device_procs page_procs; gx_device_procs procs;
3089 unsigned char skip[(((sizeof(gx_device_memory)) > (sizeof(gx_device_clist))) ? (sizeof(gx_device_memory)) : (sizeof(gx_device_clist))) - sizeof(gx_device) + sizeof(double) ]; gx_printer_device_procs printer_procs; gdev_prn_space_params space_params; char fname[260]; bool OpenOutputFile; bool ReopenPerPage; bool page_uses_transparency; bool Duplex; int Duplex_set; bool file_is_new; FILE *file; long buffer_space; unsigned char *buf; gs_memory_t *buffer_memory; gs_memory_t *bandlist_memory; int (*free_up_bandlist_memory)(gx_device *dev, bool flush_current); gx_page_queue_t *page_queue; bool is_async_renderer; gx_device_printer *async_renderer; unsigned int clist_disable_mask; int num_render_threads_requested; gx_device_procs orig_procs;
3090 };
3091 extern const gs_memory_struct_type_t st_device_printer;
3092 typedef int (*dev_proc_print_page_t)(gx_device_printer *, FILE *);
3093 int gdev_prn_open(gx_device *dev);
3094 int gdev_prn_output_page(gx_device *dev, int num_copies, int flush);
3095 int gdev_prn_close(gx_device *dev);
3096 int gdev_prn_get_params(gx_device *dev, gs_param_list *plist);
3097 int gdev_prn_put_params(gx_device *dev, gs_param_list *plist);
3098 void gx_default_get_space_params(const gx_device_printer *, gdev_prn_space_params *);
3099 int gx_default_start_render_thread(gdev_prn_start_render_params *);
3100 int gx_default_open_render_device(gx_device_printer *);
3101 int gx_default_close_render_device(gx_device_printer *);
3102 int gx_default_buffer_page(gx_device_printer *, FILE *, int);
3103 extern const gx_device_procs prn_std_procs;
3104 int gdev_prn_open_printer_seekable(gx_device *dev, bool binary_mode,
3105 bool seekable);
3106 int gdev_prn_open_printer(gx_device * dev, bool binary_mode);
3107 bool gdev_prn_file_is_new(const gx_device_printer *pdev);
3108 int gdev_prn_colors_used(gx_device *dev, int y, int height,
3109 gx_colors_used_t *colors_used,
3110 int *range_start);
3111 int gx_page_info_colors_used(const gx_device *dev,
3112 const gx_band_page_info_t *page_info,
3113 int y, int height,
3114 gx_colors_used_t *colors_used,
3115 int *range_start);
3116 int gdev_prn_render_rectangle(gx_device_printer *pdev,
3117 const gs_int_rect *prect,
3118 gx_device *target,
3119 const gx_render_plane_t *render_plane,
3120 bool clear);
3121 int gdev_prn_get_lines(gx_device_printer *pdev, int y, int height,
3122 unsigned char *buffer, unsigned int bytes_per_line,
3123 unsigned char **actual_buffer, unsigned int *actual_bytes_per_line,
3124 const gx_render_plane_t *render_plane);
3125 int gdev_prn_get_bits(gx_device_printer *pdev, int y, unsigned char *buffer,
3126 unsigned char **actual_buffer);
3127 int gdev_prn_copy_scan_lines(gx_device_printer *, int, unsigned char *, unsigned int);
3128 void gdev_prn_clear_trailing_bits(unsigned char *data, unsigned int raster, int height,
3129 const gx_device *dev);
3130 int gdev_prn_close_printer(gx_device *);
3131 int gx_print_page_single_copy(gx_device_printer *, FILE *);
3132 int gx_default_print_page_copies(gx_device_printer *, FILE *, int);
3133 int gdev_prn_print_scan_lines(gx_device *);
3134 int gdev_prn_allocate_memory(gx_device *pdev,
3135 gdev_prn_space_params *space,
3136 int new_width, int new_height);
3137 int gdev_prn_reallocate_memory(gx_device *pdev,
3138 gdev_prn_space_params *space,
3139 int new_width, int new_height);
3140 int gdev_prn_free_memory(gx_device *pdev);
3141 typedef int (*create_buf_device_proc_t)(gx_device **pbdev, gx_device *target, int y, const gx_render_plane_t *render_plane, gs_memory_t *mem, gx_band_complexity_t *band_complexity);
3142 int gdev_create_buf_device(create_buf_device_proc_t cbd_proc,
3143 gx_device **pbdev, gx_device *target, int y,
3144 const gx_render_plane_t *render_plane,
3145 gs_memory_t *mem, gx_band_complexity_t *band_complexity);
3146 int gdev_prn_initialize(gx_device *, const char *, int (*)(gx_device_printer *, FILE *));
3147 void gdev_prn_init_color(gx_device *, int, gx_color_index (*)(gx_device *dev, const gx_color_value cv[]), int (*)(gx_device *dev, gx_color_index color, gx_color_value rgb[3]));
3148 typedef long int wchar_t;
3149 typedef struct
3150 {
3151 int quot;
3152 int rem;
3153 } div_t;
3154 typedef struct
3155 {
3156 long int quot;
3157 long int rem;
3158 } ldiv_t;
3159 extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__)) ;
3160 extern double atof (__const char *__nptr)
3161 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
3162 extern int atoi (__const char *__nptr)
3163 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
3164 extern long int atol (__const char *__nptr)
3165 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
3166 __extension__ extern long long int atoll (__const char *__nptr)
3167 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
3168 extern double strtod (__const char *__restrict __nptr,
3169 char **__restrict __endptr)
3170 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3171 extern long int strtol (__const char *__restrict __nptr,
3172 char **__restrict __endptr, int __base)
3173 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3174 extern unsigned long int strtoul (__const char *__restrict __nptr,
3175 char **__restrict __endptr, int __base)
3176 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3177 __extension__
3178 extern long long int strtoq (__const char *__restrict __nptr,
3179 char **__restrict __endptr, int __base)
3180 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3181 __extension__
3182 extern unsigned long long int strtouq (__const char *__restrict __nptr,
3183 char **__restrict __endptr, int __base)
3184 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3185 __extension__
3186 extern long long int strtoll (__const char *__restrict __nptr,
3187 char **__restrict __endptr, int __base)
3188 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3189 __extension__
3190 extern unsigned long long int strtoull (__const char *__restrict __nptr,
3191 char **__restrict __endptr, int __base)
3192 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3193 extern __inline double
3194 __attribute__ ((__nothrow__)) atof (__const char *__nptr)
3195 {
3196 return strtod (__nptr, (char **) ((void *)0));
3197 }
3198 extern __inline int
3199 __attribute__ ((__nothrow__)) atoi (__const char *__nptr)
3200 {
3201 return (int) strtol (__nptr, (char **) ((void *)0), 10);
3202 }
3203 extern __inline long int
3204 __attribute__ ((__nothrow__)) atol (__const char *__nptr)
3205 {
3206 return strtol (__nptr, (char **) ((void *)0), 10);
3207 }
3208 __extension__ extern __inline long long int
3209 __attribute__ ((__nothrow__)) atoll (__const char *__nptr)
3210 {
3211 return strtoll (__nptr, (char **) ((void *)0), 10);
3212 }
3213 extern char *l64a (long int __n) __attribute__ ((__nothrow__)) ;
3214 extern long int a64l (__const char *__s)
3215 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
3216 extern long int random (void) __attribute__ ((__nothrow__));
3217 extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__));
3218 extern char *initstate (unsigned int __seed, char *__statebuf,
3219 size_t __statelen) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
3220 extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3221 struct random_data
3222 {
3223 int32_t *fptr;
3224 int32_t *rptr;
3225 int32_t *state;
3226 int rand_type;
3227 int rand_deg;
3228 int rand_sep;
3229 int32_t *end_ptr;
3230 };
3231 extern int random_r (struct random_data *__restrict __buf,
3232 int32_t *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3233 extern int srandom_r (unsigned int __seed, struct random_data *__buf)
3234 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
3235 extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
3236 size_t __statelen,
3237 struct random_data *__restrict __buf)
3238 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 4)));
3239 extern int setstate_r (char *__restrict __statebuf,
3240 struct random_data *__restrict __buf)
3241 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3242 extern int rand (void) __attribute__ ((__nothrow__));
3243 extern void srand (unsigned int __seed) __attribute__ ((__nothrow__));
3244 extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__));
3245 extern double drand48 (void) __attribute__ ((__nothrow__));
3246 extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3247 extern long int lrand48 (void) __attribute__ ((__nothrow__));
3248 extern long int nrand48 (unsigned short int __xsubi[3])
3249 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3250 extern long int mrand48 (void) __attribute__ ((__nothrow__));
3251 extern long int jrand48 (unsigned short int __xsubi[3])
3252 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3253 extern void srand48 (long int __seedval) __attribute__ ((__nothrow__));
3254 extern unsigned short int *seed48 (unsigned short int __seed16v[3])
3255 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3256 extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3257 struct drand48_data
3258 {
3259 unsigned short int __x[3];
3260 unsigned short int __old_x[3];
3261 unsigned short int __c;
3262 unsigned short int __init;
3263 unsigned long long int __a;
3264 };
3265 extern int drand48_r (struct drand48_data *__restrict __buffer,
3266 double *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3267 extern int erand48_r (unsigned short int __xsubi[3],
3268 struct drand48_data *__restrict __buffer,
3269 double *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3270 extern int lrand48_r (struct drand48_data *__restrict __buffer,
3271 long int *__restrict __result)
3272 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3273 extern int nrand48_r (unsigned short int __xsubi[3],
3274 struct drand48_data *__restrict __buffer,
3275 long int *__restrict __result)
3276 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3277 extern int mrand48_r (struct drand48_data *__restrict __buffer,
3278 long int *__restrict __result)
3279 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3280 extern int jrand48_r (unsigned short int __xsubi[3],
3281 struct drand48_data *__restrict __buffer,
3282 long int *__restrict __result)
3283 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3284 extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
3285 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
3286 extern int seed48_r (unsigned short int __seed16v[3],
3287 struct drand48_data *__buffer) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3288 extern int lcong48_r (unsigned short int __param[7],
3289 struct drand48_data *__buffer)
3290 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3291 extern void *realloc (void *__ptr, size_t __size)
3292 __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
3293 extern void free (void *__ptr) __attribute__ ((__nothrow__));
3294 extern void cfree (void *__ptr) __attribute__ ((__nothrow__));
3295 extern void *alloca (size_t __size) __attribute__ ((__nothrow__));
3296 extern void *valloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
3297 extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
3298 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3299 extern void abort (void) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
3300 extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3301 extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
3302 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3303 extern void exit (int __status) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
3304 extern char *getenv (__const char *__name) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3305 extern char *__secure_getenv (__const char *__name)
3306 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3307 extern int putenv (char *__string) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3308 extern int setenv (__const char *__name, __const char *__value, int __replace)
3309 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
3310 extern int unsetenv (__const char *__name) __attribute__ ((__nothrow__));
3311 extern int clearenv (void) __attribute__ ((__nothrow__));
3312 extern char *mktemp (char *__template) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3313 extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ;
3314 extern int mkstemp64 (char *__template) __attribute__ ((__nonnull__ (1))) ;
3315 extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3316 extern int system (__const char *__command) ;
3317 extern char *realpath (__const char *__restrict __name,
3318 char *__restrict __resolved) __attribute__ ((__nothrow__)) ;
3319 typedef int (*__compar_fn_t) (__const void *, __const void *);
3320 extern void *bsearch (__const void *__key, __const void *__base,
3321 size_t __nmemb, size_t __size, __compar_fn_t __compar)
3322 __attribute__ ((__nonnull__ (1, 2, 5))) ;
3323 extern void qsort (void *__base, size_t __nmemb, size_t __size,
3324 __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4)));
3325 extern int abs (int __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
3326 extern long int labs (long int __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
3327 extern div_t div (int __numer, int __denom)
3328 __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
3329 extern ldiv_t ldiv (long int __numer, long int __denom)
3330 __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
3331 extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
3332 int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
3333 extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
3334 int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
3335 extern char *gcvt (double __value, int __ndigit, char *__buf)
3336 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3))) ;
3337 extern char *qecvt (long double __value, int __ndigit,
3338 int *__restrict __decpt, int *__restrict __sign)
3339 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
3340 extern char *qfcvt (long double __value, int __ndigit,
3341 int *__restrict __decpt, int *__restrict __sign)
3342 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
3343 extern char *qgcvt (long double __value, int __ndigit, char *__buf)
3344 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3))) ;
3345 extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
3346 int *__restrict __sign, char *__restrict __buf,
3347 size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
3348 extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
3349 int *__restrict __sign, char *__restrict __buf,
3350 size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
3351 extern int qecvt_r (long double __value, int __ndigit,
3352 int *__restrict __decpt, int *__restrict __sign,
3353 char *__restrict __buf, size_t __len)
3354 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
3355 extern int qfcvt_r (long double __value, int __ndigit,
3356 int *__restrict __decpt, int *__restrict __sign,
3357 char *__restrict __buf, size_t __len)
3358 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
3359 extern int mblen (__const char *__s, size_t __n) __attribute__ ((__nothrow__)) ;
3360 extern int mbtowc (wchar_t *__restrict __pwc,
3361 __const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__)) ;
3362 extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__)) ;
3363 extern size_t mbstowcs (wchar_t *__restrict __pwcs,
3364 __const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__));
3365 extern size_t wcstombs (char *__restrict __s,
3366 __const wchar_t *__restrict __pwcs, size_t __n)
3367 __attribute__ ((__nothrow__));
3368 extern int rpmatch (__const char *__response) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
3369 extern int posix_openpt (int __oflag) ;
3370 extern int getloadavg (double __loadavg[], int __nelem)
3371 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3372 typedef struct WImage WImage;
3373 typedef struct Rectangle Rectangle;
3374 typedef struct Point Point;
3375 struct Point {
3376 int x;
3377 int y;
3378 };
3379 struct Rectangle {
3380 Point min;
3381 Point max;
3382 };
3383 static Point ZP = { 0, 0 };
3384 static WImage* initwriteimage(FILE *f, Rectangle r, int ldepth);
3385 static int writeimageblock(WImage *w, unsigned char *data, int ndata);
3386 static int bytesperline(Rectangle, int);
3387 static int rgb2cmap(int, int, int);
3388 static long cmap2rgb(int);
3389 static gx_color_index inferno_rgb2cmap(gx_device *dev, const gx_color_value cv[]);
3390 static int inferno_cmap2rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]);
3391 static int inferno_open(gx_device *dev);
3392 static int inferno_close(gx_device *dev);
3393 static int inferno_print_page(gx_device_printer *, FILE *);
3394 typedef struct inferno_device_s {
3395 int params_size; const gx_device_procs *static_procs; const char *dname; gs_memory_t *memory; gs_memory_type_ptr_t stype; bool stype_is_dynamic; void (*finalize)(gx_device *); rc_header rc; bool retained; bool is_open; int max_fill_band; gx_device_color_info color_info; gx_device_cached_colors_t cached_colors; int width; int height; int LeadingEdge; float MediaSize[2]; float ImagingBBox[4]; bool ImagingBBox_set; float HWResolution[2]; float MarginsHWResolution[2]; float Margins[2]; float HWMargins[4]; long PageCount; long ShowpageCount; int NumCopies; bool NumCopies_set; bool IgnoreNumCopies; bool UseCIEColor; bool LockSafetyParams; long band_offset_x; long band_offset_y; gx_stroked_gradient_recognizer_t sgr; gx_page_device_procs page_procs; gx_device_procs procs;
3396 unsigned char skip[(((sizeof(gx_device_memory)) > (sizeof(gx_device_clist))) ? (sizeof(gx_device_memory)) : (sizeof(gx_device_clist))) - sizeof(gx_device) + sizeof(double) ]; gx_printer_device_procs printer_procs; gdev_prn_space_params space_params; char fname[260]; bool OpenOutputFile; bool ReopenPerPage; bool page_uses_transparency; bool Duplex; int Duplex_set; bool file_is_new; FILE *file; long buffer_space; unsigned char *buf; gs_memory_t *buffer_memory; gs_memory_t *bandlist_memory; int (*free_up_bandlist_memory)(gx_device *dev, bool flush_current); gx_page_queue_t *page_queue; bool is_async_renderer; gx_device_printer *async_renderer; unsigned int clist_disable_mask; int num_render_threads_requested; gx_device_procs orig_procs;
3397 int ldepth;
3398 int lastldepth;
3399 int color, gray;
3400 int cmapcall;
3401 int nbits;
3402 } inferno_device;
3403 static const gx_device_procs inferno_procs =
3404 { inferno_open, ((void *)0), ((void *)0), gdev_prn_output_page, inferno_close, inferno_rgb2cmap, inferno_cmap2rgb, ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), gdev_prn_get_params, gdev_prn_put_params, ((void *)0), ((void *)0), ((void *)0), ((void *)0), gx_page_device_get_page_device, ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0) };
3405 inferno_device gs_inferno_device =
3406 { sizeof(gx_device_printer), &inferno_procs, "inferno", 0 , &st_device_printer, 0 , 0 , { 0 } , 0 , 0 , 0, {3 , 3 , ( (3) >= 4 ? GX_CINFO_POLARITY_SUBTRACTIVE : GX_CINFO_POLARITY_ADDITIVE ) , 16 , ((3) == 3 ? 0xff : (3) - 1) , 255 , 255 , 0 , 0 , { 1, 1 } , GX_CINFO_UNKNOWN_SEP_LIN , { 0 } , { 0 } , { 0 } , ( (3) == 1 ? "DeviceGray" : ((3) == 3 ? "DeviceRGB" : "DeviceCMYK") ) , GX_CINFO_OPMODE_UNKNOWN , 0 }, { ((gx_color_index)(~0)), ((gx_color_index)(~0)) }, (int)((float)(85) * (100) / 10 + 0.5), (int)((float)(110) * (100) / 10 + 0.5), 0 , { (float)(((((int)((float)(85) * (100) / 10 + 0.5)) * 72.0 + 0.5) - 0.5) / (100)) , (float)(((((int)((float)(110) * (100) / 10 + 0.5)) * 72.0 + 0.5) - 0.5) / (100)) }, { 0, 0, 0, 0 } , 0 , { 100, 100 } , { 100, 100 }, {(float)(-(0) * (100)), (float)(-(0) * (100))}, {(float)((0) * 72.0), (float)((0) * 72.0), (float)((0) * 72.0), (float)((0) * 72.0)}, 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , {((bool)0)} , { gx_default_install, gx_default_begin_page, gx_default_end_page }, { 0 }, { 0 }, { inferno_print_page, gx_default_print_page_copies, { gx_default_create_buf_device, gx_default_size_buf_device, gx_default_setup_buf_device, gx_default_destroy_buf_device }, gx_default_get_space_params, gx_default_start_render_thread, gx_default_open_render_device, gx_default_close_render_device, gx_default_buffer_page }, { 10000000L, 4000000L, { 0, 0, 0 }, 0 , BandingAuto }, { 0 }, 0 , 0 , 0 , 0 , -1, 0 , 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, { 0 }
3407 };
3408 static gx_color_index
3409 inferno_rgb2cmap(gx_device *dev, const gx_color_value cv[]) {
3410 int shift;
3411 inferno_device *bdev = (inferno_device*) dev;
3412 int nbits = bdev->nbits;
3413 int mask = (1<<nbits)-1;
3414 gx_color_value red, green, blue;
3415 red = cv[0]; green = cv[1]; blue = cv[2];
3416 if((sizeof(gx_color_value) * 8) > nbits) {
3417 shift = (sizeof(gx_color_value) * 8) - nbits;
3418 red >>= shift;
3419 green >>= shift;
3420 blue >>= shift;
3421 } else if((sizeof(gx_color_value) * 8) < nbits) {
3422 shift = nbits - (sizeof(gx_color_value) * 8);
3423 red <<= shift;
3424 green <<= shift;
3425 blue <<= shift;
3426 }
3427 red &= mask;
3428 green &= mask;
3429 blue &= mask;
3430 if(red == green && green == blue && red != 0 && red != mask) {
3431 if(red == 5 || red == 10) {
3432 if(bdev->ldepth < 1)
3433 bdev->ldepth = 1;
3434 } else {
3435 if(bdev->ldepth < 2)
3436 bdev->ldepth = 2;
3437 }
3438 } else
3439 bdev->ldepth = 3;
3440 bdev->cmapcall = 1;
3441 return ((((blue<<4)|green)<<4)|red);
3442 }