home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / cups / raster.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-10-21  |  13.8 KB  |  338 lines

  1. /*
  2.  * "$Id: raster.h 7721 2008-07-11 22:48:49Z mike $"
  3.  *
  4.  *   Raster file definitions for the Common UNIX Printing System (CUPS).
  5.  *
  6.  *   Copyright 2007 by Apple Inc.
  7.  *   Copyright 1997-2006 by Easy Software Products.
  8.  *
  9.  *   This file is part of the CUPS Imaging library.
  10.  *
  11.  *   These coded instructions, statements, and computer programs are the
  12.  *   property of Apple Inc. and are protected by Federal copyright
  13.  *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
  14.  *   which should have been included with this file.  If this file is
  15.  *   file is missing or damaged, see the license at "http://www.cups.org/".
  16.  *
  17.  *   This file is subject to the Apple OS-Developed Software exception.
  18.  */
  19.  
  20. #ifndef _CUPS_RASTER_H_
  21. #  define _CUPS_RASTER_H_
  22.  
  23. /*
  24.  * Include necessary headers...
  25.  */
  26.  
  27. #  include <cups/cups.h>
  28.  
  29. #  ifdef __cplusplus
  30. extern "C" {
  31. #  endif /* __cplusplus */
  32.  
  33. /*
  34.  * Every non-PostScript printer driver that supports raster images
  35.  * should use the application/vnd.cups-raster image file format.
  36.  * Since both the PostScript RIP (pstoraster, based on GNU/GPL
  37.  * Ghostscript) and Image RIP (imagetoraster, located in the filter
  38.  * directory) use it, using this format saves you a lot of work.
  39.  * Also, the PostScript RIP passes any printer options that are in
  40.  * a PS file to your driver this way as well...
  41.  */
  42.  
  43. /*
  44.  * Constants...
  45.  */
  46.  
  47. #  define CUPS_RASTER_SYNC    0x52615333    /* RaS3 */
  48. #  define CUPS_RASTER_REVSYNC    0x33536152    /* 3SaR */
  49.  
  50. #  define CUPS_RASTER_SYNCv1    0x52615374    /* RaSt */
  51. #  define CUPS_RASTER_REVSYNCv1    0x74536152    /* tSaR */
  52.  
  53. #  define CUPS_RASTER_SYNCv2    0x52615332    /* RaS2 */
  54. #  define CUPS_RASTER_REVSYNCv2    0x32536152    /* 2SaR */
  55.  
  56.  
  57. /*
  58.  * The following definition can be used to determine if the
  59.  * colorimetric colorspaces (CIEXYZ, CIELAB, and ICCn) are
  60.  * defined...
  61.  */
  62.  
  63. #  define CUPS_RASTER_HAVE_COLORIMETRIC 1
  64.  
  65.  
  66. /*
  67.  * Types...
  68.  */
  69.  
  70. typedef enum cups_adv_e            /**** AdvanceMedia attribute values ****/
  71. {
  72.   CUPS_ADVANCE_NONE = 0,        /* Never advance the roll */
  73.   CUPS_ADVANCE_FILE = 1,        /* Advance the roll after this file */
  74.   CUPS_ADVANCE_JOB = 2,            /* Advance the roll after this job */
  75.   CUPS_ADVANCE_SET = 3,            /* Advance the roll after this set */
  76.   CUPS_ADVANCE_PAGE = 4            /* Advance the roll after this page */
  77. } cups_adv_t;
  78.  
  79. typedef enum cups_bool_e        /**** Boolean type ****/
  80. {
  81.   CUPS_FALSE = 0,            /* Logical false */
  82.   CUPS_TRUE = 1                /* Logical true */
  83. } cups_bool_t;
  84.  
  85. typedef enum cups_cspace_e        /**** cupsColorSpace attribute values ****/
  86. {
  87.   CUPS_CSPACE_W = 0,            /* Luminance */
  88.   CUPS_CSPACE_RGB = 1,            /* Red, green, blue */
  89.   CUPS_CSPACE_RGBA = 2,            /* Red, green, blue, alpha */
  90.   CUPS_CSPACE_K = 3,            /* Black */
  91.   CUPS_CSPACE_CMY = 4,            /* Cyan, magenta, yellow */
  92.   CUPS_CSPACE_YMC = 5,            /* Yellow, magenta, cyan */
  93.   CUPS_CSPACE_CMYK = 6,            /* Cyan, magenta, yellow, black */
  94.   CUPS_CSPACE_YMCK = 7,            /* Yellow, magenta, cyan, black */
  95.   CUPS_CSPACE_KCMY = 8,            /* Black, cyan, magenta, yellow */
  96.   CUPS_CSPACE_KCMYcm = 9,        /* Black, cyan, magenta, yellow, *
  97.                      * light-cyan, light-magenta     */
  98.   CUPS_CSPACE_GMCK = 10,        /* Gold, magenta, yellow, black */
  99.   CUPS_CSPACE_GMCS = 11,        /* Gold, magenta, yellow, silver */
  100.   CUPS_CSPACE_WHITE = 12,        /* White ink (as black) */
  101.   CUPS_CSPACE_GOLD = 13,        /* Gold foil */
  102.   CUPS_CSPACE_SILVER = 14,        /* Silver foil */
  103.  
  104.   CUPS_CSPACE_CIEXYZ = 15,        /* CIE XYZ @since CUPS 1.1.19@ */
  105.   CUPS_CSPACE_CIELab = 16,        /* CIE Lab @since CUPS 1.1.19@ */
  106.   CUPS_CSPACE_RGBW = 17,        /* Red, green, blue, white @since CUPS 1.2@ */
  107.  
  108.   CUPS_CSPACE_ICC1 = 32,        /* ICC-based, 1 color @since CUPS 1.1.19@ */
  109.   CUPS_CSPACE_ICC2 = 33,        /* ICC-based, 2 colors @since CUPS 1.1.19@ */
  110.   CUPS_CSPACE_ICC3 = 34,        /* ICC-based, 3 colors @since CUPS 1.1.19@ */
  111.   CUPS_CSPACE_ICC4 = 35,        /* ICC-based, 4 colors @since CUPS 1.1.19@ */
  112.   CUPS_CSPACE_ICC5 = 36,        /* ICC-based, 5 colors @since CUPS 1.1.19@ */
  113.   CUPS_CSPACE_ICC6 = 37,        /* ICC-based, 6 colors @since CUPS 1.1.19@ */
  114.   CUPS_CSPACE_ICC7 = 38,        /* ICC-based, 7 colors @since CUPS 1.1.19@ */
  115.   CUPS_CSPACE_ICC8 = 39,        /* ICC-based, 8 colors @since CUPS 1.1.19@ */
  116.   CUPS_CSPACE_ICC9 = 40,        /* ICC-based, 9 colors @since CUPS 1.1.19@ */
  117.   CUPS_CSPACE_ICCA = 41,        /* ICC-based, 10 colors @since CUPS 1.1.19@ */
  118.   CUPS_CSPACE_ICCB = 42,        /* ICC-based, 11 colors @since CUPS 1.1.19@ */
  119.   CUPS_CSPACE_ICCC = 43,        /* ICC-based, 12 colors @since CUPS 1.1.19@ */
  120.   CUPS_CSPACE_ICCD = 44,        /* ICC-based, 13 colors @since CUPS 1.1.19@ */
  121.   CUPS_CSPACE_ICCE = 45,        /* ICC-based, 14 colors @since CUPS 1.1.19@ */
  122.   CUPS_CSPACE_ICCF = 46            /* ICC-based, 15 colors @since CUPS 1.1.19@ */
  123. } cups_cspace_t;
  124.  
  125. typedef enum cups_cut_e            /**** CutMedia attribute values ****/
  126. {
  127.   CUPS_CUT_NONE = 0,            /* Never cut the roll */
  128.   CUPS_CUT_FILE = 1,            /* Cut the roll after this file */
  129.   CUPS_CUT_JOB = 2,            /* Cut the roll after this job */
  130.   CUPS_CUT_SET = 3,            /* Cut the roll after this set */
  131.   CUPS_CUT_PAGE = 4            /* Cut the roll after this page */
  132. } cups_cut_t;
  133.  
  134. typedef enum cups_edge_e        /**** LeadingEdge attribute values ****/
  135. {
  136.   CUPS_EDGE_TOP = 0,            /* Leading edge is the top of the page */
  137.   CUPS_EDGE_RIGHT = 1,            /* Leading edge is the right of the page */
  138.   CUPS_EDGE_BOTTOM = 2,            /* Leading edge is the bottom of the page */
  139.   CUPS_EDGE_LEFT = 3            /* Leading edge is the left of the page */
  140. } cups_edge_t;
  141.  
  142. typedef enum cups_jog_e            /**** Jog attribute values ****/
  143. {
  144.   CUPS_JOG_NONE = 0,            /* Never move pages */
  145.   CUPS_JOG_FILE = 1,            /* Move pages after this file */
  146.   CUPS_JOG_JOB = 2,            /* Move pages after this job */
  147.   CUPS_JOG_SET = 3            /* Move pages after this set */
  148. } cups_jog_t;
  149.  
  150. typedef enum cups_mode_e        /**** Raster modes ****/
  151. {
  152.   CUPS_RASTER_READ = 0,            /* Open stream for reading */
  153.   CUPS_RASTER_WRITE = 1,        /* Open stream for writing */
  154.   CUPS_RASTER_WRITE_COMPRESSED = 2    /* Open stream for compressed writing @since CUPS 1.3@ */
  155. } cups_mode_t;
  156.  
  157. typedef enum cups_order_e        /**** cupsColorOrder attribute values ****/
  158. {
  159.   CUPS_ORDER_CHUNKED = 0,        /* CMYK CMYK CMYK ... */
  160.   CUPS_ORDER_BANDED = 1,        /* CCC MMM YYY KKK ... */
  161.   CUPS_ORDER_PLANAR = 2            /* CCC ... MMM ... YYY ... KKK ... */
  162. } cups_order_t;
  163.  
  164. typedef enum cups_orient_e        /**** Orientation attribute values ****/
  165. {
  166.   CUPS_ORIENT_0 = 0,            /* Don't rotate the page */
  167.   CUPS_ORIENT_90 = 1,            /* Rotate the page counter-clockwise */
  168.   CUPS_ORIENT_180 = 2,            /* Turn the page upside down */
  169.   CUPS_ORIENT_270 = 3            /* Rotate the page clockwise */
  170. } cups_orient_t;
  171.  
  172.  
  173. /*
  174.  * The page header structure contains the standard PostScript page device
  175.  * dictionary, along with some CUPS-specific parameters that are provided
  176.  * by the RIPs...
  177.  *
  178.  * The API supports a "version 1" (from CUPS 1.0 and 1.1) and a "version 2"
  179.  * (from CUPS 1.2 and higher) page header, for binary compatibility.
  180.  */
  181.  
  182. typedef struct cups_page_header_s    /**** Version 1 Page Header ****/
  183. {
  184.   /**** Standard Page Device Dictionary String Values ****/
  185.   char        MediaClass[64];        /* MediaClass string */
  186.   char        MediaColor[64];        /* MediaColor string */
  187.   char        MediaType[64];        /* MediaType string */
  188.   char        OutputType[64];        /* OutputType string */
  189.  
  190.   /**** Standard Page Device Dictionary Integer Values ****/
  191.   unsigned    AdvanceDistance;    /* AdvanceDistance value in points */
  192.   cups_adv_t    AdvanceMedia;        /* AdvanceMedia value (see above) */
  193.   cups_bool_t    Collate;        /* Collated copies value */
  194.   cups_cut_t    CutMedia;        /* CutMedia value (see above) */
  195.   cups_bool_t    Duplex;            /* Duplexed (double-sided) value */
  196.   unsigned    HWResolution[2];    /* Resolution in dots-per-inch */
  197.   unsigned    ImagingBoundingBox[4];    /* Pixel region that is painted (points) */
  198.   cups_bool_t    InsertSheet;        /* InsertSheet value */
  199.   cups_jog_t    Jog;            /* Jog value (see above) */
  200.   cups_edge_t    LeadingEdge;        /* LeadingEdge value (see above) */
  201.   unsigned    Margins[2];        /* Lower-lefthand margins in points */
  202.   cups_bool_t    ManualFeed;        /* ManualFeed value */
  203.   unsigned    MediaPosition;        /* MediaPosition value */
  204.   unsigned    MediaWeight;        /* MediaWeight value in grams/m^2 */
  205.   cups_bool_t    MirrorPrint;        /* MirrorPrint value */
  206.   cups_bool_t    NegativePrint;        /* NegativePrint value */
  207.   unsigned    NumCopies;        /* Number of copies to produce */
  208.   cups_orient_t    Orientation;        /* Orientation value (see above) */
  209.   cups_bool_t    OutputFaceUp;        /* OutputFaceUp value */
  210.   unsigned    PageSize[2];        /* Width and length of page in points */
  211.   cups_bool_t    Separations;        /* Separations value */
  212.   cups_bool_t    TraySwitch;        /* TraySwitch value */
  213.   cups_bool_t    Tumble;            /* Tumble value */
  214.  
  215.   /**** CUPS Page Device Dictionary Values ****/
  216.   unsigned    cupsWidth;        /* Width of page image in pixels */
  217.   unsigned    cupsHeight;        /* Height of page image in pixels */
  218.   unsigned    cupsMediaType;        /* Media type code */
  219.   unsigned    cupsBitsPerColor;    /* Number of bits for each color */
  220.   unsigned    cupsBitsPerPixel;    /* Number of bits for each pixel */
  221.   unsigned    cupsBytesPerLine;    /* Number of bytes per line */
  222.   cups_order_t    cupsColorOrder;        /* Order of colors */
  223.   cups_cspace_t    cupsColorSpace;        /* True colorspace */
  224.   unsigned    cupsCompression;    /* Device compression to use */
  225.   unsigned    cupsRowCount;        /* Rows per band */
  226.   unsigned    cupsRowFeed;        /* Feed between bands */
  227.   unsigned    cupsRowStep;        /* Spacing between lines */
  228. } cups_page_header_t;
  229.  
  230. /**** New in CUPS 1.2 ****/
  231. typedef struct cups_page_header2_s    /**** Version 2 Page Header @since CUPS 1.2@ ****/
  232. {
  233.   /**** Standard Page Device Dictionary String Values ****/
  234.   char        MediaClass[64];        /* MediaClass string */
  235.   char        MediaColor[64];        /* MediaColor string */
  236.   char        MediaType[64];        /* MediaType string */
  237.   char        OutputType[64];        /* OutputType string */
  238.  
  239.   /**** Standard Page Device Dictionary Integer Values ****/
  240.   unsigned    AdvanceDistance;    /* AdvanceDistance value in points */
  241.   cups_adv_t    AdvanceMedia;        /* AdvanceMedia value (see above) */
  242.   cups_bool_t    Collate;        /* Collated copies value */
  243.   cups_cut_t    CutMedia;        /* CutMedia value (see above) */
  244.   cups_bool_t    Duplex;            /* Duplexed (double-sided) value */
  245.   unsigned    HWResolution[2];    /* Resolution in dots-per-inch */
  246.   unsigned    ImagingBoundingBox[4];    /* Pixel region that is painted (points) */
  247.   cups_bool_t    InsertSheet;        /* InsertSheet value */
  248.   cups_jog_t    Jog;            /* Jog value (see above) */
  249.   cups_edge_t    LeadingEdge;        /* LeadingEdge value (see above) */
  250.   unsigned    Margins[2];        /* Lower-lefthand margins in points */
  251.   cups_bool_t    ManualFeed;        /* ManualFeed value */
  252.   unsigned    MediaPosition;        /* MediaPosition value */
  253.   unsigned    MediaWeight;        /* MediaWeight value in grams/m^2 */
  254.   cups_bool_t    MirrorPrint;        /* MirrorPrint value */
  255.   cups_bool_t    NegativePrint;        /* NegativePrint value */
  256.   unsigned    NumCopies;        /* Number of copies to produce */
  257.   cups_orient_t    Orientation;        /* Orientation value (see above) */
  258.   cups_bool_t    OutputFaceUp;        /* OutputFaceUp value */
  259.   unsigned    PageSize[2];        /* Width and length of page in points */
  260.   cups_bool_t    Separations;        /* Separations value */
  261.   cups_bool_t    TraySwitch;        /* TraySwitch value */
  262.   cups_bool_t    Tumble;            /* Tumble value */
  263.  
  264.   /**** CUPS Page Device Dictionary Values ****/
  265.   unsigned    cupsWidth;        /* Width of page image in pixels */
  266.   unsigned    cupsHeight;        /* Height of page image in pixels */
  267.   unsigned    cupsMediaType;        /* Media type code */
  268.   unsigned    cupsBitsPerColor;    /* Number of bits for each color */
  269.   unsigned    cupsBitsPerPixel;    /* Number of bits for each pixel */
  270.   unsigned    cupsBytesPerLine;    /* Number of bytes per line */
  271.   cups_order_t    cupsColorOrder;        /* Order of colors */
  272.   cups_cspace_t    cupsColorSpace;        /* True colorspace */
  273.   unsigned    cupsCompression;    /* Device compression to use */
  274.   unsigned    cupsRowCount;        /* Rows per band */
  275.   unsigned    cupsRowFeed;        /* Feed between bands */
  276.   unsigned    cupsRowStep;        /* Spacing between lines */
  277.  
  278.   /**** Version 2 Dictionary Values ****/
  279.   unsigned    cupsNumColors;        /* Number of colors @since CUPS 1.2@ */
  280.   float        cupsBorderlessScalingFactor;
  281.                     /* Scaling that was applied to page data @since CUPS 1.2@ */
  282.   float        cupsPageSize[2];    /* Floating point PageSize (scaling *
  283.                        * factor not applied) @since CUPS 1.2@ */
  284.   float        cupsImagingBBox[4];    /* Floating point ImagingBoundingBox *
  285.                      * (scaling factor not applied) @since CUPS 1.2@ */
  286.   unsigned    cupsInteger[16];    /* User-defined integer values @since CUPS 1.2@ */
  287.   float        cupsReal[16];        /* User-defined floating-point values @since CUPS 1.2@ */
  288.   char        cupsString[16][64];    /* User-defined string values @since CUPS 1.2@ */
  289.   char        cupsMarkerType[64];    /* Ink/toner type @since CUPS 1.2@ */
  290.   char        cupsRenderingIntent[64];/* Color rendering intent @since CUPS 1.2@ */
  291.   char        cupsPageSizeName[64];    /* PageSize name @since CUPS 1.2@ */
  292. } cups_page_header2_t;
  293.  
  294. typedef struct _cups_raster_s cups_raster_t;
  295.                     /**** Raster stream data ****/
  296.  
  297. typedef int (*cups_interpret_cb_t)(cups_page_header2_t *header, int preferred_bits);
  298.  
  299.  
  300. /*
  301.  * Prototypes...
  302.  */
  303.  
  304. extern void        cupsRasterClose(cups_raster_t *r);
  305. extern cups_raster_t    *cupsRasterOpen(int fd, cups_mode_t mode);
  306. extern unsigned        cupsRasterReadHeader(cups_raster_t *r,
  307.                                  cups_page_header_t *h);
  308. extern unsigned        cupsRasterReadPixels(cups_raster_t *r,
  309.                                  unsigned char *p, unsigned len);
  310. extern unsigned        cupsRasterWriteHeader(cups_raster_t *r,
  311.                                   cups_page_header_t *h);
  312. extern unsigned        cupsRasterWritePixels(cups_raster_t *r,
  313.                                   unsigned char *p, unsigned len);
  314.  
  315. /**** New in CUPS 1.2 ****/
  316. extern int        cupsRasterInterpretPPD(cups_page_header2_t *h,
  317.                                    ppd_file_t *ppd,
  318.                            int num_options,
  319.                            cups_option_t *options,
  320.                            cups_interpret_cb_t func);
  321. extern unsigned        cupsRasterReadHeader2(cups_raster_t *r,
  322.                                   cups_page_header2_t *h);
  323. extern unsigned        cupsRasterWriteHeader2(cups_raster_t *r,
  324.                                    cups_page_header2_t *h);
  325.  
  326. /**** New in CUPS 1.3 ****/
  327. extern const char    *cupsRasterErrorString(void);
  328.  
  329. #  ifdef __cplusplus
  330. }
  331. #  endif /* __cplusplus */
  332.  
  333. #endif /* !_CUPS_RASTER_H_ */
  334.  
  335. /*
  336.  * End of "$Id: raster.h 7721 2008-07-11 22:48:49Z mike $".
  337.  */
  338.