/*
- * "$Id$"
+ * Private image library definitions for CUPS.
*
- * Private image library definitions for CUPS.
+ * Copyright © 2007-2018 by Apple Inc.
+ * Copyright © 1993-2006 by Easy Software Products.
*
- * Copyright 2007-2011 by Apple Inc.
- * Copyright 1993-2006 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * This file is subject to the Apple OS-Developed Software exception.
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more
+ * information.
*/
#ifndef _CUPS_RASTER_PRIVATE_H_
# include <cups/cups.h>
# include <cups/debug-private.h>
# include <cups/string-private.h>
-# ifdef WIN32
+# ifdef _WIN32
# include <io.h>
# include <winsock2.h> /* for htonl() definition */
# else
# include <unistd.h>
# include <fcntl.h>
-# endif /* WIN32 */
+# endif /* _WIN32 */
+
+# ifdef __cplusplus
+extern "C" {
+# endif /* __cplusplus */
+
+
+/*
+ * Structure...
+ */
+
+struct _cups_raster_s /**** Raster stream data ****/
+{
+ unsigned sync; /* Sync word from start of stream */
+ void *ctx; /* File descriptor */
+ cups_raster_iocb_t iocb; /* IO callback */
+ cups_mode_t mode; /* Read/write mode */
+ cups_page_header2_t header; /* Raster header for current page */
+ unsigned rowheight, /* Row height in lines */
+ count, /* Current row run-length count */
+ remaining, /* Remaining rows in page image */
+ bpp; /* Bytes per pixel/color */
+ unsigned char *pixels, /* Pixels for current row */
+ *pend, /* End of pixel buffer */
+ *pcurrent; /* Current byte in pixel buffer */
+ int compressed, /* Non-zero if data is compressed */
+ swapped; /* Non-zero if data is byte-swapped */
+ unsigned char *buffer, /* Read/write buffer */
+ *bufptr, /* Current (read) position in buffer */
+ *bufend; /* End of current (read) buffer */
+ size_t bufsize; /* Buffer size */
+# ifdef DEBUG
+ size_t iostart, /* Start of read/write buffer */
+ iocount; /* Number of bytes read/written */
+# endif /* DEBUG */
+ unsigned apple_page_count;/* Apple raster page count */
+};
+#if 0
/*
- * min/max/abs macros...
+ * min/max macros...
*/
# ifndef max
# ifndef min
# define min(a,b) ((a) < (b) ? (a) : (b))
# endif /* !min */
-# ifndef abs
-# define abs(a) ((a) < 0 ? -(a) : (a))
-# endif /* !abs */
+#endif // 0
/*
* Prototypes...
*/
-extern int _cupsRasterExecPS(cups_page_header2_t *h,
- int *preferred_bits,
- const char *code);
-extern void _cupsRasterAddError(const char *f, ...);
-extern void _cupsRasterClearError(void);
+extern void _cupsRasterAddError(const char *f, ...) _CUPS_FORMAT(1,2) _CUPS_PRIVATE;
+extern void _cupsRasterClearError(void) _CUPS_PRIVATE;
+extern const char *_cupsRasterColorSpaceString(cups_cspace_t cspace) _CUPS_PRIVATE;
+extern void _cupsRasterDelete(cups_raster_t *r) _CUPS_PRIVATE;
+extern const char *_cupsRasterErrorString(void) _CUPS_PRIVATE;
+extern int _cupsRasterExecPS(cups_page_header2_t *h, int *preferred_bits, const char *code) _CUPS_NONNULL(3) _CUPS_PRIVATE;
+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;
+extern cups_raster_t *_cupsRasterNew(cups_raster_iocb_t iocb, void *ctx, cups_mode_t mode) _CUPS_PRIVATE;
+extern unsigned _cupsRasterReadHeader(cups_raster_t *r) _CUPS_PRIVATE;
+extern unsigned _cupsRasterReadPixels(cups_raster_t *r, unsigned char *p, unsigned len) _CUPS_PRIVATE;
+extern unsigned _cupsRasterWriteHeader(cups_raster_t *r) _CUPS_PRIVATE;
+extern unsigned _cupsRasterWritePixels(cups_raster_t *r, unsigned char *p, unsigned len) _CUPS_PRIVATE;
-#endif /* !_CUPS_RASTER_PRIVATE_H_ */
+# ifdef __cplusplus
+}
+# endif /* __cplusplus */
-/*
- * End of "$Id$".
- */
+#endif /* !_CUPS_RASTER_PRIVATE_H_ */