1 /*
2 Copyright (C) 2018-2021, Dirk Krause
3 SPDX-License-Identifier: BSD-3-Clause
4 */
5 
6 /*
7 	WARNING: This file was generated by the dkct program (see
8 	http://dktools.sourceforge.net/ for details).
9 	Changes you make here will be lost if dkct is run again!
10 	You should modify the original source and run dkct on it.
11 	Original source: dk4grco.ctr
12 */
13 
14 #ifndef DK4GRCO_H_INCLUDED
15 /** Avoid multiple inclusions. */
16 #define DK4GRCO_H_INCLUDED 1
17 
18 
19 /**	@file	dk4grco.h	Graphics configuration.
20 */
21 
22 #ifndef	DK4CONF_H_INCLUDED
23 #if DK4_BUILDING_DKTOOLS4
24 #include "dk4conf.h"
25 #else
26 #include <dktools-4/dk4conf.h>
27 #endif
28 #endif
29 
30 #ifndef	DK4PAPER_H_INCLUDED
31 #if DK4_BUILDING_DKTOOLS4
32 #include <libdk4gra/dk4paper.h>
33 #else
34 #include <dktools-4/dk4paper.h>
35 #endif
36 #endif
37 
38 #ifndef	DK4CS_H_INCLUDED
39 #if DK4_BUILDING_DKTOOLS4
40 #include <libdk4bif/dk4cs.h>
41 #else
42 #include <dktools-4/dk4cs.h>
43 #endif
44 #endif
45 
46 #ifndef	DK4GRA_H_INCLUDED
47 #if DK4_BUILDING_DKTOOLS4
48 #include <libdk4gra/dk4gra.h>
49 #else
50 #include <dktools-4/dk4gra.h>
51 #endif
52 #endif
53 
54 /**	Scopes for configuration entries
55 */
56 enum	{
57 								/**	Base setup like choosing a driver,
58 									PS language level.
59 								*/
60 	DK4_GRA_CONF_SCOPE_SETUP	=	0x0001 ,
61 
62 								/**	Setup tasks related to bitmap images.
63 								*/
64 	DK4_GRA_CONF_SCOPE_IMAGE	=	0x0002 ,
65 
66 								/**	Setup tasks related to drawing operations.
67 								*/
68 	DK4_GRA_CONF_SCOPE_DRAW		=	0x0004 ,
69 
70 								/**	Setup tasks related to text typesetting.
71 								*/
72 	DK4_GRA_CONF_SCOPE_TEXT		=	0x0008 ,
73 
74 	/* ----- Combinations for some programs ----- */
75 
76 								/**	The bmpp program only uses base
77 									setup and bitmap image setup.
78 								*/
79 	DK4_GRA_CONF_SCOPE_BMPP		=	(
80 		DK4_GRA_CONF_SCOPE_SETUP
81 		| DK4_GRA_CONF_SCOPE_IMAGE
82 	) ,
83 
84 								/**	The fig2lat program uses all setup
85 									features.
86 								*/
87 	DK4_GRA_CONF_SCOPE_FIG2LAT =	(
88 		DK4_GRA_CONF_SCOPE_BMPP
89 		| DK4_GRA_CONF_SCOPE_DRAW
90 		| DK4_GRA_CONF_SCOPE_TEXT
91 	)
92 
93 };
94 
95 /**	Graphics configuration.
96 */
97 typedef struct {
98 	dk4_paper_size_t	media;			/**< Paper size to use. */
99 	dk4_cs_conv_ctx_t	ctx;			/**< Color space conversion context. */
100 	double				xres;			/**< X resolution. */
101 	double				yres;			/**< Y resolution. */
102 	double				xslp;			/**< X-spline length precision. */
103 	double				xspp;			/**< X-spline parameter precision. */
104 	size_t				psi;			/**< Paper size index in collection. */
105 	unsigned			xsss;			/**< X-spline sub segments. */
106 	int					driver;			/**< Graphics output driver. */
107 	int					purpose;		/**< Intended output purpose. */
108 	int					color;			/**< Flag: Colored output. */
109 	int					ps_level;		/**< PS level, 2 or 3. */
110 	int					ps_lzw;			/**< Flag: Allow LZW. */
111 	int					ps_dsc;			/**< Flag: Write DSC comments. */
112 	int					img_bg_r;		/**< Image background red. */
113 	int					img_bg_g;		/**< Image background green. */
114 	int					img_bg_b;		/**< Image background blue. */
115 	int					img_bg_f;		/**< Flag: Force specified bg. */
116 	int					img_dct;		/**< Flag: Directly use DCT data. */
117 	int					img_int;		/**< Flag: Use image interpolation. */
118 	int					img_dct_int;	/**< Flag: Interpolation for DCT. */
119 	int					img_an_bpc;		/**< Flag: Analyse bits per sample. */
120 	int					img_an_color;	/**< Flag: Analyse color usage. */
121 	int					img_an_alpha;	/**< Flag: Analyse alpha channel use. */
122 	int					img_rot;		/**< Flag: Allow rotation. */
123 	int					img_ign_res;	/**< Flag: Ignore resolution chunk. */
124 	int					img_ign_asp;	/**< Flag: Ignore aspect ratio. */
125 	int					use_media;		/**< Flag: Fit to paper size. */
126 	int					doc_duplex;		/**< Flag: Use duplex printing. */
127 	int					doc_tumble;		/**< Flag: Use duplex and tumble. */
128 	int					have_psi;		/**< Flag: Have psi number. */
129 	int					restrict_size;	/**< Flag: Restrict image size. */
130 	int					img_dct_rs;		/**< Flag: DCT data when shrinked. */
131 } dk4_gra_conf_t;
132 
133 #ifdef	__cplusplus
134 extern "C" {
135 #endif
136 
137 /**	Initialize configuration structure.
138 	@param	conf	Configuration structure to initialize.
139 */
140 void
141 dk4gra_conf_init(
142 	dk4_gra_conf_t	*conf
143 );
144 
145 
146 /**	Retrieve flags for applying an image from the configuration.
147 	@param	conf	Configuration structure to obtain values from.
148 	@return	Or-combined set of flags.
149 */
150 int
151 dk4gra_conf_flags_image(
152 	dk4_gra_conf_t	const	*conf
153 );
154 
155 
156 /**	Retrieve document flags for opening a graphics output structure
157 	from the configuration.
158 	@param	conf	Configuration structure to obtain values from.
159 	@return	Or-combined set of flags.
160 */
161 int
162 dk4gra_conf_flags_document(
163 	dk4_gra_conf_t	const	*conf
164 );
165 
166 
167 /**	Retrieve "restrict size" setting.
168 	@param	conf	Configuration structure to obtain values from.
169 	@return	1 to restrict size, 0 to not restrict size.
170 */
171 int
172 dk4gra_conf_get_restrict_size(
173 	dk4_gra_conf_t	const	*conf
174 );
175 
176 
177 #ifdef	__cplusplus
178 }
179 #endif
180 
181 /* vim: set ai sw=4 ts=4 : */
182 
183 
184 
185 #endif
186