]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/raster.h
Another clang warning...
[thirdparty/cups.git] / cups / raster.h
index 86d4a255c11ead3937a287b0e42306db18a36cbe..7d98a4e8ae68debaa2354eb876e080cc7680ad99 100644 (file)
@@ -1,20 +1,13 @@
 /*
- * "$Id$"
+ * Raster file definitions for CUPS.
  *
- *   Raster file definitions for the Common UNIX Printing System (CUPS).
+ * Copyright © 2007-2018 by Apple Inc.
+ * Copyright © 1997-2006 by Easy Software Products.
  *
- *   Copyright 2007-2008 by Apple Inc.
- *   Copyright 1997-2006 by Easy Software Products.
+ * This file is part of the CUPS Imaging library.
  *
- *   This file is part of the CUPS Imaging library.
- *
- *   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_H_
@@ -24,7 +17,8 @@
  * Include necessary headers...
  */
 
-#  include <cups/cups.h>
+#  include "cups.h"
+
 
 #  ifdef __cplusplus
 extern "C" {
@@ -53,6 +47,10 @@ extern "C" {
 #  define CUPS_RASTER_SYNCv2   0x52615332      /* RaS2 */
 #  define CUPS_RASTER_REVSYNCv2        0x32536152      /* 2SaR */
 
+#  define CUPS_RASTER_SYNCapple        0x554E4952      /* UNIR */
+#  define CUPS_RASTER_REVSYNCapple 0x52494E55  /* RINU */
+
+#  define CUPS_RASTER_SYNC_PWG CUPS_RASTER_SYNCv2
 
 /*
  * The following definition can be used to determine if the
@@ -62,6 +60,45 @@ extern "C" {
 
 #  define CUPS_RASTER_HAVE_COLORIMETRIC 1
 
+/*
+ * The following definition can be used to determine if the
+ * device colorspaces (DEVICEn) are defined...
+ */
+
+#  define CUPS_RASTER_HAVE_DEVICE 1
+
+/*
+ * The following definition can be used to determine if PWG Raster is supported.
+ */
+
+#  define CUPS_RASTER_HAVE_PWGRASTER 1
+
+/*
+ * The following definition can be used to determine if Apple Raster is
+ * supported (beta).
+ */
+
+#  define CUPS_RASTER_HAVE_APPLERASTER 1
+
+/*
+ * The following PWG 5102.4 definitions specify indices into the
+ * cupsInteger[] array in the raster header.
+ */
+
+#  define CUPS_RASTER_PWG_TotalPageCount       0
+#  define CUPS_RASTER_PWG_CrossFeedTransform   1
+#  define CUPS_RASTER_PWG_FeedTransform                2
+#  define CUPS_RASTER_PWG_ImageBoxLeft         3
+#  define CUPS_RASTER_PWG_ImageBoxTop          4
+#  define CUPS_RASTER_PWG_ImageBoxRight                5
+#  define CUPS_RASTER_PWG_ImageBoxBottom       6
+#  define CUPS_RASTER_PWG_AlternatePrimary     7
+#  define CUPS_RASTER_PWG_PrintQuality         8
+#  define CUPS_RASTER_PWG_VendorIdentifier     14
+#  define CUPS_RASTER_PWG_VendorLength         15
+
+
+
 
 /*
  * Types...
@@ -84,42 +121,60 @@ typedef enum cups_bool_e           /**** Boolean type ****/
 
 typedef enum cups_cspace_e             /**** cupsColorSpace attribute values ****/
 {
-  CUPS_CSPACE_W = 0,                   /* Luminance */
-  CUPS_CSPACE_RGB = 1,                 /* Red, green, blue */
-  CUPS_CSPACE_RGBA = 2,                        /* Red, green, blue, alpha */
-  CUPS_CSPACE_K = 3,                   /* Black */
-  CUPS_CSPACE_CMY = 4,                 /* Cyan, magenta, yellow */
-  CUPS_CSPACE_YMC = 5,                 /* Yellow, magenta, cyan */
-  CUPS_CSPACE_CMYK = 6,                        /* Cyan, magenta, yellow, black */
-  CUPS_CSPACE_YMCK = 7,                        /* Yellow, magenta, cyan, black */
-  CUPS_CSPACE_KCMY = 8,                        /* Black, cyan, magenta, yellow */
-  CUPS_CSPACE_KCMYcm = 9,              /* Black, cyan, magenta, yellow, *
-                                        * light-cyan, light-magenta     */
-  CUPS_CSPACE_GMCK = 10,               /* Gold, magenta, yellow, black */
-  CUPS_CSPACE_GMCS = 11,               /* Gold, magenta, yellow, silver */
-  CUPS_CSPACE_WHITE = 12,              /* White ink (as black) */
-  CUPS_CSPACE_GOLD = 13,               /* Gold foil */
-  CUPS_CSPACE_SILVER = 14,             /* Silver foil */
-
-  CUPS_CSPACE_CIEXYZ = 15,             /* CIE XYZ @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_CIELab = 16,             /* CIE Lab @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_RGBW = 17,               /* Red, green, blue, white @since CUPS 1.2/Mac OS X 10.5@ */
-
-  CUPS_CSPACE_ICC1 = 32,               /* ICC-based, 1 color @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICC2 = 33,               /* ICC-based, 2 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICC3 = 34,               /* ICC-based, 3 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICC4 = 35,               /* ICC-based, 4 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICC5 = 36,               /* ICC-based, 5 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICC6 = 37,               /* ICC-based, 6 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICC7 = 38,               /* ICC-based, 7 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICC8 = 39,               /* ICC-based, 8 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICC9 = 40,               /* ICC-based, 9 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICCA = 41,               /* ICC-based, 10 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICCB = 42,               /* ICC-based, 11 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICCC = 43,               /* ICC-based, 12 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICCD = 44,               /* ICC-based, 13 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICCE = 45,               /* ICC-based, 14 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
-  CUPS_CSPACE_ICCF = 46                        /* ICC-based, 15 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+  CUPS_CSPACE_W = 0,                   /* Luminance (DeviceGray, gamma 2.2 by default) */
+  CUPS_CSPACE_RGB = 1,                 /* Red, green, blue (DeviceRGB, sRGB by default) */
+  CUPS_CSPACE_RGBA = 2,                        /* Red, green, blue, alpha (DeviceRGB, sRGB by default) */
+  CUPS_CSPACE_K = 3,                   /* Black (DeviceK) */
+  CUPS_CSPACE_CMY = 4,                 /* Cyan, magenta, yellow (DeviceCMY) */
+  CUPS_CSPACE_YMC = 5,                 /* Yellow, magenta, cyan @deprecated@ */
+  CUPS_CSPACE_CMYK = 6,                        /* Cyan, magenta, yellow, black (DeviceCMYK) */
+  CUPS_CSPACE_YMCK = 7,                        /* Yellow, magenta, cyan, black @deprecated@ */
+  CUPS_CSPACE_KCMY = 8,                        /* Black, cyan, magenta, yellow @deprecated@ */
+  CUPS_CSPACE_KCMYcm = 9,              /* Black, cyan, magenta, yellow, light-cyan, light-magenta @deprecated@ */
+  CUPS_CSPACE_GMCK = 10,               /* Gold, magenta, yellow, black @deprecated@ */
+  CUPS_CSPACE_GMCS = 11,               /* Gold, magenta, yellow, silver @deprecated@ */
+  CUPS_CSPACE_WHITE = 12,              /* White ink (as black) @deprecated@ */
+  CUPS_CSPACE_GOLD = 13,               /* Gold foil @deprecated@ */
+  CUPS_CSPACE_SILVER = 14,             /* Silver foil @deprecated@ */
+
+  CUPS_CSPACE_CIEXYZ = 15,             /* CIE XYZ @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_CIELab = 16,             /* CIE Lab @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_RGBW = 17,               /* Red, green, blue, white (DeviceRGB, sRGB by default) @since CUPS 1.2/macOS 10.5@ */
+  CUPS_CSPACE_SW = 18,                 /* Luminance (gamma 2.2) @since CUPS 1.4.5@ */
+  CUPS_CSPACE_SRGB = 19,               /* Red, green, blue (sRGB) @since CUPS 1.4.5@ */
+  CUPS_CSPACE_ADOBERGB = 20,           /* Red, green, blue (Adobe RGB) @since CUPS 1.4.5@ */
+
+  CUPS_CSPACE_ICC1 = 32,               /* ICC-based, 1 color @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICC2 = 33,               /* ICC-based, 2 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICC3 = 34,               /* ICC-based, 3 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICC4 = 35,               /* ICC-based, 4 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICC5 = 36,               /* ICC-based, 5 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICC6 = 37,               /* ICC-based, 6 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICC7 = 38,               /* ICC-based, 7 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICC8 = 39,               /* ICC-based, 8 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICC9 = 40,               /* ICC-based, 9 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICCA = 41,               /* ICC-based, 10 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICCB = 42,               /* ICC-based, 11 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICCC = 43,               /* ICC-based, 12 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICCD = 44,               /* ICC-based, 13 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICCE = 45,               /* ICC-based, 14 colors @since CUPS 1.1.19/macOS 10.3@ */
+  CUPS_CSPACE_ICCF = 46,               /* ICC-based, 15 colors @since CUPS 1.1.19/macOS 10.3@ */
+
+  CUPS_CSPACE_DEVICE1 = 48,            /* DeviceN, 1 color @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICE2 = 49,            /* DeviceN, 2 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICE3 = 50,            /* DeviceN, 3 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICE4 = 51,            /* DeviceN, 4 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICE5 = 52,            /* DeviceN, 5 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICE6 = 53,            /* DeviceN, 6 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICE7 = 54,            /* DeviceN, 7 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICE8 = 55,            /* DeviceN, 8 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICE9 = 56,            /* DeviceN, 9 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICEA = 57,            /* DeviceN, 10 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICEB = 58,            /* DeviceN, 11 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICEC = 59,            /* DeviceN, 12 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICED = 60,            /* DeviceN, 13 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICEE = 61,            /* DeviceN, 14 colors @since CUPS 1.4.5@ */
+  CUPS_CSPACE_DEVICEF = 62             /* DeviceN, 15 colors @since CUPS 1.4.5@ */
 } cups_cspace_t;
 
 typedef enum cups_cut_e                        /**** CutMedia attribute values ****/
@@ -151,7 +206,9 @@ enum cups_mode_e                    /**** cupsRasterOpen modes ****/
 {
   CUPS_RASTER_READ = 0,                        /* Open stream for reading */
   CUPS_RASTER_WRITE = 1,               /* Open stream for writing */
-  CUPS_RASTER_WRITE_COMPRESSED = 2     /* Open stream for compressed writing @since CUPS 1.3/Mac OS X 10.5@ */
+  CUPS_RASTER_WRITE_COMPRESSED = 2,    /* Open stream for compressed writing @since CUPS 1.3/macOS 10.5@ */
+  CUPS_RASTER_WRITE_PWG = 3,           /* Open stream for compressed writing in PWG Raster mode @since CUPS 1.5/macOS 10.7@ */
+  CUPS_RASTER_WRITE_APPLE = 4          /* Open stream for compressed writing in AppleRaster mode (beta) @private@ */
 };
 
 typedef enum cups_mode_e cups_mode_t;  /**** cupsRasterOpen modes ****/
@@ -230,7 +287,7 @@ typedef struct cups_page_header_s   /**** Version 1 page header @deprecated@ ****/
 } cups_page_header_t;
 
 /**** New in CUPS 1.2 ****/
-typedef struct cups_page_header2_s     /**** Version 2 page header @since CUPS 1.2/Mac OS X 10.5@ ****/
+typedef struct cups_page_header2_s     /**** Version 2 page header @since CUPS 1.2/macOS 10.5@ ****/
 {
   /**** Standard Page Device Dictionary String Values ****/
   char         MediaClass[64];         /* MediaClass string */
@@ -278,37 +335,36 @@ typedef struct cups_page_header2_s        /**** Version 2 page header @since CUPS 1.2/M
   unsigned     cupsRowStep;            /* Spacing between lines */
 
   /**** Version 2 Dictionary Values ****/
-  unsigned     cupsNumColors;          /* Number of color compoents @since CUPS 1.2/Mac OS X 10.5@ */
+  unsigned     cupsNumColors;          /* Number of color compoents @since CUPS 1.2/macOS 10.5@ */
   float                cupsBorderlessScalingFactor;
-                                       /* Scaling that was applied to page data @since CUPS 1.2/Mac OS X 10.5@ */
+                                       /* Scaling that was applied to page data @since CUPS 1.2/macOS 10.5@ */
   float                cupsPageSize[2];        /* Floating point PageSize (scaling *
-                                        * factor not applied) @since CUPS 1.2/Mac OS X 10.5@ */
+                                        * factor not applied) @since CUPS 1.2/macOS 10.5@ */
   float                cupsImagingBBox[4];     /* Floating point ImagingBoundingBox
                                         * (scaling factor not applied, left,
-                                        * bottom, right, top) @since CUPS 1.2/Mac OS X 10.5@ */
-  unsigned     cupsInteger[16];        /* User-defined integer values @since CUPS 1.2/Mac OS X 10.5@ */
-  float                cupsReal[16];           /* User-defined floating-point values @since CUPS 1.2/Mac OS X 10.5@ */
-  char         cupsString[16][64];     /* User-defined string values @since CUPS 1.2/Mac OS X 10.5@ */
-  char         cupsMarkerType[64];     /* Ink/toner type @since CUPS 1.2/Mac OS X 10.5@ */
-  char         cupsRenderingIntent[64];/* Color rendering intent @since CUPS 1.2/Mac OS X 10.5@ */
-  char         cupsPageSizeName[64];   /* PageSize name @since CUPS 1.2/Mac OS X 10.5@ */
+                                        * bottom, right, top) @since CUPS 1.2/macOS 10.5@ */
+  unsigned     cupsInteger[16];        /* User-defined integer values @since CUPS 1.2/macOS 10.5@ */
+  float                cupsReal[16];           /* User-defined floating-point values @since CUPS 1.2/macOS 10.5@ */
+  char         cupsString[16][64];     /* User-defined string values @since CUPS 1.2/macOS 10.5@ */
+  char         cupsMarkerType[64];     /* Ink/toner type @since CUPS 1.2/macOS 10.5@ */
+  char         cupsRenderingIntent[64];/* Color rendering intent @since CUPS 1.2/macOS 10.5@ */
+  char         cupsPageSizeName[64];   /* PageSize name @since CUPS 1.2/macOS 10.5@ */
 } cups_page_header2_t;
 
 typedef struct _cups_raster_s cups_raster_t;
                                        /**** Raster stream data ****/
 
-typedef int (*cups_interpret_cb_t)(cups_page_header2_t *header, int preferred_bits);
-                                       /**** cupsRasterInterpretPPD callback function
+/**** New in CUPS 1.5 ****/
+typedef ssize_t (*cups_raster_iocb_t)(void *ctx, unsigned char *buffer, size_t length);
+                                       /**** cupsRasterOpenIO callback function
                                         *
-                                        * This function is called by
-                                        * @link cupsRasterInterpretPPD@ to
-                                        * validate (and update, as needed)
-                                        * the page header attributes. The
-                                        * "preferred_bits" argument provides
-                                        * the value of the
-                                        * @code cupsPreferredBitsPerColor@
-                                        * key from the PostScript page device
-                                        * dictionary and is 0 if undefined.
+                                        * This function is specified when
+                                        * creating a raster stream with
+                                        * @link cupsRasterOpenIO@ and handles
+                                        * generic reading and writing of raster
+                                        * data. It must return -1 on error or
+                                        * the number of bytes specified by
+                                        * "length" on success.
                                         ****/
 
 
@@ -316,37 +372,28 @@ typedef int (*cups_interpret_cb_t)(cups_page_header2_t *header, int preferred_bi
  * Prototypes...
  */
 
-extern void            cupsRasterClose(cups_raster_t *r);
-extern cups_raster_t   *cupsRasterOpen(int fd, cups_mode_t mode);
-extern unsigned                cupsRasterReadHeader(cups_raster_t *r,
-                                            cups_page_header_t *h) _CUPS_DEPRECATED;
-extern unsigned                cupsRasterReadPixels(cups_raster_t *r,
-                                            unsigned char *p, unsigned len);
-extern unsigned                cupsRasterWriteHeader(cups_raster_t *r,
-                                             cups_page_header_t *h) _CUPS_DEPRECATED;
-extern unsigned                cupsRasterWritePixels(cups_raster_t *r,
-                                             unsigned char *p, unsigned len);
+extern void            cupsRasterClose(cups_raster_t *r) _CUPS_PUBLIC;
+extern cups_raster_t   *cupsRasterOpen(int fd, cups_mode_t mode) _CUPS_PUBLIC;
+extern unsigned                cupsRasterReadHeader(cups_raster_t *r, cups_page_header_t *h) _CUPS_DEPRECATED_MSG("Use cupsRasterReadHeader2 instead.") _CUPS_PUBLIC;
+extern unsigned                cupsRasterReadPixels(cups_raster_t *r, unsigned char *p, unsigned len) _CUPS_PUBLIC;
+extern unsigned                cupsRasterWriteHeader(cups_raster_t *r, cups_page_header_t *h) _CUPS_DEPRECATED_MSG("Use cupsRasterWriteHeader2 instead.") _CUPS_PUBLIC;
+extern unsigned                cupsRasterWritePixels(cups_raster_t *r, unsigned char *p, unsigned len) _CUPS_PUBLIC;
 
 /**** New in CUPS 1.2 ****/
-extern int             cupsRasterInterpretPPD(cups_page_header2_t *h,
-                                              ppd_file_t *ppd,
-                                              int num_options,
-                                              cups_option_t *options,
-                                              cups_interpret_cb_t func) _CUPS_API_1_2;
-extern unsigned                cupsRasterReadHeader2(cups_raster_t *r,
-                                             cups_page_header2_t *h) _CUPS_API_1_2;
-extern unsigned                cupsRasterWriteHeader2(cups_raster_t *r,
-                                              cups_page_header2_t *h) _CUPS_API_1_2;
+extern unsigned                cupsRasterReadHeader2(cups_raster_t *r, cups_page_header2_t *h) _CUPS_API_1_2;
+extern unsigned                cupsRasterWriteHeader2(cups_raster_t *r, cups_page_header2_t *h) _CUPS_API_1_2;
 
 /**** New in CUPS 1.3 ****/
 extern const char      *cupsRasterErrorString(void) _CUPS_API_1_3;
 
+/**** New in CUPS 1.5 ****/
+extern cups_raster_t   *cupsRasterOpenIO(cups_raster_iocb_t iocb, void *ctx, cups_mode_t mode) _CUPS_API_1_5;
+
+/**** New in CUPS 2.2/macOS 10.12 ****/
+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_API_2_2;
+
 #  ifdef __cplusplus
 }
 #  endif /* __cplusplus */
 
 #endif /* !_CUPS_RASTER_H_ */
-
-/*
- * End of "$Id$".
- */