]>
Commit | Line | Data |
---|---|---|
1e01455a MS |
1 | /* |
2 | * Private transform API definitions for CUPS. | |
3 | * | |
4 | * Copyright © 2016-2018 by Apple Inc. | |
5 | * | |
6 | * Licensed under Apache License v2.0. See the file "LICENSE" for more | |
7 | * information. | |
8 | */ | |
9 | ||
10 | #ifndef _CUPS_XFORM_PRIVATE_H_ | |
11 | # define _CUPS_XFORM_PRIVATE_H_ | |
12 | ||
13 | ||
14 | /* | |
15 | * Include necessary headers... | |
16 | */ | |
17 | ||
18 | # include <cups/cups.h> | |
19 | # include <cups/raster.h> | |
20 | ||
21 | ||
22 | /* | |
23 | * C++ magic... | |
24 | */ | |
25 | ||
26 | # ifdef __cplusplus | |
27 | extern "C" { | |
28 | # endif /* __cplusplus */ | |
29 | ||
30 | ||
31 | /* | |
32 | * Constants... | |
33 | */ | |
34 | ||
35 | /**** Input/Output MIME media types ****/ | |
36 | # define XFORM_FORMAT_APPLE_RASTER "image/urf" | |
37 | # define XFORM_FORMAT_JPEG "image/jpeg" | |
38 | # define XFORM_FORMAT_PCL "application/vnd.hp-pcl" | |
39 | # define XFORM_FORMAT_PDF "application/pdf" | |
a17ce1d4 | 40 | # define XFORM_FORMAT_PNG "image/png" |
1e01455a MS |
41 | # define XFORM_FORMAT_POSTSCRIPT "application/postscript" |
42 | # define XFORM_FORMAT_PWG_RASTER "image/pwg-raster" | |
43 | # define XFORM_FORMAT_TEXT "text/plain" | |
44 | ||
45 | typedef enum xform_duplex_e /**** 2-Sided Capabilities ****/ | |
46 | { | |
47 | XFORM_DUPLEX_NONE, /* No 2-sided support */ | |
48 | XFORM_DUPLEX_NORMAL, /* 2-sided support, normal back side orientation ('normal') */ | |
49 | XFORM_DUPLEX_LONG_TUMBLE, /* 2-sided support, rotate back side 180 degrees for long edge ('manual-tumble') */ | |
50 | XFORM_DUPLEX_SHORT_TUMBLE, /* 2-sided support, rotate back side 180 degrees for short edge ('rotated') */ | |
51 | XFORM_DUPLEX_MIRRORED /* 2-sided support, mirror back side ('flippped') */ | |
52 | } xform_duplex_t; | |
53 | ||
54 | typedef enum xform_loglevel_e /**** Logging Levels ****/ | |
55 | { | |
56 | XFORM_LOGLEVEL_DEBUG, /* Debugging message */ | |
57 | XFORM_LOGLEVEL_INFO, /* Informational message */ | |
58 | XFORM_LOGLEVEL_ERROR, /* Error message */ | |
59 | XFORM_LOGLEVEL_ATTR /* Attribute message */ | |
60 | } xform_loglevel_t; | |
61 | ||
62 | /* | |
63 | * Local types... | |
64 | */ | |
65 | ||
66 | typedef struct xform_margins_s /**** Output margins ****/ | |
67 | { | |
68 | int bottom, /* Bottom margin in hundredths of millimeters */ | |
69 | left, /* Left margin in hundredths of millimeters */ | |
70 | right, /* Right margin in hundredths of millimeters */ | |
71 | top; /* Top margin in hundredths of millimeters */ | |
72 | } xform_margins_t; | |
73 | ||
74 | typedef struct xform_size_s /**** Output size ****/ | |
75 | { | |
76 | int width, /* Width in hundredths of millimeters */ | |
77 | length; /* Length in hundredths of millimeters */ | |
78 | } xform_size_t; | |
79 | ||
80 | typedef struct xform_capabilities_s /**** Output Capabilities ****/ | |
81 | { | |
82 | int mixed; /* Supports pages with different colorspaces and sizes? */ | |
83 | cups_cspace_t color, /* Colorspace for printing color documents */ | |
84 | monochrome, /* Colorspace for printing B&W documents */ | |
85 | photo; /* Colorspace for printing photos */ | |
86 | unsigned draft_bits, /* Bits per color for printing draft quality */ | |
87 | normal_bits, /* Bits per color for printing normal quality */ | |
88 | high_bits; /* Bits per color for printing high/best/photo quality */ | |
89 | unsigned draft_resolution[2], /* Draft resolution */ | |
90 | normal_resolution[2], /* Normal resolution */ | |
91 | high_resolution[2]; /* High/best/photo resolution */ | |
92 | xform_duplex_t duplex; /* 2-sided capabilities */ | |
3eb5ec66 | 93 | xform_margins_t margins; /* Default margins */ |
1e01455a MS |
94 | xform_size_t size; /* Default size */ |
95 | xform_margins_t max_margins; /* Maximum margins */ | |
96 | xform_size_t max_size; /* Maximum size */ | |
97 | xform_margins_t min_margins; /* Minimum margins */ | |
98 | xform_size_t min_size; /* Minimum size */ | |
76d2c448 | 99 | } xform_caps_t; |
1e01455a MS |
100 | |
101 | typedef struct _xform_ctx_s xform_ctx_t;/**** Transform context ****/ | |
102 | ||
103 | typedef void (*xform_logcb_t)(void *user_data, xform_loglevel_t level, const char *message); | |
104 | /**** Logging callback ****/ | |
105 | ||
106 | typedef ssize_t (*xform_writecb_t)(void *user_data, const unsigned char *buffer, size_t length); | |
107 | /**** Output callback ****/ | |
108 | ||
109 | ||
110 | /* | |
111 | * Functions... | |
112 | */ | |
113 | ||
114 | extern void xformDelete(xform_ctx_t *ctx); | |
76d2c448 MS |
115 | extern int xformInitCapabilities(xform_caps_t *caps, ipp_t *supported); |
116 | extern xform_ctx_t *xformNew(const char *outformat, xform_caps_t *outcaps); | |
1e01455a MS |
117 | extern int xformRun(xform_ctx_t *ctx, const char *infile, const char *informat); |
118 | extern void xformSetLogCallback(xform_ctx_t *ctx, xform_logcb_t logcb, void *logdata); | |
119 | extern void xformSetOptions(xform_ctx_t *ctx, int num_options, cups_option_t *options); | |
120 | extern void xformSetWriteCallback(xform_ctx_t *ctx, xform_writecb_t writecb, void *writedata); | |
121 | ||
122 | ||
123 | # ifdef __cplusplus | |
124 | } | |
125 | # endif /* __cplusplus */ | |
126 | ||
127 | #endif /* !_CUPS_XFORM_PRIVATE_H_ */ |