xref: /aosp_15_r20/external/libcups/cups/raster-interstub.c (revision 5e7646d21f1134fb0638875d812ef646c12ab91e)
1*5e7646d2SAndroid Build Coastguard Worker /*
2*5e7646d2SAndroid Build Coastguard Worker  * cupsRasterInterpretPPD stub for CUPS.
3*5e7646d2SAndroid Build Coastguard Worker  *
4*5e7646d2SAndroid Build Coastguard Worker  * Copyright © 2018 by Apple Inc.
5*5e7646d2SAndroid Build Coastguard Worker  *
6*5e7646d2SAndroid Build Coastguard Worker  * Licensed under Apache License v2.0.  See the file "LICENSE" for more
7*5e7646d2SAndroid Build Coastguard Worker  * information.
8*5e7646d2SAndroid Build Coastguard Worker  */
9*5e7646d2SAndroid Build Coastguard Worker 
10*5e7646d2SAndroid Build Coastguard Worker /*
11*5e7646d2SAndroid Build Coastguard Worker  * Include necessary headers...
12*5e7646d2SAndroid Build Coastguard Worker  */
13*5e7646d2SAndroid Build Coastguard Worker 
14*5e7646d2SAndroid Build Coastguard Worker #include <cups/ppd-private.h>
15*5e7646d2SAndroid Build Coastguard Worker 
16*5e7646d2SAndroid Build Coastguard Worker 
17*5e7646d2SAndroid Build Coastguard Worker /*
18*5e7646d2SAndroid Build Coastguard Worker  * This stub wraps the _cupsRasterInterpretPPD function in libcups - this allows
19*5e7646d2SAndroid Build Coastguard Worker  * one library to provide all of the CUPS API functions while still supporting
20*5e7646d2SAndroid Build Coastguard Worker  * the old split library organization...
21*5e7646d2SAndroid Build Coastguard Worker  */
22*5e7646d2SAndroid Build Coastguard Worker 
23*5e7646d2SAndroid Build Coastguard Worker 
24*5e7646d2SAndroid Build Coastguard Worker /*
25*5e7646d2SAndroid Build Coastguard Worker  * 'cupsRasterInterpretPPD()' - Interpret PPD commands to create a page header.
26*5e7646d2SAndroid Build Coastguard Worker  *
27*5e7646d2SAndroid Build Coastguard Worker  * This function is used by raster image processing (RIP) filters like
28*5e7646d2SAndroid Build Coastguard Worker  * cgpdftoraster and imagetoraster when writing CUPS raster data for a page.
29*5e7646d2SAndroid Build Coastguard Worker  * It is not used by raster printer driver filters which only read CUPS
30*5e7646d2SAndroid Build Coastguard Worker  * raster data.
31*5e7646d2SAndroid Build Coastguard Worker  *
32*5e7646d2SAndroid Build Coastguard Worker  *
33*5e7646d2SAndroid Build Coastguard Worker  * @code cupsRasterInterpretPPD@ does not mark the options in the PPD using
34*5e7646d2SAndroid Build Coastguard Worker  * the "num_options" and "options" arguments.  Instead, mark the options with
35*5e7646d2SAndroid Build Coastguard Worker  * @code cupsMarkOptions@ and @code ppdMarkOption@ prior to calling it -
36*5e7646d2SAndroid Build Coastguard Worker  * this allows for per-page options without manipulating the options array.
37*5e7646d2SAndroid Build Coastguard Worker  *
38*5e7646d2SAndroid Build Coastguard Worker  * The "func" argument specifies an optional callback function that is
39*5e7646d2SAndroid Build Coastguard Worker  * called prior to the computation of the final raster data.  The function
40*5e7646d2SAndroid Build Coastguard Worker  * can make changes to the @link cups_page_header2_t@ data as needed to use a
41*5e7646d2SAndroid Build Coastguard Worker  * supported raster format and then returns 0 on success and -1 if the
42*5e7646d2SAndroid Build Coastguard Worker  * requested attributes cannot be supported.
43*5e7646d2SAndroid Build Coastguard Worker  *
44*5e7646d2SAndroid Build Coastguard Worker  *
45*5e7646d2SAndroid Build Coastguard Worker  * @code cupsRasterInterpretPPD@ supports a subset of the PostScript language.
46*5e7646d2SAndroid Build Coastguard Worker  * Currently only the @code [@, @code ]@, @code <<@, @code >>@, @code {@,
47*5e7646d2SAndroid Build Coastguard Worker  * @code }@, @code cleartomark@, @code copy@, @code dup@, @code index@,
48*5e7646d2SAndroid Build Coastguard Worker  * @code pop@, @code roll@, @code setpagedevice@, and @code stopped@ operators
49*5e7646d2SAndroid Build Coastguard Worker  * are supported.
50*5e7646d2SAndroid Build Coastguard Worker  *
51*5e7646d2SAndroid Build Coastguard Worker  * @since CUPS 1.2/macOS 10.5@
52*5e7646d2SAndroid Build Coastguard Worker  */
53*5e7646d2SAndroid Build Coastguard Worker 
54*5e7646d2SAndroid Build Coastguard Worker int					/* O - 0 on success, -1 on failure */
cupsRasterInterpretPPD(cups_page_header2_t * h,ppd_file_t * ppd,int num_options,cups_option_t * options,cups_interpret_cb_t func)55*5e7646d2SAndroid Build Coastguard Worker cupsRasterInterpretPPD(
56*5e7646d2SAndroid Build Coastguard Worker     cups_page_header2_t *h,		/* O - Page header to create */
57*5e7646d2SAndroid Build Coastguard Worker     ppd_file_t          *ppd,		/* I - PPD file */
58*5e7646d2SAndroid Build Coastguard Worker     int                 num_options,	/* I - Number of options */
59*5e7646d2SAndroid Build Coastguard Worker     cups_option_t       *options,	/* I - Options */
60*5e7646d2SAndroid Build Coastguard Worker     cups_interpret_cb_t func)		/* I - Optional page header callback (@code NULL@ for none) */
61*5e7646d2SAndroid Build Coastguard Worker {
62*5e7646d2SAndroid Build Coastguard Worker   return (_cupsRasterInterpretPPD(h, ppd, num_options, options, func));
63*5e7646d2SAndroid Build Coastguard Worker }
64