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