1*5e7646d2SAndroid Build Coastguard Worker /* 2*5e7646d2SAndroid Build Coastguard Worker * Private image library definitions for CUPS. 3*5e7646d2SAndroid Build Coastguard Worker * 4*5e7646d2SAndroid Build Coastguard Worker * Copyright © 2007-2019 by Apple Inc. 5*5e7646d2SAndroid Build Coastguard Worker * Copyright © 1993-2006 by Easy Software Products. 6*5e7646d2SAndroid Build Coastguard Worker * 7*5e7646d2SAndroid Build Coastguard Worker * Licensed under Apache License v2.0. See the file "LICENSE" for more 8*5e7646d2SAndroid Build Coastguard Worker * information. 9*5e7646d2SAndroid Build Coastguard Worker */ 10*5e7646d2SAndroid Build Coastguard Worker 11*5e7646d2SAndroid Build Coastguard Worker #ifndef _CUPS_RASTER_PRIVATE_H_ 12*5e7646d2SAndroid Build Coastguard Worker # define _CUPS_RASTER_PRIVATE_H_ 13*5e7646d2SAndroid Build Coastguard Worker 14*5e7646d2SAndroid Build Coastguard Worker /* 15*5e7646d2SAndroid Build Coastguard Worker * Include necessary headers... 16*5e7646d2SAndroid Build Coastguard Worker */ 17*5e7646d2SAndroid Build Coastguard Worker 18*5e7646d2SAndroid Build Coastguard Worker # include "raster.h" 19*5e7646d2SAndroid Build Coastguard Worker # include <cups/cups.h> 20*5e7646d2SAndroid Build Coastguard Worker # include <cups/debug-private.h> 21*5e7646d2SAndroid Build Coastguard Worker # include <cups/string-private.h> 22*5e7646d2SAndroid Build Coastguard Worker # ifdef _WIN32 23*5e7646d2SAndroid Build Coastguard Worker # include <io.h> 24*5e7646d2SAndroid Build Coastguard Worker # include <winsock2.h> /* for htonl() definition */ 25*5e7646d2SAndroid Build Coastguard Worker # else 26*5e7646d2SAndroid Build Coastguard Worker # include <unistd.h> 27*5e7646d2SAndroid Build Coastguard Worker # include <fcntl.h> 28*5e7646d2SAndroid Build Coastguard Worker # endif /* _WIN32 */ 29*5e7646d2SAndroid Build Coastguard Worker 30*5e7646d2SAndroid Build Coastguard Worker # ifdef __cplusplus 31*5e7646d2SAndroid Build Coastguard Worker extern "C" { 32*5e7646d2SAndroid Build Coastguard Worker # endif /* __cplusplus */ 33*5e7646d2SAndroid Build Coastguard Worker 34*5e7646d2SAndroid Build Coastguard Worker 35*5e7646d2SAndroid Build Coastguard Worker /* 36*5e7646d2SAndroid Build Coastguard Worker * Structure... 37*5e7646d2SAndroid Build Coastguard Worker */ 38*5e7646d2SAndroid Build Coastguard Worker 39*5e7646d2SAndroid Build Coastguard Worker struct _cups_raster_s /**** Raster stream data ****/ 40*5e7646d2SAndroid Build Coastguard Worker { 41*5e7646d2SAndroid Build Coastguard Worker unsigned sync; /* Sync word from start of stream */ 42*5e7646d2SAndroid Build Coastguard Worker void *ctx; /* File descriptor */ 43*5e7646d2SAndroid Build Coastguard Worker cups_raster_iocb_t iocb; /* IO callback */ 44*5e7646d2SAndroid Build Coastguard Worker cups_mode_t mode; /* Read/write mode */ 45*5e7646d2SAndroid Build Coastguard Worker cups_page_header2_t header; /* Raster header for current page */ 46*5e7646d2SAndroid Build Coastguard Worker unsigned rowheight, /* Row height in lines */ 47*5e7646d2SAndroid Build Coastguard Worker count, /* Current row run-length count */ 48*5e7646d2SAndroid Build Coastguard Worker remaining, /* Remaining rows in page image */ 49*5e7646d2SAndroid Build Coastguard Worker bpp; /* Bytes per pixel/color */ 50*5e7646d2SAndroid Build Coastguard Worker unsigned char *pixels, /* Pixels for current row */ 51*5e7646d2SAndroid Build Coastguard Worker *pend, /* End of pixel buffer */ 52*5e7646d2SAndroid Build Coastguard Worker *pcurrent; /* Current byte in pixel buffer */ 53*5e7646d2SAndroid Build Coastguard Worker int compressed, /* Non-zero if data is compressed */ 54*5e7646d2SAndroid Build Coastguard Worker swapped; /* Non-zero if data is byte-swapped */ 55*5e7646d2SAndroid Build Coastguard Worker unsigned char *buffer, /* Read/write buffer */ 56*5e7646d2SAndroid Build Coastguard Worker *bufptr, /* Current (read) position in buffer */ 57*5e7646d2SAndroid Build Coastguard Worker *bufend; /* End of current (read) buffer */ 58*5e7646d2SAndroid Build Coastguard Worker size_t bufsize; /* Buffer size */ 59*5e7646d2SAndroid Build Coastguard Worker # ifdef DEBUG 60*5e7646d2SAndroid Build Coastguard Worker size_t iostart, /* Start of read/write buffer */ 61*5e7646d2SAndroid Build Coastguard Worker iocount; /* Number of bytes read/written */ 62*5e7646d2SAndroid Build Coastguard Worker # endif /* DEBUG */ 63*5e7646d2SAndroid Build Coastguard Worker unsigned apple_page_count;/* Apple raster page count */ 64*5e7646d2SAndroid Build Coastguard Worker }; 65*5e7646d2SAndroid Build Coastguard Worker 66*5e7646d2SAndroid Build Coastguard Worker 67*5e7646d2SAndroid Build Coastguard Worker #if 0 68*5e7646d2SAndroid Build Coastguard Worker /* 69*5e7646d2SAndroid Build Coastguard Worker * min/max macros... 70*5e7646d2SAndroid Build Coastguard Worker */ 71*5e7646d2SAndroid Build Coastguard Worker 72*5e7646d2SAndroid Build Coastguard Worker # ifndef max 73*5e7646d2SAndroid Build Coastguard Worker # define max(a,b) ((a) > (b) ? (a) : (b)) 74*5e7646d2SAndroid Build Coastguard Worker # endif /* !max */ 75*5e7646d2SAndroid Build Coastguard Worker # ifndef min 76*5e7646d2SAndroid Build Coastguard Worker # define min(a,b) ((a) < (b) ? (a) : (b)) 77*5e7646d2SAndroid Build Coastguard Worker # endif /* !min */ 78*5e7646d2SAndroid Build Coastguard Worker #endif // 0 79*5e7646d2SAndroid Build Coastguard Worker 80*5e7646d2SAndroid Build Coastguard Worker 81*5e7646d2SAndroid Build Coastguard Worker /* 82*5e7646d2SAndroid Build Coastguard Worker * Prototypes... 83*5e7646d2SAndroid Build Coastguard Worker */ 84*5e7646d2SAndroid Build Coastguard Worker 85*5e7646d2SAndroid Build Coastguard Worker extern void _cupsRasterAddError(const char *f, ...) _CUPS_FORMAT(1,2) _CUPS_PRIVATE; 86*5e7646d2SAndroid Build Coastguard Worker extern void _cupsRasterClearError(void) _CUPS_PRIVATE; 87*5e7646d2SAndroid Build Coastguard Worker extern const char *_cupsRasterColorSpaceString(cups_cspace_t cspace) _CUPS_PRIVATE; 88*5e7646d2SAndroid Build Coastguard Worker extern void _cupsRasterDelete(cups_raster_t *r) _CUPS_PRIVATE; 89*5e7646d2SAndroid Build Coastguard Worker extern const char *_cupsRasterErrorString(void) _CUPS_PRIVATE; 90*5e7646d2SAndroid Build Coastguard Worker extern int _cupsRasterInitPWGHeader(cups_page_header2_t *h, pwg_media_t *media, const char *type, int xdpi, int ydpi, const char *sides, const char *sheet_back) _CUPS_PRIVATE; 91*5e7646d2SAndroid Build Coastguard Worker extern cups_raster_t *_cupsRasterNew(cups_raster_iocb_t iocb, void *ctx, cups_mode_t mode) _CUPS_PRIVATE; 92*5e7646d2SAndroid Build Coastguard Worker extern unsigned _cupsRasterReadHeader(cups_raster_t *r) _CUPS_PRIVATE; 93*5e7646d2SAndroid Build Coastguard Worker extern unsigned _cupsRasterReadPixels(cups_raster_t *r, unsigned char *p, unsigned len) _CUPS_PRIVATE; 94*5e7646d2SAndroid Build Coastguard Worker extern unsigned _cupsRasterWriteHeader(cups_raster_t *r) _CUPS_PRIVATE; 95*5e7646d2SAndroid Build Coastguard Worker extern unsigned _cupsRasterWritePixels(cups_raster_t *r, unsigned char *p, unsigned len) _CUPS_PRIVATE; 96*5e7646d2SAndroid Build Coastguard Worker 97*5e7646d2SAndroid Build Coastguard Worker # ifdef __cplusplus 98*5e7646d2SAndroid Build Coastguard Worker } 99*5e7646d2SAndroid Build Coastguard Worker # endif /* __cplusplus */ 100*5e7646d2SAndroid Build Coastguard Worker 101*5e7646d2SAndroid Build Coastguard Worker #endif /* !_CUPS_RASTER_PRIVATE_H_ */ 102