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 /** @file dk4grco.c The dk4grco module. 15 */ 16 17 18 #include "dk4conf.h" 19 20 #ifndef DK4GRCO_H_INCLUDED 21 #include <libdk4gra/dk4grco.h> 22 #endif 23 24 #ifndef DK4GRA_H_INCLUDED 25 #include <libdk4gra/dk4gra.h> 26 #endif 27 28 #if DK4_HAVE_ASSERT_H 29 #ifndef ASSERT_H_INCLUDED 30 #include <assert.h> 31 #define ASSERT_H_INCLUDED 1 32 #endif 33 #endif 34 35 36 37 38 39 40 41 void dk4gra_conf_init(dk4_gra_conf_t * conf)42dk4gra_conf_init( 43 dk4_gra_conf_t *conf 44 ) 45 { 46 #if DK4_USE_ASSERT 47 assert(NULL != conf); 48 #endif 49 if (NULL != conf) { 50 conf->media.name = NULL; 51 conf->media.w = 595.0; 52 conf->media.h = 842.0; 53 conf->media.i = 56.0; 54 conf->media.o = 28.0; 55 conf->media.b = 14.0; 56 conf->media.t = 14.0; 57 dk4cs_context_init(&(conf->ctx), NULL); 58 conf->xres = -1.0; /* Not specified */ 59 conf->yres = -1.0; /* Not specified */ 60 conf->xslp = 1.0e-3; 61 conf->xspp = 4.0e-3; 62 conf->psi = 0; 63 conf->xsss = 8U; 64 conf->driver = DK4_GRA_DRIVER_PDF; 65 conf->purpose = DK4_GRA_PURPOSE_OBJECT; 66 conf->color = 1; 67 conf->ps_level = 3; 68 conf->ps_lzw = 0; 69 conf->ps_dsc = 0; 70 conf->img_bg_r = 255; 71 conf->img_bg_g = 255; 72 conf->img_bg_b = 255; 73 conf->img_bg_f = 0; 74 conf->img_dct = 1; 75 conf->img_int = 1; 76 conf->img_dct_int = 0; 77 conf->img_an_bpc = 1; 78 conf->img_an_color = 1; 79 conf->img_an_alpha = 1; 80 conf->img_rot = 0; 81 conf->img_ign_res = 0; 82 conf->img_ign_asp = 0; 83 conf->use_media = 0; 84 conf->doc_duplex = 1; 85 conf->doc_tumble = 0; 86 conf->have_psi = 0; 87 conf->restrict_size = 1; 88 conf->img_dct_rs = 1; 89 } 90 } 91 92 93 94 int dk4gra_conf_flags_document(dk4_gra_conf_t const * conf)95dk4gra_conf_flags_document( 96 dk4_gra_conf_t const *conf 97 ) 98 { 99 int back = 0; 100 #if DK4_USE_ASSERT 101 assert(NULL != conf); 102 #endif 103 if (NULL != conf) { 104 if (DK4_GRA_DRIVER_EPS == conf->driver) { 105 back |= DK4_GRA_DOC_FLAG_EPS; 106 } 107 if (0 == conf->color) { 108 back |= DK4_GRA_DOC_FLAG_FORCE_GRAY; 109 } 110 if (2 == conf->ps_level) { 111 back |= DK4_GRA_DOC_FLAG_PS2; 112 } 113 if (0 != conf->ps_dsc) { 114 back |= DK4_GRA_DOC_FLAG_PS_DSC; 115 } 116 if (0 != conf->doc_tumble) { 117 back |= DK4_GRA_DOC_FLAG_TUMBLE; 118 } 119 else { 120 if (0 != conf->doc_duplex) { 121 back |= DK4_GRA_DOC_FLAG_DUPLEX; 122 } 123 } 124 } 125 return back; 126 } 127 128 129 130 int dk4gra_conf_flags_image(dk4_gra_conf_t const * conf)131dk4gra_conf_flags_image( 132 dk4_gra_conf_t const *conf 133 ) 134 { 135 int back = 0; 136 #if DK4_USE_ASSERT 137 assert(NULL != conf); 138 #endif 139 if (NULL != conf) { 140 if (0 != conf->color) { 141 back |= DK4_GRA_IMG_FLAG_COLOR; 142 } 143 if (0 != conf->ps_lzw) { 144 back |= DK4_GRA_IMG_FLAG_LZW; 145 } 146 if (0 != conf->img_dct) { 147 back |= DK4_GRA_IMG_FLAG_DCT; 148 } 149 if (0 != conf->img_int) { 150 back |= DK4_GRA_IMG_FLAG_INTERPOLATION; 151 } 152 if (0 != conf->img_dct_int) { 153 back |= DK4_GRA_IMG_FLAG_DCT_INTERPOLATION; 154 } 155 if (0 != conf->img_an_bpc) { 156 back |= DK4_GRA_IMG_FLAG_ANALYZE_BPC; 157 } 158 if (0 != conf->img_an_color) { 159 back |= DK4_GRA_IMG_FLAG_ANALYZE_COLOR; 160 } 161 if (0 != conf->img_an_alpha) { 162 back |= DK4_GRA_IMG_FLAG_ANALYZE_ALPHA; 163 } 164 if (0 != conf->img_rot) { 165 back |= DK4_GRA_IMG_FLAG_ALLOW_ROTATION; 166 } 167 if (0 != conf->img_ign_res) { 168 back |= DK4_GRA_IMG_FLAG_IGNORE_RESOLUTION; 169 } 170 if (0 != conf->img_ign_asp) { 171 back |= DK4_GRA_IMG_FLAG_IGNORE_ASPECT_RATIO; 172 } 173 if (0 != conf->img_dct_rs) { 174 back |= DK4_GRA_IMG_FLAG_DCT_RS; 175 } 176 } 177 return back; 178 } 179 180 181 182 int dk4gra_conf_get_restrict_size(dk4_gra_conf_t const * conf)183dk4gra_conf_get_restrict_size( 184 dk4_gra_conf_t const *conf 185 ) 186 { 187 int back = 0; 188 if (NULL != conf) { 189 if (0 != conf->restrict_size) { 190 back = 1; 191 } 192 } 193 return back; 194 } 195 196 197 /* vim: set ai sw=4 ts=4 : */ 198