]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/xform-private.h
Save initial work on private xform API.
[thirdparty/cups.git] / cups / xform-private.h
CommitLineData
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
27extern "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"
40# define XFORM_FORMAT_POSTSCRIPT "application/postscript"
41# define XFORM_FORMAT_PWG_RASTER "image/pwg-raster"
42# define XFORM_FORMAT_TEXT "text/plain"
43
44typedef enum xform_duplex_e /**** 2-Sided Capabilities ****/
45{
46 XFORM_DUPLEX_NONE, /* No 2-sided support */
47 XFORM_DUPLEX_NORMAL, /* 2-sided support, normal back side orientation ('normal') */
48 XFORM_DUPLEX_LONG_TUMBLE, /* 2-sided support, rotate back side 180 degrees for long edge ('manual-tumble') */
49 XFORM_DUPLEX_SHORT_TUMBLE, /* 2-sided support, rotate back side 180 degrees for short edge ('rotated') */
50 XFORM_DUPLEX_MIRRORED /* 2-sided support, mirror back side ('flippped') */
51} xform_duplex_t;
52
53typedef enum xform_loglevel_e /**** Logging Levels ****/
54{
55 XFORM_LOGLEVEL_DEBUG, /* Debugging message */
56 XFORM_LOGLEVEL_INFO, /* Informational message */
57 XFORM_LOGLEVEL_ERROR, /* Error message */
58 XFORM_LOGLEVEL_ATTR /* Attribute message */
59} xform_loglevel_t;
60
61/*
62 * Local types...
63 */
64
65typedef struct xform_margins_s /**** Output margins ****/
66{
67 int bottom, /* Bottom margin in hundredths of millimeters */
68 left, /* Left margin in hundredths of millimeters */
69 right, /* Right margin in hundredths of millimeters */
70 top; /* Top margin in hundredths of millimeters */
71} xform_margins_t;
72
73typedef struct xform_size_s /**** Output size ****/
74{
75 int width, /* Width in hundredths of millimeters */
76 length; /* Length in hundredths of millimeters */
77} xform_size_t;
78
79typedef struct xform_capabilities_s /**** Output Capabilities ****/
80{
81 int mixed; /* Supports pages with different colorspaces and sizes? */
82 cups_cspace_t color, /* Colorspace for printing color documents */
83 monochrome, /* Colorspace for printing B&W documents */
84 photo; /* Colorspace for printing photos */
85 unsigned draft_bits, /* Bits per color for printing draft quality */
86 normal_bits, /* Bits per color for printing normal quality */
87 high_bits; /* Bits per color for printing high/best/photo quality */
88 unsigned draft_resolution[2], /* Draft resolution */
89 normal_resolution[2], /* Normal resolution */
90 high_resolution[2]; /* High/best/photo resolution */
91 xform_duplex_t duplex; /* 2-sided capabilities */
92 xform_margins_t margins, /* Default margins */
93 xform_size_t size; /* Default size */
94 xform_margins_t max_margins; /* Maximum margins */
95 xform_size_t max_size; /* Maximum size */
96 xform_margins_t min_margins; /* Minimum margins */
97 xform_size_t min_size; /* Minimum size */
98} xform_capabilities_t;
99
100typedef struct _xform_ctx_s xform_ctx_t;/**** Transform context ****/
101
102typedef void (*xform_logcb_t)(void *user_data, xform_loglevel_t level, const char *message);
103 /**** Logging callback ****/
104
105typedef ssize_t (*xform_writecb_t)(void *user_data, const unsigned char *buffer, size_t length);
106 /**** Output callback ****/
107
108
109/*
110 * Functions...
111 */
112
113extern void xformDelete(xform_ctx_t *ctx);
114extern xform_ctx_t *xformNew(const char *outformat, xform_capabilities_t *outcaps);
115extern int xformRun(xform_ctx_t *ctx, const char *infile, const char *informat);
116extern void xformSetLogCallback(xform_ctx_t *ctx, xform_logcb_t logcb, void *logdata);
117extern void xformSetOptions(xform_ctx_t *ctx, int num_options, cups_option_t *options);
118extern void xformSetWriteCallback(xform_ctx_t *ctx, xform_writecb_t writecb, void *writedata);
119
120
121# ifdef __cplusplus
122}
123# endif /* __cplusplus */
124
125#endif /* !_CUPS_XFORM_PRIVATE_H_ */