summaryrefslogtreecommitdiff
path: root/support/dktools/dk4grco.c
blob: 3ae36b8929e33df7f1fcd2cb28aad3af895d683b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*
Copyright (C) 2018-2020, Dirk Krause
SPDX-License-Identifier: BSD-3-Clause
*/

/*
	WARNING: This file was generated by the dkct program (see
	http://dktools.sourceforge.net/ for details).
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: dk4grco.ctr
*/

/**	@file dk4grco.c The dk4grco module.
*/


#line 164 "dk4grco.ctr"

#include "dk4conf.h"

#ifndef	DK4GRCO_H_INCLUDED
#include "dk4grco.h"
#endif

#ifndef	DK4GRA_H_INCLUDED
#include "dk4gra.h"
#endif

#if DK4_HAVE_ASSERT_H
#ifndef	ASSERT_H_INCLUDED
#include <assert.h>
#define	ASSERT_H_INCLUDED 1
#endif
#endif





#line 185 "dk4grco.ctr"



void
dk4gra_conf_init(
	dk4_gra_conf_t	*conf
)
{
#if	DK4_USE_ASSERT
	assert(NULL != conf);
#endif
	if (NULL != conf) {
		conf->media.name = NULL;
		conf->media.w =	595.0;
		conf->media.h =	842.0;
		conf->media.i = 56.0;
		conf->media.o =	28.0;
		conf->media.b =	14.0;
		conf->media.t =	14.0;
		dk4cs_context_init(&(conf->ctx), NULL);
		conf->xres = -1.0;							/* Not specified */
		conf->yres = -1.0;							/* Not specified */
		conf->xslp = 1.0e-3;
		conf->xspp = 4.0e-3;
		conf->psi  = 0;
		conf->xsss = 8U;
		conf->driver = DK4_GRA_DRIVER_PDF;
		conf->purpose = DK4_GRA_PURPOSE_OBJECT;
		conf->color = 1;
		conf->ps_level = 3;
		conf->ps_lzw = 0;
		conf->ps_dsc = 0;
		conf->img_bg_r = 255;
		conf->img_bg_g = 255;
		conf->img_bg_b = 255;
		conf->img_bg_f = 0;
		conf->img_dct = 1;
		conf->img_int = 1;
		conf->img_dct_int = 0;
		conf->img_an_bpc = 1;
		conf->img_an_color = 1;
		conf->img_an_alpha = 1;
		conf->img_rot = 0;
		conf->img_ign_res = 0;
		conf->img_ign_asp = 0;
		conf->use_media = 0;
		conf->doc_duplex = 1;
		conf->doc_tumble = 0;
		conf->have_psi = 0;
	}
}



int
dk4gra_conf_flags_document(
	dk4_gra_conf_t	const	*conf
)
{
	int		 back	= 0;
#if	DK4_USE_ASSERT
	assert(NULL != conf);
#endif
	if (NULL != conf) {
		if (DK4_GRA_DRIVER_EPS == conf->driver) {
			back |= DK4_GRA_DOC_FLAG_EPS;
		}
		if (0 == conf->color) {
			back |= DK4_GRA_DOC_FLAG_FORCE_GRAY;
		}
		if (2 == conf->ps_level) {
			back |= DK4_GRA_DOC_FLAG_PS2;
		}
		if (0 != conf->ps_dsc) {
			back |= DK4_GRA_DOC_FLAG_PS_DSC;
		}
		if (0 != conf->doc_tumble) {
			back |= DK4_GRA_DOC_FLAG_TUMBLE;
		}
		else {
			if (0 != conf->doc_duplex) {
				back |= DK4_GRA_DOC_FLAG_DUPLEX;
			}
		}
	}
	return back;
}



int
dk4gra_conf_flags_image(
	dk4_gra_conf_t	const	*conf
)
{
	int		 back	= 0;
#if	DK4_USE_ASSERT
	assert(NULL != conf);
#endif
	if (NULL != conf) {
		if (0 != conf->color) {
			back |= DK4_GRA_IMG_FLAG_COLOR;
		}
		if (0 != conf->ps_lzw) {
			back |= DK4_GRA_IMG_FLAG_LZW;
		}
		if (0 != conf->img_dct) {
			back |= DK4_GRA_IMG_FLAG_DCT;
		}
		if (0 != conf->img_int) {
			back |= DK4_GRA_IMG_FLAG_INTERPOLATION;
		}
		if (0 != conf->img_dct_int) {
			back |= DK4_GRA_IMG_FLAG_DCT_INTERPOLATION;
		}
		if (0 != conf->img_an_bpc) {
			back |= DK4_GRA_IMG_FLAG_ANALYZE_BPC;
		}
		if (0 != conf->img_an_color) {
			back |= DK4_GRA_IMG_FLAG_ANALYZE_COLOR;
		}
		if (0 != conf->img_an_alpha) {
			back |= DK4_GRA_IMG_FLAG_ANALYZE_ALPHA;
		}
		if (0 != conf->img_rot) {
			back |= DK4_GRA_IMG_FLAG_ALLOW_ROTATION;
		}
		if (0 != conf->img_ign_res) {
			back |= DK4_GRA_IMG_FLAG_IGNORE_RESOLUTION;
		}
		if (0 != conf->img_ign_asp) {
			back |= DK4_GRA_IMG_FLAG_IGNORE_ASPECT_RATIO;
		}
	}
	return back;
}


/* vim: set ai sw=4 ts=4 : */