typedef unsigned char __u_char; typedef unsigned short int __u_short; typedef unsigned int __u_int; typedef unsigned long int __u_long; typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; __extension__ typedef long long int __quad_t; __extension__ typedef unsigned long long int __u_quad_t; __extension__ typedef __u_quad_t __dev_t; __extension__ typedef unsigned int __uid_t; __extension__ typedef unsigned int __gid_t; __extension__ typedef unsigned long int __ino_t; __extension__ typedef __u_quad_t __ino64_t; __extension__ typedef unsigned int __mode_t; __extension__ typedef unsigned int __nlink_t; __extension__ typedef long int __off_t; __extension__ typedef __quad_t __off64_t; __extension__ typedef int __pid_t; __extension__ typedef struct { int __val[2]; } __fsid_t; __extension__ typedef long int __clock_t; __extension__ typedef unsigned long int __rlim_t; __extension__ typedef __u_quad_t __rlim64_t; __extension__ typedef unsigned int __id_t; __extension__ typedef long int __time_t; __extension__ typedef unsigned int __useconds_t; __extension__ typedef long int __suseconds_t; __extension__ typedef int __daddr_t; __extension__ typedef long int __swblk_t; __extension__ typedef int __key_t; __extension__ typedef int __clockid_t; __extension__ typedef void * __timer_t; __extension__ typedef long int __blksize_t; __extension__ typedef long int __blkcnt_t; __extension__ typedef __quad_t __blkcnt64_t; __extension__ typedef unsigned long int __fsblkcnt_t; __extension__ typedef __u_quad_t __fsblkcnt64_t; __extension__ typedef unsigned long int __fsfilcnt_t; __extension__ typedef __u_quad_t __fsfilcnt64_t; __extension__ typedef int __ssize_t; typedef __off64_t __loff_t; typedef __quad_t *__qaddr_t; typedef char *__caddr_t; __extension__ typedef int __intptr_t; __extension__ typedef unsigned int __socklen_t; typedef __u_char u_char; typedef __u_short u_short; typedef __u_int u_int; typedef __u_long u_long; typedef __quad_t quad_t; typedef __u_quad_t u_quad_t; typedef __fsid_t fsid_t; typedef __loff_t loff_t; typedef __ino_t ino_t; typedef __ino64_t ino64_t; typedef __dev_t dev_t; typedef __gid_t gid_t; typedef __mode_t mode_t; typedef __nlink_t nlink_t; typedef __uid_t uid_t; typedef __off_t off_t; typedef __off64_t off64_t; typedef __pid_t pid_t; typedef __id_t id_t; typedef __ssize_t ssize_t; typedef __daddr_t daddr_t; typedef __caddr_t caddr_t; typedef __key_t key_t; typedef __time_t time_t; typedef __clockid_t clockid_t; typedef __timer_t timer_t; typedef unsigned int size_t; typedef unsigned long int ulong_; typedef unsigned short int ushort_; typedef unsigned int uint_; typedef int int8_t __attribute__ ((__mode__ (__QI__))); typedef int int16_t __attribute__ ((__mode__ (__HI__))); typedef int int32_t __attribute__ ((__mode__ (__SI__))); typedef int int64_t __attribute__ ((__mode__ (__DI__))); typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); typedef int register_t __attribute__ ((__mode__ (__word__))); typedef int __sig_atomic_t; typedef struct { unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; } __sigset_t; typedef __sigset_t sigset_t; struct timespec { __time_t tv_sec; long int tv_nsec; }; struct timeval { __time_t tv_sec; __suseconds_t tv_usec; }; typedef __suseconds_t suseconds_t; typedef long int __fd_mask; typedef struct { __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))]; } fd_set; typedef __fd_mask fd_mask; extern int select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, struct timeval *__restrict __timeout); extern int pselect (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, const struct timespec *__restrict __timeout, const __sigset_t *__restrict __sigmask); __extension__ extern unsigned int gnu_dev_major (unsigned long long int __dev) __attribute__ ((__nothrow__)); __extension__ extern unsigned int gnu_dev_minor (unsigned long long int __dev) __attribute__ ((__nothrow__)); __extension__ extern unsigned long long int gnu_dev_makedev (unsigned int __major, unsigned int __minor) __attribute__ ((__nothrow__)); __extension__ extern __inline unsigned int __attribute__ ((__nothrow__)) gnu_dev_major (unsigned long long int __dev) { return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); } __extension__ extern __inline unsigned int __attribute__ ((__nothrow__)) gnu_dev_minor (unsigned long long int __dev) { return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); } __extension__ extern __inline unsigned long long int __attribute__ ((__nothrow__)) gnu_dev_makedev (unsigned int __major, unsigned int __minor) { return ((__minor & 0xff) | ((__major & 0xfff) << 8) | (((unsigned long long int) (__minor & ~0xff)) << 12) | (((unsigned long long int) (__major & ~0xfff)) << 32)); } typedef __blkcnt_t blkcnt_t; typedef __fsblkcnt_t fsblkcnt_t; typedef __fsfilcnt_t fsfilcnt_t; typedef __blkcnt64_t blkcnt64_t; typedef __fsblkcnt64_t fsblkcnt64_t; typedef __fsfilcnt64_t fsfilcnt64_t; typedef unsigned long int pthread_t; typedef union { char __size[36]; long int __align; } pthread_attr_t; typedef struct __pthread_internal_slist { struct __pthread_internal_slist *__next; } __pthread_slist_t; typedef union { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; int __kind; unsigned int __nusers; __extension__ union { int __spins; __pthread_slist_t __list; }; } __data; char __size[24]; long int __align; } pthread_mutex_t; typedef union { char __size[4]; long int __align; } pthread_mutexattr_t; typedef union { struct { int __lock; unsigned int __futex; __extension__ unsigned long long int __total_seq; __extension__ unsigned long long int __wakeup_seq; __extension__ unsigned long long int __woken_seq; void *__mutex; unsigned int __nwaiters; unsigned int __broadcast_seq; } __data; char __size[48]; __extension__ long long int __align; } pthread_cond_t; typedef union { char __size[4]; long int __align; } pthread_condattr_t; typedef unsigned int pthread_key_t; typedef int pthread_once_t; typedef union { struct { int __lock; unsigned int __nr_readers; unsigned int __readers_wakeup; unsigned int __writer_wakeup; unsigned int __nr_readers_queued; unsigned int __nr_writers_queued; unsigned char __flags; unsigned char __shared; unsigned char __pad1; unsigned char __pad2; pthread_t __writer; } __data; char __size[32]; long int __align; } pthread_rwlock_t; typedef union { char __size[8]; long int __align; } pthread_rwlockattr_t; typedef volatile int pthread_spinlock_t; typedef union { char __size[20]; long int __align; } pthread_barrier_t; typedef union { char __size[4]; int __align; } pthread_barrierattr_t; typedef int bool; typedef const char *ptr_ord_t; typedef double floatp; typedef const char *client_name_t; typedef unsigned short bits16; typedef unsigned int bits32; struct _IO_FILE; typedef struct _IO_FILE FILE; typedef struct _IO_FILE __FILE; typedef struct { int __count; union { unsigned int __wch; char __wchb[4]; } __value; } __mbstate_t; typedef struct { __off_t __pos; __mbstate_t __state; } _G_fpos_t; typedef struct { __off64_t __pos; __mbstate_t __state; } _G_fpos64_t; typedef int _G_int16_t __attribute__ ((__mode__ (__HI__))); typedef int _G_int32_t __attribute__ ((__mode__ (__SI__))); typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__))); typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__))); typedef __builtin_va_list __gnuc_va_list; struct _IO_jump_t; struct _IO_FILE; typedef void _IO_lock_t; struct _IO_marker { struct _IO_marker *_next; struct _IO_FILE *_sbuf; int _pos; }; enum __codecvt_result { __codecvt_ok, __codecvt_partial, __codecvt_error, __codecvt_noconv }; struct _IO_FILE { int _flags; char* _IO_read_ptr; char* _IO_read_end; char* _IO_read_base; char* _IO_write_base; char* _IO_write_ptr; char* _IO_write_end; char* _IO_buf_base; char* _IO_buf_end; char *_IO_save_base; char *_IO_backup_base; char *_IO_save_end; struct _IO_marker *_markers; struct _IO_FILE *_chain; int _fileno; int _flags2; __off_t _old_offset; unsigned short _cur_column; signed char _vtable_offset; char _shortbuf[1]; _IO_lock_t *_lock; __off64_t _offset; void *__pad1; void *__pad2; void *__pad3; void *__pad4; size_t __pad5; int _mode; char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; }; typedef struct _IO_FILE _IO_FILE; struct _IO_FILE_plus; extern struct _IO_FILE_plus _IO_2_1_stdin_; extern struct _IO_FILE_plus _IO_2_1_stdout_; extern struct _IO_FILE_plus _IO_2_1_stderr_; typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf, size_t __n); typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); typedef int __io_close_fn (void *__cookie); extern int __underflow (_IO_FILE *); extern int __uflow (_IO_FILE *); extern int __overflow (_IO_FILE *, int); extern int _IO_getc (_IO_FILE *__fp); extern int _IO_putc (int __c, _IO_FILE *__fp); extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__)); extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__)); extern int _IO_peekc_locked (_IO_FILE *__fp); extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__)); extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__)); extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__)); extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, __gnuc_va_list, int *__restrict); extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, __gnuc_va_list); extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__)); typedef _G_fpos_t fpos_t; typedef _G_fpos64_t fpos64_t; extern struct _IO_FILE *stdin; extern struct _IO_FILE *stdout; extern struct _IO_FILE *stderr; extern int remove (__const char *__filename) __attribute__ ((__nothrow__)); extern int rename (__const char *__old, __const char *__new) __attribute__ ((__nothrow__)); extern FILE *tmpfile (void) ; extern FILE *tmpfile64 (void) ; extern char *tmpnam (char *__s) __attribute__ ((__nothrow__)) ; extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__)) ; extern char *tempnam (__const char *__dir, __const char *__pfx) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ; extern int fclose (FILE *__stream); extern int fflush (FILE *__stream); extern int fflush_unlocked (FILE *__stream); extern FILE *fopen (__const char *__restrict __filename, __const char *__restrict __modes) ; extern FILE *freopen (__const char *__restrict __filename, __const char *__restrict __modes, FILE *__restrict __stream) ; extern FILE *fopen64 (__const char *__restrict __filename, __const char *__restrict __modes) ; extern FILE *freopen64 (__const char *__restrict __filename, __const char *__restrict __modes, FILE *__restrict __stream) ; extern FILE *fdopen (int __fd, __const char *__modes) __attribute__ ((__nothrow__)) ; extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__)); extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, int __modes, size_t __n) __attribute__ ((__nothrow__)); extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, size_t __size) __attribute__ ((__nothrow__)); extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__)); extern int fprintf (FILE *__restrict __stream, __const char *__restrict __format, ...); extern int printf (__const char *__restrict __format, ...); extern int sprintf (char *__restrict __s, __const char *__restrict __format, ...) __attribute__ ((__nothrow__)); extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format, __gnuc_va_list __arg); extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg); extern int vsprintf (char *__restrict __s, __const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__nothrow__)); extern int snprintf (char *__restrict __s, size_t __maxlen, __const char *__restrict __format, ...) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); extern int vsnprintf (char *__restrict __s, size_t __maxlen, __const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); extern int fscanf (FILE *__restrict __stream, __const char *__restrict __format, ...) ; extern int scanf (__const char *__restrict __format, ...) ; extern int sscanf (__const char *__restrict __s, __const char *__restrict __format, ...) __attribute__ ((__nothrow__)); extern int fgetc (FILE *__stream); extern int getc (FILE *__stream); extern int getchar (void); extern int getc_unlocked (FILE *__stream); extern int getchar_unlocked (void); extern int fgetc_unlocked (FILE *__stream); extern int fputc (int __c, FILE *__stream); extern int putc (int __c, FILE *__stream); extern int putchar (int __c); extern int fputc_unlocked (int __c, FILE *__stream); extern int putc_unlocked (int __c, FILE *__stream); extern int putchar_unlocked (int __c); extern int getw (FILE *__stream); extern int putw (int __w, FILE *__stream); extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) ; extern char *gets (char *__s) ; extern int fputs (__const char *__restrict __s, FILE *__restrict __stream); extern int puts (__const char *__s); extern int ungetc (int __c, FILE *__stream); extern size_t fread (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) ; extern size_t fwrite (__const void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __s) ; extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) ; extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) ; extern int fseek (FILE *__stream, long int __off, int __whence); extern long int ftell (FILE *__stream) ; extern void rewind (FILE *__stream); extern int fseeko (FILE *__stream, __off_t __off, int __whence); extern __off_t ftello (FILE *__stream) ; extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); extern int fsetpos (FILE *__stream, __const fpos_t *__pos); extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence); extern __off64_t ftello64 (FILE *__stream) ; extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos); extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos); extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__)); extern int feof (FILE *__stream) __attribute__ ((__nothrow__)) ; extern int ferror (FILE *__stream) __attribute__ ((__nothrow__)) ; extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__)); extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ; extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ; extern void perror (__const char *__s); extern int sys_nerr; extern __const char *__const sys_errlist[]; extern int fileno (FILE *__stream) __attribute__ ((__nothrow__)) ; extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ; extern FILE *popen (__const char *__command, __const char *__modes) ; extern int pclose (FILE *__stream); extern char *ctermid (char *__s) __attribute__ ((__nothrow__)); extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__)); extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__)) ; extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__)); extern __inline int vprintf (__const char *__restrict __fmt, __gnuc_va_list __arg) { return vfprintf (stdout, __fmt, __arg); } extern __inline int getchar (void) { return _IO_getc (stdin); } extern __inline int fgetc_unlocked (FILE *__fp) { return (__builtin_expect (((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end), 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++); } extern __inline int getc_unlocked (FILE *__fp) { return (__builtin_expect (((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end), 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++); } extern __inline int getchar_unlocked (void) { return (__builtin_expect (((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end), 0) ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++); } extern __inline int putchar (int __c) { return _IO_putc (__c, stdout); } extern __inline int fputc_unlocked (int __c, FILE *__stream) { return (__builtin_expect (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end), 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c))); } extern __inline int putc_unlocked (int __c, FILE *__stream) { return (__builtin_expect (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end), 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c))); } extern __inline int putchar_unlocked (int __c) { return (__builtin_expect (((stdout)->_IO_write_ptr >= (stdout)->_IO_write_end), 0) ? __overflow (stdout, (unsigned char) (__c)) : (unsigned char) (*(stdout)->_IO_write_ptr++ = (__c))); } extern __inline int __attribute__ ((__nothrow__)) feof_unlocked (FILE *__stream) { return (((__stream)->_flags & 0x10) != 0); } extern __inline int __attribute__ ((__nothrow__)) ferror_unlocked (FILE *__stream) { return (((__stream)->_flags & 0x20) != 0); } typedef struct gs_memory_s gs_memory_t; int outwrite(const gs_memory_t *mem, const char *str, int len); int errwrite(const char *str, int len); void outflush(const gs_memory_t *mem); void errflush(void); int outprintf(const gs_memory_t *mem, const char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3))); int errprintf(const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2))); void dprintf_file_and_line(const char *, int); void dflush(void); void printf_program_ident(const gs_memory_t *mem, const char *program_name, long revision_number); void eprintf_program_ident(const char *program_name, long revision_number); const char *gs_program_name(void); long gs_revision_number(void); void lprintf_file_and_line(const char *, int); extern void *memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memmove (void *__dest, __const void *__src, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memccpy (void *__restrict __dest, __const void *__restrict __src, int __c, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); extern int memcmp (__const void *__s1, __const void *__s2, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memchr (__const void *__s, int __c, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *strcpy (char *__restrict __dest, __const char *__restrict __src) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strncpy (char *__restrict __dest, __const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strcat (char *__restrict __dest, __const char *__restrict __src) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strncat (char *__restrict __dest, __const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern int strcmp (__const char *__s1, __const char *__s2) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strncmp (__const char *__s1, __const char *__s2, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strcoll (__const char *__s1, __const char *__s2) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern size_t strxfrm (char *__restrict __dest, __const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2))); extern char *strdup (__const char *__s) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); extern char *strchr (__const char *__s, int __c) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *strrchr (__const char *__s, int __c) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern size_t strcspn (__const char *__s, __const char *__reject) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern size_t strspn (__const char *__s, __const char *__accept) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strpbrk (__const char *__s, __const char *__accept) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strstr (__const char *__haystack, __const char *__needle) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strtok (char *__restrict __s, __const char *__restrict __delim) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2))); extern char *__strtok_r (char *__restrict __s, __const char *__restrict __delim, char **__restrict __save_ptr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3))); extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim, char **__restrict __save_ptr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3))); extern size_t strlen (__const char *__s) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *strerror (int __errnum) __attribute__ ((__nothrow__)); extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2))); extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); extern void bcopy (__const void *__src, void *__dest, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); extern int bcmp (__const void *__s1, __const void *__s2, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *index (__const char *__s, int __c) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *rindex (__const char *__s, int __c) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern int ffs (int __i) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern int strcasecmp (__const char *__s1, __const char *__s2) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strsep (char **__restrict __stringp, __const char *__restrict __delim) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); typedef struct { unsigned char __arr[2]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR2; typedef struct { unsigned char __arr[3]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR3; typedef struct { unsigned char __arr[4]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR4; typedef struct { unsigned char __arr[5]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR5; typedef struct { unsigned char __arr[6]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR6; typedef struct { unsigned char __arr[7]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR7; typedef struct { unsigned char __arr[8]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR8; extern void *__rawmemchr (const void *__s, int __c); extern __inline size_t __strcspn_c1 (__const char *__s, int __reject); extern __inline size_t __strcspn_c1 (__const char *__s, int __reject) { register size_t __result = 0; while (__s[__result] != '\0' && __s[__result] != __reject) ++__result; return __result; } extern __inline size_t __strcspn_c2 (__const char *__s, int __reject1, int __reject2); extern __inline size_t __strcspn_c2 (__const char *__s, int __reject1, int __reject2) { register size_t __result = 0; while (__s[__result] != '\0' && __s[__result] != __reject1 && __s[__result] != __reject2) ++__result; return __result; } extern __inline size_t __strcspn_c3 (__const char *__s, int __reject1, int __reject2, int __reject3); extern __inline size_t __strcspn_c3 (__const char *__s, int __reject1, int __reject2, int __reject3) { register size_t __result = 0; while (__s[__result] != '\0' && __s[__result] != __reject1 && __s[__result] != __reject2 && __s[__result] != __reject3) ++__result; return __result; } extern __inline size_t __strspn_c1 (__const char *__s, int __accept); extern __inline size_t __strspn_c1 (__const char *__s, int __accept) { register size_t __result = 0; while (__s[__result] == __accept) ++__result; return __result; } extern __inline size_t __strspn_c2 (__const char *__s, int __accept1, int __accept2); extern __inline size_t __strspn_c2 (__const char *__s, int __accept1, int __accept2) { register size_t __result = 0; while (__s[__result] == __accept1 || __s[__result] == __accept2) ++__result; return __result; } extern __inline size_t __strspn_c3 (__const char *__s, int __accept1, int __accept2, int __accept3); extern __inline size_t __strspn_c3 (__const char *__s, int __accept1, int __accept2, int __accept3) { register size_t __result = 0; while (__s[__result] == __accept1 || __s[__result] == __accept2 || __s[__result] == __accept3) ++__result; return __result; } extern __inline char *__strpbrk_c2 (__const char *__s, int __accept1, int __accept2); extern __inline char * __strpbrk_c2 (__const char *__s, int __accept1, int __accept2) { while (*__s != '\0' && *__s != __accept1 && *__s != __accept2) ++__s; return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s; } extern __inline char *__strpbrk_c3 (__const char *__s, int __accept1, int __accept2, int __accept3); extern __inline char * __strpbrk_c3 (__const char *__s, int __accept1, int __accept2, int __accept3) { while (*__s != '\0' && *__s != __accept1 && *__s != __accept2 && *__s != __accept3) ++__s; return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s; } extern __inline char *__strtok_r_1c (char *__s, char __sep, char **__nextp); extern __inline char * __strtok_r_1c (char *__s, char __sep, char **__nextp) { char *__result; if (__s == ((void *)0)) __s = *__nextp; while (*__s == __sep) ++__s; __result = ((void *)0); if (*__s != '\0') { __result = __s++; while (*__s != '\0') if (*__s++ == __sep) { __s[-1] = '\0'; break; } *__nextp = __s; } return __result; } extern char *__strsep_g (char **__stringp, __const char *__delim); extern __inline char *__strsep_1c (char **__s, char __reject); extern __inline char * __strsep_1c (char **__s, char __reject) { register char *__retval = *__s; 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)) *(*__s)++ = '\0'; return __retval; } extern __inline char *__strsep_2c (char **__s, char __reject1, char __reject2); extern __inline char * __strsep_2c (char **__s, char __reject1, char __reject2) { register char *__retval = *__s; if (__retval != ((void *)0)) { register char *__cp = __retval; while (1) { if (*__cp == '\0') { __cp = ((void *)0); break; } if (*__cp == __reject1 || *__cp == __reject2) { *__cp++ = '\0'; break; } ++__cp; } *__s = __cp; } return __retval; } extern __inline char *__strsep_3c (char **__s, char __reject1, char __reject2, char __reject3); extern __inline char * __strsep_3c (char **__s, char __reject1, char __reject2, char __reject3) { register char *__retval = *__s; if (__retval != ((void *)0)) { register char *__cp = __retval; while (1) { if (*__cp == '\0') { __cp = ((void *)0); break; } if (*__cp == __reject1 || *__cp == __reject2 || *__cp == __reject3) { *__cp++ = '\0'; break; } ++__cp; } *__s = __cp; } return __retval; } extern void *malloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ; extern void *calloc (size_t __nmemb, size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ; extern char *__strdup (__const char *__string) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)); extern char *__strndup (__const char *__string, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)); int unlink(const char *); int gs_log_error(int, const char *, int); const char *gs_errstr(int code); int gs_throw_imp(const char *func, const char *file, int line, int op, int code, const char *fmt, ...) __attribute__((__format__ (__printf__, 6, 7))); typedef unsigned long gs_id; typedef struct gs_string_s { unsigned char *data; unsigned int size; } gs_string; typedef struct gs_const_string_s { const unsigned char *data; unsigned int size; } gs_const_string; typedef struct gs_param_string_s { const unsigned char *data; unsigned int size; bool persistent; } gs_param_string; typedef struct gs_bytestring_s { unsigned char *data; unsigned int size; unsigned char *bytes; } gs_bytestring; typedef struct gs_const_bytestring_s { const unsigned char *data; unsigned int size; const unsigned char *bytes; } gs_const_bytestring; typedef struct gs_point_s { double x, y; } gs_point; typedef struct gs_int_point_s { int x, y; } gs_int_point; typedef struct gs_log2_scale_point_s { int x, y; } gs_log2_scale_point; typedef struct gs_rect_s { gs_point p, q; } gs_rect; typedef struct gs_int_rect_s { gs_int_point p, q; } gs_int_rect; typedef struct gs_range_s { float rmin, rmax; } gs_range_t; typedef struct name_table_s *name_table_ptr; typedef struct gs_lib_ctx_s { gs_memory_t *memory; FILE *fstdin; FILE *fstdout; FILE *fstderr; FILE *fstdout2; bool stdout_is_redirected; bool stdout_to_stderr; bool stdin_is_interactive; void *caller_handle; void *custom_color_callback; int ( *stdin_fn)(void *caller_handle, char *buf, int len); int ( *stdout_fn)(void *caller_handle, const char *str, int len); int ( *stderr_fn)(void *caller_handle, const char *str, int len); int ( *poll_fn)(void *caller_handle); unsigned long gs_next_id; void *top_of_system; name_table_ptr gs_name_table; bool dict_auto_expand; } gs_lib_ctx_t; int gs_lib_ctx_init( gs_memory_t *mem ); void *gs_lib_ctx_get_interp_instance( gs_memory_t *mem ); gs_memory_t * gs_lib_ctx_get_non_gc_memory_t(void); typedef struct gs_memory_struct_type_s gs_memory_struct_type_t; typedef const gs_memory_struct_type_t *gs_memory_type_ptr_t; typedef struct gs_ptr_procs_s gs_ptr_procs_t; typedef const gs_ptr_procs_t *gs_ptr_type_t; typedef struct gs_gc_root_s gs_gc_root_t; typedef client_name_t struct_name_t; unsigned int gs_struct_type_size(gs_memory_type_ptr_t); struct_name_t gs_struct_type_name(gs_memory_type_ptr_t); typedef struct gs_memory_status_s { unsigned long allocated; unsigned long used; } gs_memory_status_t; typedef struct gs_memory_procs_s { 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); unsigned char *(*alloc_bytes)(gs_memory_t *mem, unsigned int nbytes, client_name_t cname); void *(*alloc_struct)(gs_memory_t *mem, gs_memory_type_ptr_t pstype, client_name_t cname); void *(*alloc_struct_immovable)(gs_memory_t *mem, gs_memory_type_ptr_t pstype, client_name_t cname); unsigned char *(*alloc_byte_array)(gs_memory_t *mem, unsigned int num_elements, unsigned int elt_size, client_name_t cname); unsigned char *(*alloc_byte_array_immovable)(gs_memory_t *mem, unsigned int num_elements, unsigned int elt_size, client_name_t cname); void *(*alloc_struct_array)(gs_memory_t *mem, unsigned int num_elements, gs_memory_type_ptr_t pstype, client_name_t cname); void *(*alloc_struct_array_immovable)(gs_memory_t *mem, unsigned int num_elements, gs_memory_type_ptr_t pstype, client_name_t cname); unsigned int (*object_size)(gs_memory_t *mem, const void *obj); gs_memory_type_ptr_t (*object_type)(const gs_memory_t *mem, const void *obj); unsigned char *(*alloc_string)(gs_memory_t *mem, unsigned int nbytes, client_name_t cname); unsigned char *(*alloc_string_immovable)(gs_memory_t *mem, unsigned int nbytes, client_name_t cname); unsigned char *(*resize_string)(gs_memory_t *mem, unsigned char *data, unsigned int old_num, unsigned int new_num, client_name_t cname); void (*free_string)(gs_memory_t *mem, unsigned char *data, unsigned int nbytes, client_name_t cname); int (*register_root)(gs_memory_t *mem, gs_gc_root_t *root, gs_ptr_type_t ptype, void **pp, client_name_t cname); void (*unregister_root)(gs_memory_t *mem, gs_gc_root_t *root, client_name_t cname); void (*enable_free)(gs_memory_t *mem, bool enable); } gs_memory_procs_t; void gs_free_const_object(gs_memory_t *mem, const void *data, client_name_t cname); void gs_free_const_string(gs_memory_t *mem, const unsigned char *data, unsigned int nbytes, client_name_t cname); void gs_free_bytestring(gs_memory_t *mem, gs_bytestring *pbs, client_name_t cname); void gs_free_const_bytestring(gs_memory_t *mem, gs_const_bytestring *pbs, client_name_t cname); void *gs_resize_struct_array(gs_memory_t *mem, void *obj, unsigned int num_elements, gs_memory_type_ptr_t pstype, client_name_t cname); int gs_register_struct_root(gs_memory_t *mem, gs_gc_root_t *root, void **pp, client_name_t cname); void gs_ignore_free_object(gs_memory_t *mem, void *data, client_name_t cname); void gs_ignore_free_string(gs_memory_t *mem, unsigned char *data, unsigned int nbytes, client_name_t cname); void gs_ignore_consolidate_free(gs_memory_t *mem); void *gs_raw_alloc_struct_immovable(gs_memory_t * rmem, gs_memory_type_ptr_t pstype, client_name_t cname); typedef struct pl_mem_node_s pl_mem_node_t; struct gs_memory_s { 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; }; extern char gs_debug[128]; bool gs_debug_c(int ); extern FILE *gs_debug_out; void debug_dump_bytes(const unsigned char * from, const unsigned char * to, const char *msg); void debug_dump_bitmap(const unsigned char * from, unsigned int raster, unsigned int height, const char *msg); void debug_print_string(const unsigned char * str, unsigned int len); void debug_print_string_hex(const unsigned char * str, unsigned int len); typedef struct gs_imager_state_s gs_imager_state; typedef struct gs_state_s gs_state; int gp_getenv(const char *key, char *ptr, int *plen); typedef struct stream_s stream; 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 *)); typedef unsigned char uint8_t; typedef unsigned short int uint16_t; typedef unsigned int uint32_t; __extension__ typedef unsigned long long int uint64_t; typedef signed char int_least8_t; typedef short int int_least16_t; typedef int int_least32_t; __extension__ typedef long long int int_least64_t; typedef unsigned char uint_least8_t; typedef unsigned short int uint_least16_t; typedef unsigned int uint_least32_t; __extension__ typedef unsigned long long int uint_least64_t; typedef signed char int_fast8_t; typedef int int_fast16_t; typedef int int_fast32_t; __extension__ typedef long long int int_fast64_t; typedef unsigned char uint_fast8_t; typedef unsigned int uint_fast16_t; typedef unsigned int uint_fast32_t; __extension__ typedef unsigned long long int uint_fast64_t; typedef int intptr_t; typedef unsigned int uintptr_t; __extension__ typedef long long int intmax_t; __extension__ typedef unsigned long long int uintmax_t; void gp_init(void); void gp_exit(int exit_status, int code); void gp_do_exit(int exit_status); const char *gp_strerror(int); void gp_get_realtime(long ptm[2]); void gp_get_usertime(long ptm[2]); int gp_readline_init(void **preadline_data, gs_memory_t *mem); int gp_readline(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 *)); void gp_readline_finit(void *readline_data); int gp_stdin_read(char *buf, int len, int interactive, FILE *f); const char *gp_getenv_display(void); extern const char gp_file_name_list_separator; extern const char gp_scratch_file_name_prefix[]; extern const char gp_null_file_name[]; extern const char gp_current_directory_name[]; extern const char gp_fmode_binary_suffix[]; extern const char gp_fmode_rb[]; extern const char gp_fmode_wb[]; FILE *gp_open_scratch_file(const char *prefix, char fname[260], const char *mode); FILE *gp_fopen(const char *fname, const char *mode); int gp_setmode_binary(FILE * pfile, bool mode); typedef enum { gp_combine_small_buffer = -1, gp_combine_cant_handle = 0, gp_combine_success = 1 } gp_file_name_combine_result; gp_file_name_combine_result gp_file_name_combine(const char *prefix, unsigned int plen, const char *fname, unsigned int flen, bool no_sibling, char *buffer, unsigned int *blen); unsigned int gp_file_name_root(const char *fname, unsigned int len); unsigned int gs_file_name_check_separator(const char *fname, int len, const char *item); bool gp_file_name_is_parent(const char *fname, unsigned int len); bool gp_file_name_is_current(const char *fname, unsigned int len); const char *gp_file_name_current(void); const char *gp_file_name_separator(void); const char *gp_file_name_directory_separator(void); const char *gp_file_name_parent(void); bool gp_file_name_is_partent_allowed(void); bool gp_file_name_is_empty_item_meanful(void); int gp_read_macresource(unsigned char *buf, const char *fname, const unsigned int type, const unsigned short id); int gp_cache_insert(int type, unsigned char *key, int keylen, void *buffer, int buflen); typedef void *(*gp_cache_alloc)(void *userdata, int bytes); int gp_cache_query(int type, unsigned char* key, int keylen, void **buffer, gp_cache_alloc alloc, void *userdata); FILE *gp_open_printer(char fname[260], int binary_mode); void gp_close_printer(FILE * pfile, const char *fname); typedef struct file_enum_s file_enum; file_enum *gp_enumerate_files_init(const char *pat, unsigned int patlen, gs_memory_t * memory); unsigned int gp_enumerate_files_next(file_enum * pfen, char *ptr, unsigned int maxlen); void gp_enumerate_files_close(file_enum * pfen); void *gp_enumerate_fonts_init(gs_memory_t *mem); int gp_enumerate_fonts_next(void *enum_state, char **fontname, char **path); void gp_enumerate_fonts_free(void *enum_state); FILE *gp_fopen_64(const char *filename, const char *mode); FILE *gp_open_scratch_file_64(const char *prefix, char fname[260], const char *mode); FILE *gp_open_printer_64(char fname[260], int binary_mode); int64_t gp_ftell_64(FILE *strm); int gp_fseek_64(FILE *strm, int64_t offset, int origin); struct gs_matrix_s { float xx, xy, yx, yy, tx, ty; }; struct gs_matrix_double_s { double xx, xy, yx, yy, tx, ty; }; typedef struct gs_matrix_s gs_matrix; typedef struct gs_matrix_double_s gs_matrix_double; void gs_make_identity(gs_matrix *); int gs_make_translation(floatp, floatp, gs_matrix *), gs_make_scaling(floatp, floatp, gs_matrix *), gs_make_rotation(floatp, gs_matrix *); int gs_matrix_multiply(const gs_matrix *, const gs_matrix *, gs_matrix *), gs_matrix_multiply_double(const gs_matrix_double *, const gs_matrix *, gs_matrix_double *), gs_matrix_invert(const gs_matrix *, gs_matrix *), gs_matrix_invert_to_double(const gs_matrix *, gs_matrix_double *), gs_matrix_translate(const gs_matrix *, floatp, floatp, gs_matrix *), gs_matrix_scale(const gs_matrix *, floatp, floatp, gs_matrix *), gs_matrix_rotate(const gs_matrix *, floatp, gs_matrix *); int gs_point_transform(floatp, floatp, const gs_matrix *, gs_point *), gs_point_transform_inverse(floatp, floatp, const gs_matrix *, gs_point *), gs_distance_transform(floatp, floatp, const gs_matrix *, gs_point *), gs_distance_transform_inverse(floatp, floatp, const gs_matrix *, gs_point *), gs_points_bbox(const gs_point[4], gs_rect *), gs_bbox_transform_only(const gs_rect *, const gs_matrix *, gs_point[4]), gs_bbox_transform(const gs_rect *, const gs_matrix *, gs_rect *), gs_bbox_transform_inverse(const gs_rect *, const gs_matrix *, gs_rect *); int sget_matrix(stream *, gs_matrix *); int sput_matrix(stream *, const gs_matrix *); gs_id gs_next_ids(const gs_memory_t *mem, unsigned int count); void memflip8x8(const unsigned char * inp, int line_size, unsigned char * outp, int dist); unsigned long get_u32_msb(const unsigned char *p); int bytes_compare(const unsigned char * str1, unsigned int len1, const unsigned char * str2, unsigned int len2); typedef struct string_match_params_s { int any_substring; int any_char; int quote_next; bool ignore_case; bool slash_equiv; } string_match_params; extern const string_match_params string_match_params_default; bool string_match(const unsigned char * str, unsigned int len, const unsigned char * pstr, unsigned int plen, const string_match_params * psmp); typedef enum { GS_DEVICE_DOESNT_SUPPORT_TAGS = 0, GS_UNKNOWN_TAG = 0x1, GS_TEXT_TAG = 0x2, GS_IMAGE_TAG = 0x4, GS_PATH_TAG = 0x8, GS_UNTOUCHED_TAG = 0x10 } gs_object_tag_type_t; gs_object_tag_type_t gs_current_object_tag(void); typedef struct gc_state_s gc_state_t; typedef struct enum_ptr_s { const void *ptr; unsigned int size; } enum_ptr_t; typedef struct struct_shared_procs_s struct_shared_procs_t; struct gs_memory_struct_type_s { unsigned int ssize; struct_name_t sname; const struct_shared_procs_t *shared; void (*clear_marks)(const gs_memory_t *cmem, void *pre, unsigned int size, const gs_memory_struct_type_t *pstype); 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); void (*reloc_ptrs)(void *ptr, unsigned int size, const gs_memory_struct_type_t *pstype, gc_state_t *gcst); void (*finalize)(void *ptr); const void *proc_data; }; typedef struct gs_pattern_instance_s gs_pattern_instance_t; typedef struct gs_paint_color_s { float values[(8)]; } gs_paint_color; typedef struct gs_client_color_s gs_client_color; struct gs_client_color_s { gs_pattern_instance_t *pattern; gs_paint_color paint; }; extern const gs_memory_struct_type_t st_client_color; typedef struct gx_image_type_s gx_image_type_t; typedef struct gs_image_common_s { const gx_image_type_t *type; gs_matrix ImageMatrix; } gs_image_common_t; typedef struct gs_data_image_s { const gx_image_type_t *type; gs_matrix ImageMatrix; int Width; int Height; int BitsPerComponent; float Decode[((8) + 1) * 2]; bool Interpolate; } gs_data_image_t; typedef enum { gs_image_format_chunky = 0, gs_image_format_component_planar = 1, gs_image_format_bit_planar = 2 } gs_image_format_t; typedef struct gs_color_space_s gs_color_space; typedef struct gs_pixel_image_s { 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; } gs_pixel_image_t; extern const gs_memory_struct_type_t st_gs_pixel_image; typedef enum { gs_image_alpha_none = 0, gs_image_alpha_first, gs_image_alpha_last } gs_image_alpha_t; typedef struct gs_image1_s { 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; bool ImageMask; bool adjust; gs_image_alpha_t Alpha; } gs_image1_t; extern const gs_memory_struct_type_t st_gs_image1; typedef gs_image1_t gs_image_t; void gs_image_common_t_init(gs_image_common_t * pic), gs_data_image_t_init(gs_data_image_t * pim, int num_components), gs_pixel_image_t_init(gs_pixel_image_t * pim, gs_color_space * color_space); void gs_image_t_init_adjust(gs_image_t * pim, gs_color_space * pcs, bool adjust); void gs_image_t_init_mask_adjust(gs_image_t * pim, bool write_1s, bool adjust); typedef struct rc_header_s rc_header; struct rc_header_s { long ref_count; gs_memory_t *memory; void (*free)(gs_memory_t *, void *, client_name_t); }; void rc_free_struct_only(gs_memory_t *, void *, client_name_t); typedef enum { gs_color_space_index_DeviceGray = 0, gs_color_space_index_DeviceRGB, gs_color_space_index_DeviceCMYK, gs_color_space_index_DevicePixel, gs_color_space_index_DeviceN, gs_color_space_index_CIEDEFG, gs_color_space_index_CIEDEF, gs_color_space_index_CIEABC, gs_color_space_index_CIEA, gs_color_space_index_Separation, gs_color_space_index_Indexed, gs_color_space_index_Pattern, gs_color_space_index_CIEICC } gs_color_space_index; typedef struct gs_color_space_type_s gs_color_space_type; typedef struct gs_device_pixel_params_s { int depth; } gs_device_pixel_params; typedef struct gs_cie_a_s gs_cie_a; typedef struct gs_cie_abc_s gs_cie_abc; typedef struct gs_cie_def_s gs_cie_def; typedef struct gs_cie_defg_s gs_cie_defg; typedef struct gs_cie_icc_s gs_cie_icc; typedef struct gs_cieicc_params_s { gs_cie_icc * picc_info; } gs_icc_params; typedef struct gs_device_n_map_s gs_device_n_map; typedef struct gs_device_n_attributes_s gs_device_n_attributes; typedef unsigned long gs_separation_name; typedef int (gs_callback_func_get_colorname_string) (const gs_memory_t *mem, gs_separation_name colorname, unsigned char **ppstr, unsigned int *plen); typedef enum { SEP_NONE, SEP_ALL, SEP_OTHER } separation_type; typedef struct gs_separation_params_s { gs_separation_name sep_name; gs_device_n_map *map; separation_type sep_type; bool use_alt_cspace; gs_callback_func_get_colorname_string *get_colorname_string; } gs_separation_params; typedef struct gs_device_n_params_s { gs_separation_name *names; unsigned int num_components; gs_device_n_map *map; gs_device_n_attributes *colorants; bool use_alt_cspace; gs_callback_func_get_colorname_string *get_colorname_string; } gs_device_n_params; typedef struct client_color_space_data_s client_color_space_data_t; typedef struct gs_indexed_map_s gs_indexed_map; typedef struct gs_indexed_params_s { int hival; int n_comps; union { gs_const_string table; gs_indexed_map *map; } lookup; bool use_proc; } gs_indexed_params; typedef struct gs_pattern_params_s { bool has_base_space; } gs_pattern_params; struct gs_color_space_s { const gs_color_space_type *type; rc_header rc; gs_id id; gs_color_space *base_space; client_color_space_data_t *pclient_color_space_data; union { gs_device_pixel_params pixel; gs_cie_defg * defg; gs_cie_def * def; gs_cie_abc * abc; gs_cie_a * a; gs_separation_params separation; gs_device_n_params device_n; gs_indexed_params indexed; gs_pattern_params pattern; gs_icc_params icc; } params; }; gs_color_space *gs_cspace_new_DeviceGray(gs_memory_t *mem); gs_color_space *gs_cspace_new_DeviceRGB(gs_memory_t *mem); gs_color_space *gs_cspace_new_DeviceCMYK(gs_memory_t *mem); gs_color_space_index gs_color_space_get_index(const gs_color_space *); int gs_color_space_num_components(const gs_color_space *); bool gs_color_space_equal(const gs_color_space *pcs1, const gs_color_space *pcs2); void gs_color_space_restrict_color(gs_client_color *, const gs_color_space *); const gs_color_space *gs_cspace_base_space(const gs_color_space * pcspace); gs_memory_t *gs_state_memory(const gs_state *); gs_state *gs_state_saved(const gs_state *); gs_state *gs_state_swap_saved(gs_state *, gs_state *); gs_memory_t *gs_state_swap_memory(gs_state *, gs_memory_t *); typedef void *(*gs_state_alloc_proc_t) (gs_memory_t * mem); typedef int (*gs_state_copy_proc_t) (void *to, const void *from); typedef void (*gs_state_free_proc_t) (void *old, gs_memory_t * mem); typedef enum { copy_for_gsave, copy_for_grestore, copy_for_gstate, copy_for_setgstate, copy_for_copygstate, copy_for_currentgstate } gs_state_copy_reason_t; typedef int (*gs_state_copy_for_proc_t) (void *to, void *from, gs_state_copy_reason_t reason); typedef struct gs_state_client_procs_s { gs_state_alloc_proc_t alloc; gs_state_copy_proc_t copy; gs_state_free_proc_t free; gs_state_copy_for_proc_t copy_for; } gs_state_client_procs; void gs_state_set_client(gs_state *, void *, const gs_state_client_procs *, bool client_has_pattern_streams); void *gs_state_client_data(const gs_state *); gs_id gx_get_clip_path_id(gs_state *); void gs_set_object_tag(gs_state * pgs, const gs_object_tag_type_t tag); void gs_enable_object_tagging(void); typedef struct gs_composite_s gs_composite_t; gs_id gs_composite_id(const gs_composite_t * pcte); int imod(int m, int n); int igcd(int x, int y); int idivmod(int a, int b, int m); int ilog2(int n); typedef gs_id gs_bitmap_id; typedef struct gs_bitmap_s { unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; } gs_bitmap; typedef struct gs_const_bitmap_s { const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; } gs_const_bitmap; typedef struct gs_tile_bitmap_s { unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height; } gs_tile_bitmap; typedef struct gs_const_tile_bitmap_s { const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height; } gs_const_tile_bitmap; typedef struct gs_depth_bitmap_s { unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned char pix_depth; unsigned char num_comps; } gs_depth_bitmap; typedef struct gs_const_depth_bitmap_s { const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned char pix_depth; unsigned char num_comps; } gs_const_depth_bitmap; typedef struct gs_tile_depth_bitmap_s { 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; } gs_tile_depth_bitmap; typedef struct gs_const_tile_depth_bitmap_s { 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; } gs_const_tile_depth_bitmap; extern const gs_memory_struct_type_t st_gs_bitmap; extern const gs_memory_struct_type_t st_gs_tile_bitmap; extern const gs_memory_struct_type_t st_gs_depth_bitmap; extern const gs_memory_struct_type_t st_gs_tile_depth_bitmap; typedef gs_bitmap_id gx_bitmap_id; typedef struct gx_bitmap_s { unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; } gx_bitmap; typedef struct gx_const_bitmap_s { const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; } gx_const_bitmap; typedef struct gx_tile_bitmap_s { unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height; } gx_tile_bitmap; typedef struct gx_const_tile_bitmap_s { const unsigned char * data; int raster; gs_int_point size; gs_bitmap_id id; unsigned short rep_width, rep_height; } gx_const_tile_bitmap; typedef struct gx_strip_bitmap_s { 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; } gx_strip_bitmap; typedef struct gx_const_strip_bitmap_s { 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; } gx_const_strip_bitmap; extern const gs_memory_struct_type_t st_gx_strip_bitmap; typedef struct gx_ht_tile_s gx_ht_tile; struct gx_ht_tile_s { gx_strip_bitmap tiles; int level; unsigned int index; }; void bits_fill_rectangle(unsigned char * dest, int dest_bit, unsigned int raster, unsigned int pattern, int width_bits, int height); void bits_fill_rectangle_masked(unsigned char * dest, int dest_bit, unsigned int raster, unsigned int pattern, unsigned int src_mask, int width_bits, int height); void bits_replicate_horizontally(unsigned char * data, unsigned int width, unsigned int height, unsigned int raster, unsigned int replicated_width, unsigned int replicated_raster); void bits_replicate_vertically(unsigned char * data, unsigned int height, unsigned int raster, unsigned int replicated_height); void bits_bounding_box(const unsigned char * data, unsigned int height, unsigned int raster, gs_int_rect * pbox); void bits_compress_scaled(const unsigned char * src, int srcx, unsigned int width, unsigned int height, unsigned int sraster, unsigned char * dest, unsigned int draster, const gs_log2_scale_point * plog2_scale, int log2_out_bits); typedef struct bits_plane_s { union bpd_ { unsigned char *write; const unsigned char *read; } data; int raster; int depth; int x; } bits_plane_t; int bits_extract_plane(const bits_plane_t *dest , const bits_plane_t *source , int shift, int width, int height); int bits_expand_plane(const bits_plane_t *dest , const bits_plane_t *source , int shift, int width, int height); void bytes_fill_rectangle(unsigned char * dest, unsigned int raster, unsigned char value, int width_bytes, int height); void bytes_copy_rectangle(unsigned char * dest, unsigned int dest_raster, const unsigned char * src, unsigned int src_raster, int width_bytes, int height); typedef unsigned long long gx_color_index_data; typedef gx_color_index_data gx_color_index; typedef bits16 wts_screen_sample_t; typedef struct wts_screen_s wts_screen_t; typedef enum { WTS_SCREEN_RAT, WTS_SCREEN_J, WTS_SCREEN_H } wts_screen_type; struct wts_screen_s { wts_screen_type type; int cell_width; int cell_height; int cell_shift; wts_screen_sample_t *samples; }; typedef struct { int tag; int x; int y; int nsamples; } wts_j_cache_el; typedef struct { wts_screen_t base; int pa; int pb; int pc; int pd; int XA; int YA; int XB; int YB; int XC; int YC; int XD; int YD; wts_j_cache_el xcache[512]; wts_j_cache_el ycache[512]; } wts_screen_j_t; typedef struct { wts_screen_t base; double px; double py; int x1; int y1; } wts_screen_h_t; int wts_get_samples(wts_screen_t *ws, int x, int y, int *pcellx, int *pcelly, int *p_nsamples); typedef struct gx_device_color_s gx_device_color; typedef struct gx_device_color_saved_s gx_device_color_saved; typedef struct gx_device_halftone_s gx_device_halftone; bool gx_device_color_equal(const gx_device_color *pdevc1, const gx_device_color *pdevc2); void gx_complete_halftone(gx_device_color *pdevc, int num_comps, gx_device_halftone *pdht); typedef struct gx_color_tile_s gx_color_tile; typedef struct gx_device_color_type_s gx_device_color_type_t; typedef const gx_device_color_type_t *gx_device_color_type; struct gx_device_color_s { gx_device_color_type type; union _c { gx_color_index pure; struct _bin { const gx_device_halftone *b_ht; gx_color_index color[2]; unsigned int b_level; int b_index; gx_ht_tile *b_tile; } binary; struct _col { gx_device_halftone *c_ht; unsigned short num_components; unsigned char c_base[(8 * 8)]; unsigned int c_level[(8 * 8)]; unsigned short alpha; gx_color_index plane_mask; } colored; struct _wts { const gx_device_halftone *w_ht; wts_screen_sample_t levels[(8 * 8)]; unsigned short num_components; gx_color_index plane_vector[(8 * 8)]; } wts; struct _pat { gx_color_tile *p_tile; } pattern; } colors; gs_int_point phase; bool ccolor_valid; gs_client_color ccolor; struct _mask { struct mp_ { short x, y; } m_phase; gx_bitmap_id id; gx_color_tile *m_tile; } mask; }; struct gx_device_color_saved_s { gx_device_color_type type; union _svc { gx_color_index pure; struct _svbin { gx_color_index b_color[2]; unsigned int b_level; int b_index; } binary; struct _svcol { unsigned char c_base[(8 * 8)]; unsigned int c_level[(8 * 8)]; unsigned short alpha; } colored; struct _swts { wts_screen_sample_t levels[(8 * 8)]; } wts; struct _pattern { gs_id id; gs_int_point phase; } pattern; struct _pattern2 { gs_id id; bool shfill; } pattern2; } colors; gs_int_point phase; }; extern const gx_device_color_type_t *const gx_dc_type_none; extern const gx_device_color_type_t *const gx_dc_type_null; extern const gx_device_color_type_t *const gx_dc_type_pure; extern const gx_device_color_type_t *const gx_dc_type_ht_binary; extern const gx_device_color_type_t *const gx_dc_type_ht_colored; extern const gx_device_color_type_t *const gx_dc_type_wts; typedef enum { rop2_0 = 0, rop2_S = 0xc, rop2_D = 0xa, rop2_1 = 0xf, rop2_default = rop2_S } gs_rop2_t; typedef enum { rop3_0 = 0, rop3_T = 0xf0, rop3_S = 0xcc, rop3_D = 0xaa, rop3_1 = 0xff, rop3_default = rop3_T | rop3_S } gs_rop3_t; typedef unsigned int gs_logical_operation_t; typedef unsigned long rop_operand; typedef rop_operand (*rop_proc)(rop_operand D, rop_operand S, rop_operand T); typedef enum { rop_usage_none = 0, rop_usage_D = 1, rop_usage_S = 2, rop_usage_DS = 3, rop_usage_T = 4, rop_usage_DT = 5, rop_usage_ST = 6, rop_usage_DST = 7 } rop_usage_t; extern const rop_proc rop_proc_table[256]; extern const unsigned char rop_usage_table[256]; typedef struct obj_header_s obj_header_t; struct gs_ptr_procs_s { void (*unmark)(enum_ptr_t *, gc_state_t *); bool (*mark)(enum_ptr_t *, gc_state_t *); void *(*reloc)(const void *, gc_state_t *); }; extern const gs_ptr_procs_t ptr_struct_procs; extern const gs_ptr_procs_t ptr_string_procs; extern const gs_ptr_procs_t ptr_const_string_procs; struct gs_gc_root_s { gs_gc_root_t *next; gs_ptr_type_t ptype; void **p; bool free_on_unregister; }; typedef struct gc_procs_common_s { 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 *); } gc_procs_common_t; 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); void gs_no_struct_reloc_ptrs(void *ptr, unsigned int size, const gs_memory_struct_type_t *pstype, gc_state_t *gcst); extern const gs_memory_struct_type_t st_free; extern const gs_memory_struct_type_t st_bytes; extern const gs_memory_struct_type_t st_gc_root_t; extern const gs_memory_struct_type_t st_const_string_element; typedef enum { GC_ELT_OBJ, GC_ELT_STRING, GC_ELT_CONST_STRING } gc_ptr_type_index_t; typedef struct gc_ptr_element_s { unsigned short type; unsigned short offset; } gc_ptr_element_t; typedef struct gc_struct_data_s { unsigned short num_ptrs; unsigned short super_offset; const gs_memory_struct_type_t *super_type; const gc_ptr_element_t *ptrs; } gc_struct_data_t; 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); void basic_reloc_ptrs(void *ptr, unsigned int size, const gs_memory_struct_type_t *pstype, gc_state_t *gcst); extern gs_ptr_type_t enum_bytestring(enum_ptr_t *pep, const gs_bytestring *pbs); extern gs_ptr_type_t enum_const_bytestring(enum_ptr_t *pep, const gs_const_bytestring *pbs); extern void reloc_bytestring(gs_bytestring *pbs, gc_state_t *gcst); extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst); typedef enum { BLEND_MODE_Compatible, BLEND_MODE_Normal, BLEND_MODE_Multiply, BLEND_MODE_Screen, BLEND_MODE_Difference, BLEND_MODE_Darken, BLEND_MODE_Lighten, BLEND_MODE_ColorDodge, BLEND_MODE_ColorBurn, BLEND_MODE_Exclusion, BLEND_MODE_HardLight, BLEND_MODE_Overlay, BLEND_MODE_SoftLight, BLEND_MODE_Luminosity, BLEND_MODE_Hue, BLEND_MODE_Saturation, BLEND_MODE_Color } gs_blend_mode_t; typedef enum { TRANSPARENCY_STATE_Group = 1, TRANSPARENCY_STATE_Mask } gs_transparency_state_type_t; typedef struct gs_transparency_state_s gs_transparency_state_t; struct gs_transparency_state_s { gs_transparency_state_t *saved; gs_transparency_state_type_t type; }; typedef struct gs_transparency_mask_s { rc_header rc; } gs_transparency_mask_t; typedef struct gs_function_s gs_function_t; typedef struct gs_transparency_group_params_s { const gs_color_space *ColorSpace; bool Isolated; bool Knockout; bool image_with_SMask; bool idle; unsigned int mask_id; } gs_transparency_group_params_t; typedef enum { TRANSPARENCY_MASK_Alpha, TRANSPARENCY_MASK_Luminosity } gs_transparency_mask_subtype_t; typedef struct gs_transparency_mask_params_s { gs_transparency_mask_subtype_t subtype; int Background_components; float Background[(8)]; float GrayBackground; int (*TransferFunction)(floatp in, float *out, void *proc_data); gs_function_t *TransferFunction_data; bool replacing; } gs_transparency_mask_params_t; typedef struct gx_transparency_mask_params_s { gs_transparency_mask_subtype_t subtype; int Background_components; float Background[(8)]; float GrayBackground; bool function_is_identity; bool idle; bool replacing; unsigned int mask_id; unsigned char transfer_fn[256]; } gx_transparency_mask_params_t; typedef enum { TRANSPARENCY_CHANNEL_Opacity = 0, TRANSPARENCY_CHANNEL_Shape = 1 } gs_transparency_channel_selector_t; typedef unsigned long gx_xglyph; struct gx_xfont_procs_s; typedef struct gx_xfont_procs_s gx_xfont_procs; struct gx_xfont_s; typedef struct gx_xfont_s gx_xfont; typedef unsigned short gx_color_value; typedef long fixed; typedef unsigned long ufixed; fixed fixed_mult_quo(fixed A, fixed B, fixed C); bool gx_intersect_small_bars(fixed q0x, fixed q0y, fixed q1x, fixed q1y, fixed q2x, fixed q2y, fixed q3x, fixed q3y, fixed *ry, fixed *ey); typedef struct gs_fixed_point_s { fixed x, y; } gs_fixed_point; typedef struct gs_fixed_rect_s { gs_fixed_point p, q; } gs_fixed_rect; typedef unsigned long gs_char; typedef unsigned long gs_glyph; typedef bool (*gs_glyph_mark_proc_t)(const gs_memory_t *mem, gs_glyph glyph, void *proc_data); typedef enum { ENCODING_INDEX_UNKNOWN = -1, ENCODING_INDEX_STANDARD = 0, ENCODING_INDEX_ISOLATIN1, ENCODING_INDEX_SYMBOL, ENCODING_INDEX_DINGBATS, ENCODING_INDEX_WINANSI, ENCODING_INDEX_MACROMAN, ENCODING_INDEX_MACEXPERT, ENCODING_INDEX_MACGLYPH, ENCODING_INDEX_ALOGLYPH, ENCODING_INDEX_ALXGLYPH, ENCODING_INDEX_CFFSTRINGS } gs_encoding_index_t; typedef enum gs_glyph_space_s { GLYPH_SPACE_NAME, GLYPH_SPACE_INDEX, GLYPH_SPACE_NOGEN } gs_glyph_space_t; typedef int (*gs_glyph_name_proc_t)(const gs_memory_t *mem, gs_glyph glyph, gs_const_string *pstr, void *proc_data); typedef enum { cpm_show, cpm_charwidth, cpm_false_charpath, cpm_true_charpath, cpm_false_charboxpath, cpm_true_charboxpath } gs_char_path_mode; typedef enum { CACHE_DEVICE_NONE = 0, CACHE_DEVICE_NOT_CACHING, CACHE_DEVICE_NONE_AND_CLIP, CACHE_DEVICE_CACHING } gs_in_cache_device_t; typedef struct gs_text_params_s { unsigned int operation; union sd_ { const unsigned char *bytes; const gs_char *chars; const gs_glyph *glyphs; gs_char d_char; gs_glyph d_glyph; } data; unsigned int size; gs_point delta_all; gs_point delta_space; union s_ { gs_char s_char; gs_glyph s_glyph; } space; const float *x_widths; const float *y_widths; unsigned int widths_size; } gs_text_params_t; int gs_text_replaced_width(const gs_text_params_t *text, unsigned int index, gs_point *pwidth); typedef struct gs_text_enum_s gs_text_enum_t; typedef struct gx_device_s gx_device; typedef struct gs_font_s gs_font; typedef struct gx_path_s gx_path; typedef struct gx_clip_path_s gx_clip_path; 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); int gs_text_begin(gs_state * pgs, const gs_text_params_t * text, gs_memory_t * mem, gs_text_enum_t ** ppenum); int gs_text_update_dev_color(gs_state * pgs, gs_text_enum_t * pte); int gs_show_begin(gs_state *, const unsigned char *, unsigned int, gs_memory_t *, gs_text_enum_t **), gs_ashow_begin(gs_state *, floatp, floatp, const unsigned char *, unsigned int, gs_memory_t *, gs_text_enum_t **), gs_widthshow_begin(gs_state *, floatp, floatp, gs_char, const unsigned char *, unsigned int, gs_memory_t *, gs_text_enum_t **), gs_awidthshow_begin(gs_state *, floatp, floatp, gs_char, floatp, floatp, const unsigned char *, unsigned int, gs_memory_t *, gs_text_enum_t **), gs_kshow_begin(gs_state *, const unsigned char *, unsigned int, gs_memory_t *, gs_text_enum_t **), gs_xyshow_begin(gs_state *, const unsigned char *, unsigned int, const float *, const float *, unsigned int, gs_memory_t *, gs_text_enum_t **), gs_glyphshow_begin(gs_state *, gs_glyph, gs_memory_t *, gs_text_enum_t **), gs_cshow_begin(gs_state *, const unsigned char *, unsigned int, gs_memory_t *, gs_text_enum_t **), gs_stringwidth_begin(gs_state *, const unsigned char *, unsigned int, gs_memory_t *, gs_text_enum_t **), gs_charpath_begin(gs_state *, const unsigned char *, unsigned int, bool, gs_memory_t *, gs_text_enum_t **), gs_glyphpath_begin(gs_state *, gs_glyph, bool, gs_memory_t *, gs_text_enum_t **), gs_glyphwidth_begin(gs_state *, gs_glyph, gs_memory_t *, gs_text_enum_t **), gs_charboxpath_begin(gs_state *, const unsigned char *, unsigned int, bool, gs_memory_t *, gs_text_enum_t **); int gs_text_size(gs_state * pgs, gs_text_params_t *text, gs_memory_t * mem); gs_text_params_t *gs_get_text_params(gs_text_enum_t *pte); int gs_text_restart(gs_text_enum_t *pte, const gs_text_params_t *text); int gs_text_resync(gs_text_enum_t *pte, const gs_text_enum_t *pfrom); int gs_text_process(gs_text_enum_t *pte); gs_font *gs_text_current_font(const gs_text_enum_t *pte); gs_char gs_text_current_char(const gs_text_enum_t *pte); gs_char gs_text_next_char(const gs_text_enum_t *pte); gs_glyph gs_text_current_glyph(const gs_text_enum_t *pte); int gs_text_total_width(const gs_text_enum_t *pte, gs_point *pwidth); bool gs_text_is_width_only(const gs_text_enum_t *pte); int gs_text_current_width(const gs_text_enum_t *pte, gs_point *pwidth); typedef enum { TEXT_SET_CHAR_WIDTH, TEXT_SET_CACHE_DEVICE, TEXT_SET_CACHE_DEVICE2 } gs_text_cache_control_t; int gs_text_set_cache(gs_text_enum_t *pte, const double *values, gs_text_cache_control_t control), gs_text_setcharwidth(gs_text_enum_t *pte, const double wxy[2]), gs_text_setcachedevice(gs_text_enum_t *pte, const double wbox[6]), gs_text_setcachedevice2(gs_text_enum_t *pte, const double wbox2[10]); int gs_text_retry(gs_text_enum_t *pte); void gs_text_release(gs_text_enum_t *pte, client_name_t cname); int gs_text_count_chars(gs_state * pgs, gs_text_params_t *text, gs_memory_t * mem); typedef struct gs_text_enum_procs_s gs_text_enum_procs_t; typedef struct cached_fm_pair_s cached_fm_pair; typedef struct gs_text_returned_s { gs_char current_char; gs_glyph current_glyph; gs_point total_width; } gs_text_returned_t; typedef struct gx_font_stack_item_s { gs_font *font; unsigned int index; } gx_font_stack_item_t; typedef struct gx_font_stack_s { int depth; gx_font_stack_item_t items[1 + 5]; } gx_font_stack_t; void rc_free_text_enum(gs_memory_t *, void *, client_name_t); struct gs_text_enum_s { 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; }; int gs_text_enum_init(gs_text_enum_t *pte, const gs_text_enum_procs_t *procs, 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 *mem); void gs_text_enum_copy_dynamic(gs_text_enum_t *pto, const gs_text_enum_t *pfrom, bool for_return); struct gs_text_enum_procs_s { int (*resync)(gs_text_enum_t *pte, const gs_text_enum_t *pfrom); int (*process)(gs_text_enum_t *pte); bool (*is_width_only)(const gs_text_enum_t *pte); int (*current_width)(const gs_text_enum_t *pte, gs_point *pwidth); int (*set_cache)(gs_text_enum_t *pte, const double *values, gs_text_cache_control_t control); int (*retry)(gs_text_enum_t *pte); void (*release)(gs_text_enum_t *pte, client_name_t cname); }; void gx_default_text_release(gs_text_enum_t *pte, client_name_t cname); typedef enum { gs_color_select_all = -1, gs_color_select_texture = 0, gs_color_select_source = 1 } gs_color_select_t; typedef short frac; typedef short signed_frac; typedef struct gx_transfer_map_s gx_transfer_map; typedef float (*gs_mapping_proc) (floatp, const gx_transfer_map *); typedef float (*gs_mapping_closure_proc_t) (floatp value, const gx_transfer_map * pmap, const void *proc_data); typedef struct gs_mapping_closure_s { gs_mapping_closure_proc_t proc; const void *data; } gs_mapping_closure_t; struct gx_transfer_map_s { rc_header rc; gs_mapping_proc proc; gs_mapping_closure_t closure; gs_id id; frac values[(1 << 8)]; }; extern const gs_memory_struct_type_t st_transfer_map; void gx_set_identity_transfer(gx_transfer_map *); frac gx_color_frac_map(frac, const frac *); float gs_mapped_transfer(floatp, const gx_transfer_map *); float gs_identity_transfer(floatp, const gx_transfer_map *); struct gx_cm_color_map_procs_s { void (*map_gray) (gx_device * dev, frac gray, frac * out); void (*map_rgb) (gx_device * dev, const gs_imager_state *pis, frac r, frac g, frac b, frac * out); void (*map_cmyk) (gx_device * dev, frac c, frac m, frac y, frac k, frac * out); }; typedef struct gx_cm_color_map_procs_s gx_cm_color_map_procs; void gray_cs_to_gray_cm (gx_device * dev, frac gray, frac * out); void rgb_cs_to_rgb_cm (gx_device * dev, const gs_imager_state *pis, frac r, frac g, frac b, frac * out); void cmyk_cs_to_cmyk_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out); struct gx_color_map_procs_s { void (*map_gray)(frac, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t); void (*map_rgb)(frac, frac, frac, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t); void (*map_cmyk)(frac, frac, frac, frac, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t); void (*map_rgb_alpha)(frac, frac, frac, frac, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t); void (*map_separation)(frac, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t); void (*map_devicen)(const frac *, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t); bool (*is_halftoned)(const gs_imager_state *, gx_device *); }; typedef struct gx_color_map_procs_s gx_color_map_procs; const gx_color_map_procs * gx_get_cmap_procs(const gs_imager_state *, const gx_device *); const gx_color_map_procs * gx_default_get_cmap_procs(const gs_imager_state *, const gx_device *); void gx_set_cmap_procs(gs_imager_state *, const gx_device *); extern void gx_default_gray_cs_to_gray_cm (gx_device * dev, frac gray, frac * out); 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); extern void gx_default_cmyk_cs_to_gray_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out); extern void gx_default_gray_cs_to_rgb_cm (gx_device * dev, frac gray, frac * out); 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); extern void gx_default_cmyk_cs_to_rgb_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out); extern void gx_default_gray_cs_to_cmyk_cm (gx_device * dev, frac gray, frac * out); 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); extern void gx_default_cmyk_cs_to_cmyk_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out); extern void gx_default_gray_cs_to_cmyk_cm (gx_device * dev, frac gray, frac * out); 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); extern void gx_default_cmyk_cs_to_cmyk_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out); extern void gx_error_gray_cs_to_cmyk_cm (gx_device * dev, frac gray, frac * out); 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); extern void gx_error_cmyk_cs_to_cmyk_cm (gx_device * dev, frac c, frac m, frac y, frac k, frac * out); int (gx_error_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type); int (gx_default_DevGray_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type); int (gx_default_DevRGB_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type); int (gx_default_DevCMYK_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type); int (gx_default_DevRGBK_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type); const gx_cm_color_map_procs * (gx_error_get_color_mapping_procs)(const gx_device * dev); const gx_cm_color_map_procs * (gx_default_DevGray_get_color_mapping_procs)(const gx_device * dev); const gx_cm_color_map_procs * (gx_default_DevRGB_get_color_mapping_procs)(const gx_device * dev); const gx_cm_color_map_procs * (gx_default_DevCMYK_get_color_mapping_procs)(const gx_device * dev); const gx_cm_color_map_procs * (gx_default_DevRGBK_get_color_mapping_procs)(const gx_device * dev); gx_color_index (gx_error_encode_color)(gx_device * dev, const gx_color_value colors[]); gx_color_index (gx_default_encode_color)(gx_device * dev, const gx_color_value colors[]); gx_color_index (gx_default_gray_fast_encode)(gx_device * dev, const gx_color_value colors[]); gx_color_index (gx_default_gray_encode)(gx_device * dev, const gx_color_value colors[]); gx_color_index (gx_backwards_compatible_gray_encode)(gx_device * dev, const gx_color_value colors[]); int (gx_error_decode_color)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]); int (gx_default_decode_color)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]); frac gx_unit_frac(float fvalue); struct gs_color_space_type_s { gs_color_space_index index; bool can_be_base_space; bool can_be_alt_space; gs_memory_type_ptr_t stype; int (*num_components)(const gs_color_space *); void (*init_color)(gs_client_color *, const gs_color_space *); void (*restrict_color)(gs_client_color *, const gs_color_space *); const gs_color_space *(*concrete_space)(const gs_color_space *, const gs_imager_state *); int (*concretize_color)(const gs_client_color *, const gs_color_space *, frac *, const gs_imager_state *); int (*remap_concrete_color)(const frac *, const gs_color_space * pcs, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t); int (*remap_color)(const gs_client_color *, const gs_color_space *, gx_device_color *, const gs_imager_state *, gx_device *, gs_color_select_t); int (*install_cspace)(gs_color_space *, gs_state *); int (*set_overprint)(const gs_color_space *, gs_state *); void (*final)(const gs_color_space *); void (*adjust_color_count)(const gs_client_color *, const gs_color_space *, int); int (*serialize)(const gs_color_space *, stream *); 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); }; extern const gs_memory_struct_type_t st_base_color_space; int gx_num_components_1(const gs_color_space *); int gx_num_components_3(const gs_color_space *); int gx_num_components_4(const gs_color_space *); void gx_init_paint_1(gs_client_color *, const gs_color_space *); void gx_init_paint_3(gs_client_color *, const gs_color_space *); void gx_init_paint_4(gs_client_color *, const gs_color_space *); void gx_restrict01_paint_1(gs_client_color *, const gs_color_space *); void gx_restrict01_paint_3(gs_client_color *, const gs_color_space *); void gx_restrict01_paint_4(gs_client_color *, const gs_color_space *); const gs_color_space *gx_no_concrete_space(const gs_color_space *, const gs_imager_state *); const gs_color_space *gx_same_concrete_space(const gs_color_space *, const gs_imager_state *); int gx_no_concretize_color(const gs_client_color *, const gs_color_space *, frac *, const gs_imager_state *); 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); int gx_no_install_cspace(gs_color_space *, gs_state *); int gx_spot_colors_set_overprint(const gs_color_space *, gs_state *); void gx_no_adjust_color_count(const gs_client_color *, const gs_color_space *, int); int gx_serialize_cspace_type(const gs_color_space *, stream *); 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); 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); 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); int gx_concretize_DeviceGray(const gs_client_color *, const gs_color_space *, frac *, const gs_imager_state *); 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); 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); int gx_concretize_DeviceRGB(const gs_client_color *, const gs_color_space *, frac *, const gs_imager_state *); 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); 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); int gx_concretize_DeviceCMYK(const gs_client_color *, const gs_color_space *, frac *, const gs_imager_state *); 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); extern const gs_memory_struct_type_t st_color_space; gs_color_space * gs_cspace_alloc(gs_memory_t *mem, const gs_color_space_type *pcstype); gx_color_index check_cmyk_color_model_comps(gx_device * dev); typedef struct gs_context_state_s i_ctx_t; typedef struct gs_param_list_s gs_param_list; int custom_color_callback_put_params(gs_state * pgs, gs_param_list * plist); int custom_color_callback_get_params(gs_state * pgs, gs_param_list * plist); bool custom_color_callback_install_Separation(gs_color_space * pcs, gs_state * pgs); bool custom_color_callback_install_DeviceN(gs_color_space * pcs, gs_state * pgs); int gx_remap_concrete_custom_color_Separation(const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); int gx_remap_concrete_custom_color_DeviceN(const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); typedef struct client_custom_color_params_s { struct client_custom_color_procs_s * client_procs; void * data; } client_custom_color_params_t; typedef struct client_color_space_data_s { void (*client_adjust_cspace_count)(const gs_color_space *, int); } client_color_space__data_t; typedef struct client_custom_color_procs_s { bool (* install_DeviceGray)(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs); int (* remap_DeviceGray)(client_custom_color_params_t * pparams, const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); bool (* install_DeviceRGB)(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs); int (* remap_DeviceRGB)(client_custom_color_params_t * pparams, const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); bool (* install_DeviceCMYK)(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs); int (* remap_DeviceCMYK)(client_custom_color_params_t * pparams, const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); bool (* install_Separation)(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs); int (* remap_Separation)(client_custom_color_params_t * pparams, const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); bool (* install_DeviceN)(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs); int (* remap_DeviceN)(client_custom_color_params_t * pparams, const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); bool (* install_CIEBasedA)(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs); int (* remap_CIEBasedA)(client_custom_color_params_t * pparams, const gs_client_color * pc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); bool (* install_CIEBasedABC)(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs); int (* remap_CIEBasedABC)(client_custom_color_params_t * pparams, const gs_client_color * pc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); bool (* install_CIEBasedDEF)(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs); int (* remap_CIEBasedDEF)(client_custom_color_params_t * pparams, const gs_client_color * pc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); bool (* install_CIEBasedDEFG)(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs); int (* remap_CIEBasedDEFG)(client_custom_color_params_t * pparams, const gs_client_color * pc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); bool (* install_ICCBased)(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs); int (* remap_ICCBased)(client_custom_color_params_t * pparams, const gs_client_color * pc, const gs_color_space * pcs, gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev, gs_color_select_t select); } client_custom_color_procs_t; typedef struct gx_fill_params_s gx_fill_params; typedef struct gx_stroke_params_s gx_stroke_params; typedef struct patch_fill_state_s patch_fill_state_t; typedef struct gx_image_enum_common_s gx_image_enum_common_t; typedef struct gs_pattern1_instance_s gs_pattern1_instance_t; typedef gx_device_color gx_drawing_color; typedef enum { go_text, go_graphics } graphics_object_type; typedef struct gs_fixed_edge_s { gs_fixed_point start; gs_fixed_point end; } gs_fixed_edge; typedef struct gs_get_bits_params_s gs_get_bits_params_t; typedef struct gx_device_anti_alias_info_s { int text_bits; int graphics_bits; } gx_device_anti_alias_info; typedef int32_t frac31; typedef struct gs_linear_color_edge_s { gs_fixed_point start; gs_fixed_point end; const frac31 *c0, *c1; fixed clip_x; } gs_linear_color_edge; typedef enum { GX_CINFO_UNKNOWN_SEP_LIN = -1, GX_CINFO_SEP_LIN_NONE = 0, GX_CINFO_SEP_LIN } gx_color_enc_sep_lin_t; typedef enum { GX_CINFO_POLARITY_UNKNOWN = -1, GX_CINFO_POLARITY_SUBTRACTIVE = 0, GX_CINFO_POLARITY_ADDITIVE } gx_color_polarity_t; typedef enum { GX_CINFO_OPMODE_UNKNOWN = -1, GX_CINFO_OPMODE_NOT = 0, GX_CINFO_OPMODE } gx_cm_opmode_t; typedef struct gx_device_color_info_s { int max_components; int num_components; gx_color_polarity_t polarity; unsigned char depth; unsigned char gray_index; unsigned int max_gray; unsigned int max_color; unsigned int dither_grays; unsigned int dither_colors; gx_device_anti_alias_info anti_alias; gx_color_enc_sep_lin_t separable_and_linear; unsigned char comp_shift[(8 * 8)]; unsigned char comp_bits[(8 * 8)]; gx_color_index comp_mask[(8 * 8)]; const char * cm_name; gx_cm_opmode_t opmode; gx_color_index process_comps; int black_component; } gx_device_color_info; typedef struct gx_device_procs_s gx_device_procs; typedef struct gx_page_device_procs_s { int (*install)(gx_device *dev, gs_state *pgs); int (*begin_page)(gx_device *dev, gs_state *pgs); int (*end_page)(gx_device *dev, int reason, gs_state *pgs); } gx_page_device_procs; int gx_default_install(gx_device *dev, gs_state *pgs); int gx_default_begin_page(gx_device *dev, gs_state *pgs); int gx_default_end_page(gx_device *dev, int reason, gs_state *pgs); typedef struct gx_stroked_gradient_recognizer_s { bool stroke_stored; gs_fixed_point orig[4], adjusted[4]; } gx_stroked_gradient_recognizer_t; typedef struct gx_device_cached_colors_s { gx_color_index black, white; } gx_device_cached_colors_t; typedef enum { pattern_manage__can_accum, pattern_manage__start_accum, pattern_manage__finish_accum, pattern_manage__load, pattern_manage__shading_area, pattern_manage__is_cpath_accum, pattern_manage__shfill_doesnt_need_path, pattern_manage__handles_clip_path } pattern_manage_t; typedef struct gs_fill_attributes_s { const gs_fixed_rect *clip; bool swap_axes; const gx_device_halftone *ht; gs_logical_operation_t lop; fixed ystart, yend; patch_fill_state_t *pfs; } gs_fill_attributes; typedef struct gs_devn_params_s gs_devn_params; typedef struct gx_image_plane_s { const unsigned char *data; int data_x; unsigned int raster; } gx_image_plane_t; int gx_image_data(gx_image_enum_common_t *info, const unsigned char **planes, int data_x, unsigned int raster, int height); int gx_image_plane_data(gx_image_enum_common_t *info, const gx_image_plane_t *planes, int height); int gx_image_plane_data_rows(gx_image_enum_common_t *info, const gx_image_plane_t *planes, int height, int *rows_used); int gx_image_flush(gx_image_enum_common_t *info); bool gx_image_planes_wanted(const gx_image_enum_common_t *info, unsigned char *wanted); int gx_image_end(gx_image_enum_common_t *info, bool draw_last); 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); }; 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); 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); 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); struct gx_device_s { 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; }; extern const gs_memory_struct_type_t st_device; void gx_device_finalize(void *ptr); gx_device *gx_device_enum_ptr(gx_device *); gx_device *gx_device_reloc_ptr(gx_device *, gc_state_t *); typedef gx_color_index (*dev_proc_map_rgb_color_t)(gx_device *dev, const gx_color_value cv[]); typedef int (*dev_proc_map_color_rgb_t)(gx_device *dev, gx_color_index color, gx_color_value rgb[3]); typedef struct gx_device_forward_s { 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_forward; extern const gs_memory_struct_type_t st_device_forward; typedef struct gx_device_null_s gx_device_null; struct gx_device_null_s { 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; }; extern const gx_device_null gs_null_device; extern const gs_memory_struct_type_t st_device_null; void gx_device_init(gx_device * dev, const gx_device * proto, gs_memory_t * mem, bool internal); void gs_make_null_device(gx_device_null *dev_null, gx_device *target, gs_memory_t *mem); bool gs_is_null_device(gx_device *dev); void gx_device_set_target(gx_device_forward *fdev, gx_device *target); void gx_device_retain(gx_device *dev, bool retained); unsigned int gx_device_raster(const gx_device * dev, bool pad_to_word); int gx_device_adjust_resolution(gx_device * dev, int actual_width, int actual_height, int fit); void gx_device_set_margins(gx_device * dev, const float *margins , bool move_origin); void gx_device_set_width_height(gx_device * dev, int width, int height); void gx_device_set_resolution(gx_device * dev, floatp x_dpi, floatp y_dpi); void gx_device_set_media_size(gx_device * dev, floatp media_width, floatp media_height); void gx_set_device_only(gs_state *, gx_device *); int gs_closedevice(gx_device *); void gx_device_free_local(gx_device *); typedef struct gx_device_type_s { gs_memory_type_ptr_t stype; int (*initialize)(gx_device *); } gx_device_type; typedef struct gx_io_device_s gx_io_device; typedef struct gs_parsed_file_name_s { gs_memory_t *memory; gx_io_device *iodev; const char *fname; unsigned int len; } gs_parsed_file_name_t; int gs_parse_file_name(gs_parsed_file_name_t *, const char *, unsigned int); int gs_parse_real_file_name(gs_parsed_file_name_t *, const char *, unsigned int, gs_memory_t *, client_name_t); int gs_terminate_file_name(gs_parsed_file_name_t *, gs_memory_t *, client_name_t); void gs_free_file_name(gs_parsed_file_name_t *, client_name_t); typedef const char *gs_param_name; typedef enum { gs_param_type_null, gs_param_type_bool, gs_param_type_int, gs_param_type_long, gs_param_type_float, gs_param_type_string, gs_param_type_name, gs_param_type_int_array, gs_param_type_float_array, gs_param_type_string_array, gs_param_type_name_array, gs_param_type_dict, gs_param_type_dict_int_keys, gs_param_type_array } gs_param_type; typedef struct gs_param_int_array_s { const int *data; unsigned int size; bool persistent; } gs_param_int_array; typedef struct gs_param_float_array_s { const float *data; unsigned int size; bool persistent; } gs_param_float_array; typedef struct gs_param_string_array_s { const gs_param_string *data; unsigned int size; bool persistent; } gs_param_string_array; typedef struct gs_param_collection_s { gs_param_list *list; unsigned int size; } gs_param_collection; typedef gs_param_collection gs_param_dict; typedef gs_param_collection gs_param_array; extern const unsigned char gs_param_type_sizes[]; extern const unsigned char gs_param_type_base_sizes[]; typedef union gs_param_value_s { 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; } gs_param_value; typedef struct gs_param_typed_value_s { gs_param_value value; gs_param_type type; } gs_param_typed_value; 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); void gs_param_typed_value_reloc_ptrs(void *ptr, unsigned int size, const gs_memory_struct_type_t *pstype, gc_state_t *gcst); typedef enum { gs_param_collection_dict_any = 0, gs_param_collection_dict_int_keys = 1, gs_param_collection_array = 2 } gs_param_collection_type_t; typedef union gs_param_enumerator_s { int intval; long longval; void *pvoid; char *pchar; } gs_param_enumerator_t; typedef gs_param_string gs_param_key_t; typedef struct gs_param_list_procs_s { int (*xmit_typed)(gs_param_list *, gs_param_name, gs_param_typed_value *); int (*begin_xmit_collection)(gs_param_list *, gs_param_name, gs_param_dict *, gs_param_collection_type_t); int (*end_xmit_collection)(gs_param_list *, gs_param_name, gs_param_dict *); int (*next_key)(gs_param_list *, gs_param_enumerator_t *, gs_param_key_t *); int (*request)(gs_param_list *, gs_param_name); int (*requested)(const gs_param_list *, gs_param_name); int (*get_policy)(gs_param_list *, gs_param_name); int (*signal_error)(gs_param_list *, gs_param_name, int); int (*commit)(gs_param_list *); } gs_param_list_procs; int param_read_requested_typed(gs_param_list *, gs_param_name, gs_param_typed_value *); int param_read_null(gs_param_list *, gs_param_name); int param_write_null(gs_param_list *, gs_param_name); int param_read_bool(gs_param_list *, gs_param_name, bool *); int param_write_bool(gs_param_list *, gs_param_name, const bool *); int param_read_int(gs_param_list *, gs_param_name, int *); int param_write_int(gs_param_list *, gs_param_name, const int *); int param_read_long(gs_param_list *, gs_param_name, long *); int param_write_long(gs_param_list *, gs_param_name, const long *); int param_read_float(gs_param_list *, gs_param_name, float *); int param_write_float(gs_param_list *, gs_param_name, const float *); int param_read_string(gs_param_list *, gs_param_name, gs_param_string *); int param_write_string(gs_param_list *, gs_param_name, const gs_param_string *); int param_read_name(gs_param_list *, gs_param_name, gs_param_string *); int param_write_name(gs_param_list *, gs_param_name, const gs_param_string *); int param_read_int_array(gs_param_list *, gs_param_name, gs_param_int_array *); int param_write_int_array(gs_param_list *, gs_param_name, const gs_param_int_array *); int param_write_int_values(gs_param_list *, gs_param_name, const int *, unsigned int, bool); int param_read_float_array(gs_param_list *, gs_param_name, gs_param_float_array *); int param_write_float_array(gs_param_list *, gs_param_name, const gs_param_float_array *); int param_write_float_values(gs_param_list *, gs_param_name, const float *, unsigned int, bool); int param_read_string_array(gs_param_list *, gs_param_name, gs_param_string_array *); int param_write_string_array(gs_param_list *, gs_param_name, const gs_param_string_array *); int param_read_name_array(gs_param_list *, gs_param_name, gs_param_string_array *); int param_write_name_array(gs_param_list *, gs_param_name, const gs_param_string_array *); struct gs_param_list_s { const gs_param_list_procs *procs; gs_memory_t *memory; bool persistent_keys; }; void gs_param_list_set_persist_keys(gs_param_list *, bool); void param_init_enumerator(gs_param_enumerator_t * penum); typedef struct gs_param_item_s { const char *key; unsigned char type; short offset; } gs_param_item_t; int gs_param_read_items(gs_param_list * plist, void *obj, const gs_param_item_t * items); int gs_param_write_items(gs_param_list * plist, const void *obj, const void *default_obj, const gs_param_item_t * items); void gs_param_list_init(gs_param_list *, const gs_param_list_procs *, gs_memory_t *); int param_coerce_typed(gs_param_typed_value * pvalue, gs_param_type req_type, gs_memory_t * mem); int gs_param_request_default(gs_param_list *, gs_param_name); int gs_param_requested_default(const gs_param_list *, gs_param_name); typedef struct gs_c_param_s gs_c_param; typedef struct gs_c_param_list_s { const gs_param_list_procs *procs; gs_memory_t *memory; bool persistent_keys; gs_c_param *head; gs_param_list *target; unsigned int count; bool any_requested; gs_param_collection_type_t coll_type; } gs_c_param_list; void gs_c_param_list_set_target(gs_c_param_list *, gs_param_list *); gs_c_param_list *gs_c_param_list_alloc(gs_memory_t *, client_name_t); void gs_c_param_list_write(gs_c_param_list *, gs_memory_t *); void gs_c_param_list_write_more(gs_c_param_list *); void gs_c_param_list_read(gs_c_param_list *); void gs_c_param_list_release(gs_c_param_list *); typedef struct { void *dummy_; } gp_semaphore; unsigned int gp_semaphore_sizeof(void); int gp_semaphore_open(gp_semaphore * sema); int gp_semaphore_close(gp_semaphore * sema); int gp_semaphore_wait(gp_semaphore * sema); int gp_semaphore_signal(gp_semaphore * sema); typedef struct { void *dummy_; } gp_monitor; unsigned int gp_monitor_sizeof(void); int gp_monitor_open(gp_monitor * mon); int gp_monitor_close(gp_monitor * mon); int gp_monitor_enter(gp_monitor * mon); int gp_monitor_leave(gp_monitor * mon); typedef void (*gp_thread_creation_callback_t) (void *); int gp_create_thread(gp_thread_creation_callback_t, void *); typedef struct gx_semaphore_s { gs_memory_t *memory; gp_semaphore native; } gx_semaphore_t; gx_semaphore_t * gx_semaphore_alloc( gs_memory_t * memory ); void gx_semaphore_free( gx_semaphore_t * sema ); typedef struct gx_monitor_s { gs_memory_t *memory; gp_monitor native; } gx_monitor_t; gx_monitor_t * gx_monitor_alloc( gs_memory_t * memory ); void gx_monitor_free( gx_monitor_t * mon ); typedef struct gs_malloc_block_s gs_malloc_block_t; typedef struct gs_malloc_memory_s { 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; gs_malloc_block_t *allocated; long limit; long used; long max_used; gx_monitor_t *monitor; } gs_malloc_memory_t; gs_malloc_memory_t *gs_malloc_memory_init(void); gs_memory_t * gs_malloc_init(const gs_memory_t *parent); void gs_malloc_release(gs_memory_t *mem); int gs_malloc_wrap(gs_memory_t **wrapped, gs_malloc_memory_t *contents); gs_malloc_memory_t *gs_malloc_wrapped_contents(gs_memory_t *wrapped); gs_malloc_memory_t *gs_malloc_unwrap(gs_memory_t *wrapped); int gx_default_open_device(gx_device *dev); void gx_default_get_initial_matrix(gx_device *dev, gs_matrix *pmat); void gx_upright_get_initial_matrix(gx_device *dev, gs_matrix *pmat); int gx_default_sync_output(gx_device *dev); int gx_default_output_page(gx_device *dev, int num_copies, int flush); int gx_default_close_device(gx_device *dev); gx_color_index gx_default_w_b_map_rgb_color(gx_device *dev, const gx_color_value cv[]); int gx_default_w_b_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]); 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); 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); 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); int gx_default_draw_line(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color); int gx_no_get_bits(gx_device *dev, int y, unsigned char *data, unsigned char **actual_data); int gx_default_get_bits(gx_device *dev, int y, unsigned char *data, unsigned char **actual_data); int gx_default_get_params(gx_device *dev, gs_param_list *plist); int gx_default_put_params(gx_device *dev, gs_param_list *plist); gx_color_index gx_default_map_cmyk_color(gx_device *dev, const gx_color_value cv[]); const gx_xfont_procs *gx_default_get_xfont_procs(gx_device *dev); gx_device *gx_default_get_xfont_device(gx_device *dev); 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); gx_device *gx_default_get_page_device(gx_device *dev); gx_device *gx_page_device_get_page_device(gx_device *dev); int gx_default_get_alpha_bits(gx_device *dev, graphics_object_type type); 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); 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); int gx_default_get_band(gx_device *dev, int y, int *band_start); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); int gx_default_end_image(gx_device *dev, gx_image_enum_common_t *info, bool draw_last); 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); 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); 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); void gx_default_get_clipping_box(gx_device *dev, gs_fixed_rect *pbox); void gx_get_largest_clipping_box(gx_device *dev, gs_fixed_rect *pbox); 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); int gx_no_get_bits_rectangle(gx_device *dev, const gs_int_rect *prect, gs_get_bits_params_t *params, gs_int_rect **unread); int gx_default_get_bits_rectangle(gx_device *dev, const gs_int_rect *prect, gs_get_bits_params_t *params, gs_int_rect **unread); int gx_default_map_color_rgb_alpha(gx_device *dev, gx_color_index color, gx_color_value rgba[4]); int gx_no_create_compositor(gx_device *dev, gx_device **pcdev, const gs_composite_t *pcte, gs_imager_state *pis, gs_memory_t *memory); int gx_default_create_compositor(gx_device *dev, gx_device **pcdev, const gs_composite_t *pcte, gs_imager_state *pis, gs_memory_t *memory); int gx_null_create_compositor(gx_device *dev, gx_device **pcdev, const gs_composite_t *pcte, gs_imager_state *pis, gs_memory_t *memory); int gx_default_get_hardware_params(gx_device *dev, gs_param_list *plist); 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); int gx_default_finish_copydevice(gx_device *dev, const gx_device *from_dev); int gx_default_pattern_manage(gx_device *pdev, gx_bitmap_id id, gs_pattern1_instance_t *pinst, pattern_manage_t function); 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); int gx_default_include_color_space(gx_device *dev, gs_color_space *cspace, const unsigned char *res_name, int name_length); 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 ); 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); 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); int gx_default_update_spot_equivalent_colors(gx_device *dev, const gs_state * pgs); gs_devn_params * gx_default_ret_devn_params(gx_device *dev); gx_color_index gx_default_b_w_map_rgb_color(gx_device *dev, const gx_color_value cv[]); int gx_default_b_w_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]); gx_color_index gx_default_gray_map_rgb_color(gx_device *dev, const gx_color_value cv[]); int gx_default_gray_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]); int gx_default_rgb_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]); gx_color_index gx_default_rgb_map_rgb_color(gx_device *dev, const gx_color_value cv[]); gx_color_index cmyk_1bit_map_cmyk_color(gx_device *dev, const gx_color_value cv[]); int cmyk_1bit_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]); int (cmyk_1bit_map_color_cmyk)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]); gx_color_index cmyk_8bit_map_cmyk_color(gx_device *dev, const gx_color_value cv[]); int cmyk_8bit_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]); int (cmyk_8bit_map_color_cmyk)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]); gx_color_index (gx_default_8bit_map_gray_color)(gx_device * dev, const gx_color_value colors[]); int (gx_default_8bit_map_color_gray)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]); int gx_forward_close_device(gx_device *dev); void gx_forward_get_initial_matrix(gx_device *dev, gs_matrix *pmat); int gx_forward_sync_output(gx_device *dev); int gx_forward_output_page(gx_device *dev, int num_copies, int flush); gx_color_index gx_forward_map_rgb_color(gx_device *dev, const gx_color_value cv[]); int gx_forward_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]); int gx_forward_fill_rectangle(gx_device *dev, int x, int y, int width, int height, gx_color_index color); 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); 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); 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); int gx_forward_get_bits(gx_device *dev, int y, unsigned char *data, unsigned char **actual_data); int gx_forward_get_params(gx_device *dev, gs_param_list *plist); int gx_forward_put_params(gx_device *dev, gs_param_list *plist); gx_color_index gx_forward_map_cmyk_color(gx_device *dev, const gx_color_value cv[]); const gx_xfont_procs *gx_forward_get_xfont_procs(gx_device *dev); gx_device *gx_forward_get_xfont_device(gx_device *dev); 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); gx_device *gx_forward_get_page_device(gx_device *dev); 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); int gx_forward_get_band(gx_device *dev, int y, int *band_start); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); void gx_forward_get_clipping_box(gx_device *dev, gs_fixed_rect *pbox); 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); int gx_forward_get_bits_rectangle(gx_device *dev, const gs_int_rect *prect, gs_get_bits_params_t *params, gs_int_rect **unread); int gx_forward_map_color_rgb_alpha(gx_device *dev, gx_color_index color, gx_color_value rgba[4]); int gx_forward_get_hardware_params(gx_device *dev, gs_param_list *plist); 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); const gx_cm_color_map_procs * (gx_forward_get_color_mapping_procs)(const gx_device * dev); int (gx_forward_get_color_comp_index)(gx_device * dev, const char * pname, int name_size, int component_type); gx_color_index (gx_forward_encode_color)(gx_device * dev, const gx_color_value colors[]); int (gx_forward_decode_color)(gx_device * dev, gx_color_index cindex, gx_color_value colors[]); int gx_forward_pattern_manage(gx_device *pdev, gx_bitmap_id id, gs_pattern1_instance_t *pinst, pattern_manage_t function); 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); int gx_forward_include_color_space(gx_device *dev, gs_color_space *cspace, const unsigned char *res_name, int name_length); 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 ); 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); 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); int gx_forward_update_spot_equivalent_colors(gx_device *dev, const gs_state * pgs); gs_devn_params * gx_forward_ret_devn_params(gx_device *dev); void gx_device_set_procs(gx_device *); void gx_device_fill_in_procs(gx_device *); void gx_device_forward_fill_in_procs(gx_device_forward *); void gx_device_forward_color_procs(gx_device_forward *); void check_device_separable(gx_device * dev); void set_linear_color_bits_mask_shift(gx_device * dev); void gx_device_copy_color_procs(gx_device *dev, const gx_device *target); gx_color_index gx_device_black(gx_device *dev); gx_color_index gx_device_white(gx_device *dev); void gx_device_decache_colors(gx_device *dev); void gx_device_copy_color_params(gx_device *dev, const gx_device *target); void gx_device_copy_params(gx_device *dev, const gx_device *target); int gx_parse_output_file_name(gs_parsed_file_name_t *pfn, const char **pfmt, const char *fname, unsigned int len); int gx_device_open_output_file(const gx_device * dev, char *fname, bool binary, bool positionable, FILE ** pfile); int gx_device_close_output_file(const gx_device * dev, const char *fname, FILE *file); int gx_finish_output_page(gx_device *dev, int num_copies, int flush); typedef struct gdev_input_media_s { float PageSize[4]; const char *MediaColor; float MediaWeight; const char *MediaType; } gdev_input_media_t; extern const gdev_input_media_t gdev_input_media_default; void gdev_input_media_init(gdev_input_media_t * pim); int gdev_begin_input_media(gs_param_list * mlist, gs_param_dict * pdict, int count); int gdev_write_input_page_size(int index, gs_param_dict * pdict, floatp width_points, floatp height_points); int gdev_write_input_media(int index, gs_param_dict * pdict, const gdev_input_media_t * pim); int gdev_end_input_media(gs_param_list * mlist, gs_param_dict * pdict); typedef struct gdev_output_media_s { const char *OutputType; } gdev_output_media_t; extern const gdev_output_media_t gdev_output_media_default; int gdev_begin_output_media(gs_param_list * mlist, gs_param_dict * pdict, int count); int gdev_write_output_media(int index, gs_param_dict * pdict, const gdev_output_media_t * pom); int gdev_end_output_media(gs_param_list * mlist, gs_param_dict * pdict); void gx_device_request_leadingedge(gx_device *dev, int le_req); typedef struct gx_render_plane_s { int depth; int shift; int index; } gx_render_plane_t; int gx_render_plane_init(gx_render_plane_t *render_plane, const gx_device *dev, int index); typedef struct gx_device_memory_s gx_device_memory; struct gx_device_memory_s { 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; unsigned int raster; unsigned char *base; gs_memory_t *bitmap_memory; bool foreign_bits; gs_memory_t *line_pointer_memory; bool foreign_line_pointers; int num_planes; gx_render_plane_t planes[(8 * 8)]; gs_matrix initial_matrix; unsigned char **line_ptrs; gs_const_string palette; struct _c24 { gx_color_index rgb; bits32 rgbr, gbrg, brgb; } color24; struct _c40 { gx_color_index abcde; bits32 abcd, bcde, cdea, deab, eabc; } color40; struct _c48 { gx_color_index abcdef; bits32 abcd, cdef, efab; } color48; struct _c56 { gx_color_index abcdefg; bits32 abcd, bcde, cdef, defg, efga, fgab, gabc; } color56; struct _c64 { gx_color_index abcdefgh; bits32 abcd, efgh; } color64; gs_log2_scale_point log2_scale; int log2_alpha_bits; int mapped_x; int mapped_y; int mapped_height; int mapped_start; gx_color_index save_color; int plane_depth; int band_y; }; extern const gs_memory_struct_type_t st_device_memory; int gdev_mem_bits_size(const gx_device_memory *mdev, int width, int height, unsigned long *size); unsigned long gdev_mem_line_ptrs_size(const gx_device_memory *mdev, int width, int height); int gdev_mem_data_size(const gx_device_memory *mdev, int width, int height, unsigned long *size); int gdev_mem_max_height(const gx_device_memory * dev, int width, unsigned long size, bool page_uses_transparency); const gx_device_memory *gdev_mem_device_for_bits(int); const gx_device_memory *gdev_mem_word_device_for_bits(int); void gs_make_mem_mono_device(gx_device_memory * mdev, gs_memory_t * mem, gx_device * target); void gs_make_mem_device(gx_device_memory * mdev, const gx_device_memory * mdproto, gs_memory_t * mem, int page_device, gx_device * target); void gs_make_mem_abuf_device(gx_device_memory * adev, gs_memory_t * mem, gx_device * target, const gs_log2_scale_point * pscale, int alpha_bits, int mapped_x); void gs_make_mem_alpha_device(gx_device_memory * adev, gs_memory_t * mem, gx_device * target, int alpha_bits); int gdev_mem_open_scan_lines(gx_device_memory *mdev, int setup_height); int gdev_mem_set_line_ptrs(gx_device_memory *mdev, unsigned char *base, int raster, unsigned char **line_ptrs, int setup_height); void gdev_mem_mono_set_inverted(gx_device_memory * mdev, bool black_is_1); bool gs_device_is_memory(const gx_device *); bool gs_device_is_abuf(const gx_device *); typedef void *clist_file_ptr; struct clist_io_procs_s { int (*fopen)(char fname[260], const char *fmode, clist_file_ptr * pcf, gs_memory_t * mem, gs_memory_t *data_mem, bool ok_to_compress); int (*fclose)(clist_file_ptr cf, const char *fname, bool delete); int (*unlink)(const char *fname); int (*fwrite_chars)(const void *data, unsigned int len, clist_file_ptr cf); int (*fread_chars)(void *data, unsigned int len, clist_file_ptr cf); int (*set_memory_warning)(clist_file_ptr cf, int bytes_left); int (*ferror_code)(clist_file_ptr cf); int64_t (*ftell)(clist_file_ptr cf); void (*rewind)(clist_file_ptr cf, bool discard_data, const char *fname); int (*fseek)(clist_file_ptr cf, int64_t offset, int mode, const char *fname); }; typedef struct clist_io_procs_s clist_io_procs_t; extern const clist_io_procs_t *clist_io_procs_file_global; extern const clist_io_procs_t *clist_io_procs_memory_global; typedef struct gx_band_params_s { bool page_uses_transparency; int BandWidth; int BandHeight; long BandBufferSpace; } gx_band_params_t; typedef struct gx_colors_used_s { gx_color_index or; bool slow_rop; } gx_colors_used_t; typedef struct gx_band_page_info_s { char cfname[260]; clist_file_ptr cfile; char bfname[260]; clist_file_ptr bfile; const clist_io_procs_t *io_procs; unsigned int tile_cache_size; int64_t bfile_end_pos; gx_band_params_t band_params; int scan_lines_per_colors_used; gx_colors_used_t band_colors_used[50]; } gx_band_page_info_t; typedef struct gx_cached_bits_head_s { unsigned int size; unsigned int depth; } gx_cached_bits_head; typedef struct gx_cached_bits_s { gx_cached_bits_head head; unsigned short width, height, shift; unsigned short raster; gx_bitmap_id id; } gx_cached_bits; typedef struct gx_bits_cache_chunk_s gx_bits_cache_chunk; struct gx_bits_cache_chunk_s { gx_bits_cache_chunk *next; unsigned char *data; unsigned int size; unsigned int allocated; }; typedef struct gx_bits_cache_s { gx_bits_cache_chunk *chunks; unsigned int cnext; unsigned int bsize; unsigned int csize; } gx_bits_cache; void gx_bits_cache_init(gx_bits_cache *, gx_bits_cache_chunk *); void gx_bits_cache_chunk_init(gx_bits_cache_chunk *, unsigned char *, unsigned int); int gx_bits_cache_alloc(gx_bits_cache *, unsigned long, gx_cached_bits_head **); void gx_bits_cache_shorten(gx_bits_cache *, gx_cached_bits_head *, unsigned int, gx_bits_cache_chunk *); void gx_bits_cache_free(gx_bits_cache *, gx_cached_bits_head *, gx_bits_cache_chunk *); typedef struct gx_device_buf_space_s { unsigned long bits; unsigned long line_ptrs; unsigned int raster; } gx_device_buf_space_t; typedef struct gx_band_complexity_s { bool uses_color; bool nontrivial_rops; } gx_band_complexity_t; typedef struct gx_device_buf_procs_s { 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); 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); 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); void (*destroy_buf_device)(gx_device *bdev); } gx_device_buf_procs_t; 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); 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); 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); void gx_default_destroy_buf_device(gx_device *bdev); typedef enum { gs_cap_butt = 0, gs_cap_round = 1, gs_cap_square = 2, gs_cap_triangle = 3, gs_cap_unknown = 4 } gs_line_cap; typedef enum { gs_join_miter = 0, gs_join_round = 1, gs_join_bevel = 2, gs_join_none = 3, gs_join_triangle = 4, gs_join_unknown = 5 } gs_line_join; typedef struct gx_dash_params_s { float *pattern; unsigned int pattern_size; float offset; bool adapt; float pattern_length; bool init_ink_on; int init_index; float init_dist_left; } gx_dash_params; typedef struct gx_line_params_s { float half_width; gs_line_cap cap; gs_line_join join; int curve_join; float miter_limit; float miter_check; float dot_length; bool dot_length_absolute; gs_matrix dot_orientation; gx_dash_params dash; } gx_line_params; int gx_set_miter_limit(gx_line_params *, floatp); int gx_set_dash(gx_dash_params *, const float *, unsigned int, floatp, gs_memory_t *); int gx_set_dot_length(gx_line_params *, floatp, bool); struct gs_matrix_fixed_s { float xx, xy, yx, yy, tx, ty; fixed tx_fixed, ty_fixed; bool txy_fixed_valid; }; typedef struct gs_matrix_fixed_s gs_matrix_fixed; int gs_matrix_fixed_from_matrix(gs_matrix_fixed *, const gs_matrix *); int gs_point_transform2fixed(const gs_matrix_fixed *, floatp, floatp, gs_fixed_point *); int gs_distance_transform2fixed(const gs_matrix_fixed *, floatp, floatp, gs_fixed_point *); int gs_point_transform2fixed_rounding(const gs_matrix_fixed * pmat, floatp x, floatp y, gs_fixed_point * ppt); typedef struct { long xx, xy, yx, yy; int skewed; int shift; int max_bits; fixed round; } fixed_coeff; fixed fixed_coeff_mult(fixed, long, const fixed_coeff *, int); typedef unsigned long gx_bitmap_format_t; typedef struct gx_device_clist_writer_s gx_device_clist_writer; typedef struct gs_composite_type_procs_s { int (*create_default_compositor)(const gs_composite_t *pcte, gx_device **pcdev, gx_device *dev, gs_imager_state *pis, gs_memory_t *mem); bool (*equal)(const gs_composite_t *pcte, const gs_composite_t *pcte2); int (*write)(const gs_composite_t *pcte, unsigned char *data, unsigned int *psize, gx_device_clist_writer *cdev); int (*read)(gs_composite_t **ppcte, const unsigned char *data, unsigned int size, gs_memory_t *mem); int (*adjust_ctm)(gs_composite_t *pcte, int x0, int y0, gs_imager_state *pis); int (*is_closing)(const gs_composite_t *this, gs_composite_t **pcte, gx_device *dev); bool (*is_friendly)(const gs_composite_t *this, unsigned char cmd0, unsigned char cmd1); int (*clist_compositor_write_update)(const gs_composite_t * pcte, gx_device * dev, gx_device ** pcdev, gs_imager_state * pis, gs_memory_t * mem); int (*clist_compositor_read_update)(gs_composite_t * pcte, gx_device * cdev, gx_device * tdev, gs_imager_state * pis, gs_memory_t * mem); int (*get_cropping)(const gs_composite_t * pcte, int *ry, int *rheight); } gs_composite_type_procs_t; typedef struct gs_composite_type_s { unsigned char comp_id; gs_composite_type_procs_t procs; } gs_composite_type_t; 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); int gx_default_composite_adjust_ctm(gs_composite_t *pcte, int x0, int y0, gs_imager_state *pis); int gx_default_composite_is_closing(const gs_composite_t *this, gs_composite_t **pcte, gx_device *dev); bool gx_default_composite_is_friendly(const gs_composite_t *this, unsigned char cmd0, unsigned char cmd1); 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); int gx_default_composite_get_cropping(const gs_composite_t * pcte, int *ry, int *rheight); struct gs_composite_s { const gs_composite_type_t *type; gs_id id; bool idle; struct gs_composite_s *prev, *next; }; typedef enum { PDF14_PUSH_DEVICE, PDF14_POP_DEVICE, PDF14_BEGIN_TRANS_GROUP, PDF14_END_TRANS_GROUP, PDF14_BEGIN_TRANS_MASK, PDF14_END_TRANS_MASK, PDF14_SET_BLEND_PARAMS } pdf14_compositor_operations; typedef struct gs_transparency_source_s { float alpha; } gs_transparency_source_t; struct gs_pdf14trans_params_s { pdf14_compositor_operations pdf14_op; int num_spot_colors; int changed; bool Isolated; bool Knockout; bool image_with_SMask; gs_rect bbox; gs_transparency_channel_selector_t csel; gs_transparency_mask_subtype_t subtype; int Background_components; bool function_is_identity; float Background[(8)]; float GrayBackground; gs_function_t *transfer_function; unsigned char transfer_fn[256]; gs_blend_mode_t blend_mode; bool text_knockout; gs_transparency_source_t opacity; gs_transparency_source_t shape; bool mask_is_image; gs_matrix ctm; bool replacing; bool idle; unsigned int mask_id; }; typedef struct gs_pdf14trans_params_s gs_pdf14trans_params_t; typedef struct gs_pdf14trans_s { const gs_composite_type_t *type; gs_id id; bool idle; struct gs_composite_s *prev, *next; gs_pdf14trans_params_t params; } gs_pdf14trans_t; int gs_setblendmode(gs_state *, gs_blend_mode_t); gs_blend_mode_t gs_currentblendmode(const gs_state *); int gs_setopacityalpha(gs_state *, floatp); float gs_currentopacityalpha(const gs_state *); int gs_setshapealpha(gs_state *, floatp); float gs_currentshapealpha(const gs_state *); int gs_settextknockout(gs_state *, bool); bool gs_currenttextknockout(const gs_state *); gs_transparency_state_type_t gs_current_transparency_type(const gs_state *pgs); int gs_push_pdf14trans_device(gs_state * pgs); int gs_pop_pdf14trans_device(gs_state * pgs); void gs_trans_group_params_init(gs_transparency_group_params_t *ptgp); int gs_begin_transparency_group(gs_state * pgs, const gs_transparency_group_params_t *ptgp, const gs_rect *pbbox); int gs_end_transparency_group(gs_state *pgs); void gs_trans_mask_params_init(gs_transparency_mask_params_t *ptmp, gs_transparency_mask_subtype_t subtype); int gs_begin_transparency_mask(gs_state *pgs, const gs_transparency_mask_params_t *ptmp, const gs_rect *pbbox, bool mask_is_image); int gs_end_transparency_mask(gs_state *pgs, gs_transparency_channel_selector_t csel); int gs_discard_transparency_layer(gs_state *pgs); int gx_begin_transparency_group(gs_imager_state * pis, gx_device * pdev, const gs_pdf14trans_params_t * pparams); int gx_end_transparency_group(gs_imager_state * pis, gx_device * pdev); int gx_begin_transparency_mask(gs_imager_state * pis, gx_device * pdev, const gs_pdf14trans_params_t * pparams); int gx_end_transparency_mask(gs_imager_state * pis, gx_device * pdev, const gs_pdf14trans_params_t * pparams); int gx_discard_transparency_layer(gs_imager_state *pis); int gs_is_pdf14trans_compositor(const gs_composite_t * pct); typedef struct gs_halftone_s gs_halftone; typedef struct gx_transfer_s { int red_component_num; gx_transfer_map *red; int green_component_num; gx_transfer_map *green; int blue_component_num; gx_transfer_map *blue; int gray_component_num; gx_transfer_map *gray; } gx_transfer; typedef struct gs_devicen_color_map_s { bool use_alt_cspace; separation_type sep_type; unsigned int num_components; unsigned int num_colorants; gs_id cspace_id; int color_map[(8)]; } gs_devicen_color_map; struct gs_imager_state_s { 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; }; int gs_imager_state_initialize(gs_imager_state * pis, gs_memory_t * mem); gs_imager_state * gs_imager_state_copy(const gs_imager_state * pis, gs_memory_t * mem); void gs_imager_state_copied(gs_imager_state * pis); void gs_imager_state_pre_assign(gs_imager_state *to, const gs_imager_state *from); void gs_imager_state_release(gs_imager_state * pis); int gs_currentscreenphase_pis(const gs_imager_state *, gs_int_point *, gs_color_select_t); typedef struct gx_saved_page_s { gx_device device; char dname[8 + 1]; gx_band_page_info_t info; int num_copies; } gx_saved_page; typedef struct gx_placed_page_s { gx_saved_page *page; gs_int_point offset; } gx_placed_page; typedef struct { unsigned long offset; } tile_hash; typedef struct { gx_cached_bits_head head; unsigned short width, height, shift; unsigned short raster; gx_bitmap_id id; unsigned char x_reps, y_reps; unsigned short rep_shift; unsigned short index; unsigned short num_bands; } tile_slot; typedef struct cmd_prefix_s cmd_prefix; struct cmd_prefix_s { cmd_prefix *next; unsigned int size; unsigned long id; }; typedef struct cmd_list_s { cmd_prefix *head, *tail; } cmd_list; extern const gs_imager_state clist_imager_state_initial; typedef struct gx_clist_state_s gx_clist_state; typedef struct gx_device_clist_common_s { 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; } gx_device_clist_common; typedef struct clist_writer_cropping_buffer_s clist_writer_cropping_buffer_t; struct clist_writer_cropping_buffer_s { int cropping_min, cropping_max; unsigned int mask_id, temp_mask_id; clist_writer_cropping_buffer_t *next; }; typedef struct clist_color_space_s { unsigned char byte1; gs_id id; const gs_color_space *space; } clist_color_space_t; struct gx_device_clist_writer_s { 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; int error_code; gx_clist_state *states; unsigned char *cbuf; unsigned char *cnext; unsigned char *cend; cmd_list *ccl; cmd_list band_range_list; int band_range_min, band_range_max; unsigned int tile_max_size; unsigned int tile_max_count; gx_strip_bitmap tile_params; int tile_depth; int tile_known_min, tile_known_max; gs_imager_state imager_state; float dash_pattern[11]; const gx_clip_path *clip_path; gs_id clip_path_id; clist_color_space_t color_space; gs_id transfer_ids[4]; gs_id black_generation_id; gs_id undercolor_removal_id; gs_id device_halftone_id; gs_id image_enum_id; int error_is_retryable; int permanent_error; int driver_call_nesting; int ignore_lo_mem_warnings; int (*free_up_bandlist_memory)(gx_device *dev, bool flush_current); int disable_mask; gs_pattern1_instance_t *pinst; int cropping_min, cropping_max; int save_cropping_min, save_cropping_max; int cropping_level; clist_writer_cropping_buffer_t *cropping_stack; unsigned long ins_count; unsigned int mask_id_count; unsigned int mask_id; unsigned int temp_mask_id; }; typedef struct clist_render_thread_control_s clist_render_thread_control_t; typedef struct gx_device_clist_reader_s { 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; gx_render_plane_t yplane; const gx_placed_page *pages; int num_pages; gx_band_complexity_t *band_complexity_array; void *offset_map; int num_render_threads; clist_render_thread_control_t *render_threads; unsigned char *main_thread_data; int curr_render_thread; int thread_lookahead_direction; } gx_device_clist_reader; union gx_device_clist_s { gx_device_clist_common common; gx_device_clist_reader reader; gx_device_clist_writer writer; }; typedef union gx_device_clist_s gx_device_clist; extern const gs_memory_struct_type_t st_device_clist; extern const gx_device_procs gs_clist_device_procs; void clist_init_io_procs(gx_device_clist *pclist_dev, bool in_memory); int clist_finish_page(gx_device * dev, bool flush); int clist_close_output_file(gx_device *dev); int clist_close_page_info(gx_band_page_info_t *ppi); void clist_compute_colors_used(gx_device_clist_writer *cldev); typedef struct gx_device_printer_s gx_device_printer; int clist_setup_params(gx_device *dev); int clist_render_rectangle(gx_device_clist *cdev, const gs_int_rect *prect, gx_device *bdev, const gx_render_plane_t *render_plane, bool clear); gx_band_complexity_t * clist_get_band_complexity(gx_device *dev, int y); void gx_clist_reader_free_band_complexity_array(gx_device_clist *cldev); void clist_copy_band_complexity(gx_band_complexity_t *this, const gx_band_complexity_t *from); int clist_data_size(const gx_device_clist *cdev, int select); int clist_get_data(const gx_device_clist *cdev, int select, int offset, unsigned char *buf, int length); int clist_put_data(const gx_device_clist *cdev, int select, int offset, const unsigned char *buf, int length); int clist_render_init(gx_device_clist *dev); int clist_close_writer_and_init_reader(gx_device_clist *cldev); void clist_select_render_plane(gx_device *dev, int y, int height, gx_render_plane_t *render_plane, int index); int clist_rasterize_lines(gx_device *dev, int y, int lineCount, gx_device *bdev, const gx_render_plane_t *render_plane, int *pmy); int clist_enable_multi_thread_render(gx_device *dev); void clist_teardown_render_threads(gx_device *dev); typedef struct gdev_prn_start_render_params_s gdev_prn_start_render_params; typedef struct gx_page_queue_s gx_page_queue_t; typedef struct gdev_prn_space_params_s gdev_prn_space_params; typedef struct gx_printer_device_procs_s { int (*print_page)(gx_device_printer *, FILE *); int (*print_page_copies)(gx_device_printer *, FILE *, int); gx_device_buf_procs_t buf_procs; void (*get_space_params)(const gx_device_printer *, gdev_prn_space_params *); int (*start_render_thread)(gdev_prn_start_render_params *); int (*open_render_device)(gx_device_printer *); int (*close_render_device)(gx_device_printer *); int (*buffer_page)(gx_device_printer *, FILE *, int); } gx_printer_device_procs; typedef enum { BandingAuto = 0, BandingAlways, BandingNever } gdev_prn_banding_type; struct gdev_prn_space_params_s { long MaxBitmap; long BufferSpace; gx_band_params_t band; bool params_are_read_only; gdev_prn_banding_type banding_type; }; struct gx_device_printer_s { 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; 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; }; extern const gs_memory_struct_type_t st_device_printer; typedef int (*dev_proc_print_page_t)(gx_device_printer *, FILE *); int gdev_prn_open(gx_device *dev); int gdev_prn_output_page(gx_device *dev, int num_copies, int flush); int gdev_prn_close(gx_device *dev); int gdev_prn_get_params(gx_device *dev, gs_param_list *plist); int gdev_prn_put_params(gx_device *dev, gs_param_list *plist); void gx_default_get_space_params(const gx_device_printer *, gdev_prn_space_params *); int gx_default_start_render_thread(gdev_prn_start_render_params *); int gx_default_open_render_device(gx_device_printer *); int gx_default_close_render_device(gx_device_printer *); int gx_default_buffer_page(gx_device_printer *, FILE *, int); extern const gx_device_procs prn_std_procs; int gdev_prn_open_printer_seekable(gx_device *dev, bool binary_mode, bool seekable); int gdev_prn_open_printer(gx_device * dev, bool binary_mode); bool gdev_prn_file_is_new(const gx_device_printer *pdev); int gdev_prn_colors_used(gx_device *dev, int y, int height, gx_colors_used_t *colors_used, int *range_start); int gx_page_info_colors_used(const gx_device *dev, const gx_band_page_info_t *page_info, int y, int height, gx_colors_used_t *colors_used, int *range_start); int gdev_prn_render_rectangle(gx_device_printer *pdev, const gs_int_rect *prect, gx_device *target, const gx_render_plane_t *render_plane, bool clear); int gdev_prn_get_lines(gx_device_printer *pdev, int y, int height, unsigned char *buffer, unsigned int bytes_per_line, unsigned char **actual_buffer, unsigned int *actual_bytes_per_line, const gx_render_plane_t *render_plane); int gdev_prn_get_bits(gx_device_printer *pdev, int y, unsigned char *buffer, unsigned char **actual_buffer); int gdev_prn_copy_scan_lines(gx_device_printer *, int, unsigned char *, unsigned int); void gdev_prn_clear_trailing_bits(unsigned char *data, unsigned int raster, int height, const gx_device *dev); int gdev_prn_close_printer(gx_device *); int gx_print_page_single_copy(gx_device_printer *, FILE *); int gx_default_print_page_copies(gx_device_printer *, FILE *, int); int gdev_prn_print_scan_lines(gx_device *); int gdev_prn_allocate_memory(gx_device *pdev, gdev_prn_space_params *space, int new_width, int new_height); int gdev_prn_reallocate_memory(gx_device *pdev, gdev_prn_space_params *space, int new_width, int new_height); int gdev_prn_free_memory(gx_device *pdev); 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); int gdev_create_buf_device(create_buf_device_proc_t cbd_proc, 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); int gdev_prn_initialize(gx_device *, const char *, int (*)(gx_device_printer *, FILE *)); 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])); typedef long int wchar_t; typedef struct { int quot; int rem; } div_t; typedef struct { long int quot; long int rem; } ldiv_t; extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__)) ; extern double atof (__const char *__nptr) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; extern int atoi (__const char *__nptr) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; extern long int atol (__const char *__nptr) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; __extension__ extern long long int atoll (__const char *__nptr) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; extern double strtod (__const char *__restrict __nptr, char **__restrict __endptr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; extern long int strtol (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; extern unsigned long int strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; __extension__ extern long long int strtoq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; __extension__ extern unsigned long long int strtouq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; __extension__ extern long long int strtoll (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; __extension__ extern unsigned long long int strtoull (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; extern __inline double __attribute__ ((__nothrow__)) atof (__const char *__nptr) { return strtod (__nptr, (char **) ((void *)0)); } extern __inline int __attribute__ ((__nothrow__)) atoi (__const char *__nptr) { return (int) strtol (__nptr, (char **) ((void *)0), 10); } extern __inline long int __attribute__ ((__nothrow__)) atol (__const char *__nptr) { return strtol (__nptr, (char **) ((void *)0), 10); } __extension__ extern __inline long long int __attribute__ ((__nothrow__)) atoll (__const char *__nptr) { return strtoll (__nptr, (char **) ((void *)0), 10); } extern char *l64a (long int __n) __attribute__ ((__nothrow__)) ; extern long int a64l (__const char *__s) __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; extern long int random (void) __attribute__ ((__nothrow__)); extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__)); extern char *initstate (unsigned int __seed, char *__statebuf, size_t __statelen) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2))); extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); struct random_data { int32_t *fptr; int32_t *rptr; int32_t *state; int rand_type; int rand_deg; int rand_sep; int32_t *end_ptr; }; extern int random_r (struct random_data *__restrict __buf, int32_t *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern int srandom_r (unsigned int __seed, struct random_data *__buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2))); extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, size_t __statelen, struct random_data *__restrict __buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 4))); extern int setstate_r (char *__restrict __statebuf, struct random_data *__restrict __buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern int rand (void) __attribute__ ((__nothrow__)); extern void srand (unsigned int __seed) __attribute__ ((__nothrow__)); extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__)); extern double drand48 (void) __attribute__ ((__nothrow__)); extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); extern long int lrand48 (void) __attribute__ ((__nothrow__)); extern long int nrand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); extern long int mrand48 (void) __attribute__ ((__nothrow__)); extern long int jrand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); extern void srand48 (long int __seedval) __attribute__ ((__nothrow__)); extern unsigned short int *seed48 (unsigned short int __seed16v[3]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); struct drand48_data { unsigned short int __x[3]; unsigned short int __old_x[3]; unsigned short int __c; unsigned short int __init; unsigned long long int __a; }; extern int drand48_r (struct drand48_data *__restrict __buffer, double *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern int erand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, double *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern int lrand48_r (struct drand48_data *__restrict __buffer, long int *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern int nrand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, long int *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern int mrand48_r (struct drand48_data *__restrict __buffer, long int *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern int jrand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, long int *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern int srand48_r (long int __seedval, struct drand48_data *__buffer) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2))); extern int seed48_r (unsigned short int __seed16v[3], struct drand48_data *__buffer) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern int lcong48_r (unsigned short int __param[7], struct drand48_data *__buffer) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern void *realloc (void *__ptr, size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__)); extern void free (void *__ptr) __attribute__ ((__nothrow__)); extern void cfree (void *__ptr) __attribute__ ((__nothrow__)); extern void *alloca (size_t __size) __attribute__ ((__nothrow__)); extern void *valloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ; extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; extern void abort (void) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__)); extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); extern void exit (int __status) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__)); extern char *getenv (__const char *__name) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; extern char *__secure_getenv (__const char *__name) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; extern int putenv (char *__string) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); extern int setenv (__const char *__name, __const char *__value, int __replace) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2))); extern int unsetenv (__const char *__name) __attribute__ ((__nothrow__)); extern int clearenv (void) __attribute__ ((__nothrow__)); extern char *mktemp (char *__template) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; extern int mkstemp64 (char *__template) __attribute__ ((__nonnull__ (1))) ; extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; extern int system (__const char *__command) ; extern char *realpath (__const char *__restrict __name, char *__restrict __resolved) __attribute__ ((__nothrow__)) ; typedef int (*__compar_fn_t) (__const void *, __const void *); extern void *bsearch (__const void *__key, __const void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 2, 5))) ; extern void qsort (void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); extern int abs (int __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ; extern long int labs (long int __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ; extern div_t div (int __numer, int __denom) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ; extern ldiv_t ldiv (long int __numer, long int __denom) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ; extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ; extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ; extern char *gcvt (double __value, int __ndigit, char *__buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3))) ; extern char *qecvt (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ; extern char *qfcvt (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ; extern char *qgcvt (long double __value, int __ndigit, char *__buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3))) ; extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5))); extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5))); extern int qecvt_r (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5))); extern int qfcvt_r (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5))); extern int mblen (__const char *__s, size_t __n) __attribute__ ((__nothrow__)) ; extern int mbtowc (wchar_t *__restrict __pwc, __const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__)) ; extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__)) ; extern size_t mbstowcs (wchar_t *__restrict __pwcs, __const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__)); extern size_t wcstombs (char *__restrict __s, __const wchar_t *__restrict __pwcs, size_t __n) __attribute__ ((__nothrow__)); extern int rpmatch (__const char *__response) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ; extern int posix_openpt (int __oflag) ; extern int getloadavg (double __loadavg[], int __nelem) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); typedef struct WImage WImage; typedef struct Rectangle Rectangle; typedef struct Point Point; struct Point { int x; int y; }; struct Rectangle { Point min; Point max; }; static Point ZP = { 0, 0 }; static WImage* initwriteimage(FILE *f, Rectangle r, int ldepth); static int writeimageblock(WImage *w, unsigned char *data, int ndata); static int bytesperline(Rectangle, int); static int rgb2cmap(int, int, int); static long cmap2rgb(int); static gx_color_index inferno_rgb2cmap(gx_device *dev, const gx_color_value cv[]); static int inferno_cmap2rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3]); static int inferno_open(gx_device *dev); static int inferno_close(gx_device *dev); static int inferno_print_page(gx_device_printer *, FILE *); typedef struct inferno_device_s { 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; 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; int ldepth; int lastldepth; int color, gray; int cmapcall; int nbits; } inferno_device; static const gx_device_procs inferno_procs = { 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) }; inferno_device gs_inferno_device = { 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 } }; static gx_color_index inferno_rgb2cmap(gx_device *dev, const gx_color_value cv[]) { int shift; inferno_device *bdev = (inferno_device*) dev; int nbits = bdev->nbits; int mask = (1< nbits) { shift = (sizeof(gx_color_value) * 8) - nbits; red >>= shift; green >>= shift; blue >>= shift; } else if((sizeof(gx_color_value) * 8) < nbits) { shift = nbits - (sizeof(gx_color_value) * 8); red <<= shift; green <<= shift; blue <<= shift; } red &= mask; green &= mask; blue &= mask; if(red == green && green == blue && red != 0 && red != mask) { if(red == 5 || red == 10) { if(bdev->ldepth < 1) bdev->ldepth = 1; } else { if(bdev->ldepth < 2) bdev->ldepth = 2; } } else bdev->ldepth = 3; bdev->cmapcall = 1; return ((((blue<<4)|green)<<4)|red); }