1 /* sane - Scanner Access Now Easy.
2    Copyright (C) 1997 Geoffrey T. Dairiki
3    This file is part of the SANE package.
4 
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 
18    As a special exception, the authors of SANE give permission for
19    additional uses of the libraries contained in this release of SANE.
20 
21    The exception is that, if you link a SANE library with other files
22    to produce an executable, this does not by itself cause the
23    resulting executable to be covered by the GNU General Public
24    License.  Your use of that executable is in no way restricted on
25    account of linking the SANE library code into it.
26 
27    This exception does not, however, invalidate any other reasons why
28    the executable file might be covered by the GNU General Public
29    License.
30 
31    If you submit changes to SANE to the maintainers to be included in
32    a subsequent release, you agree by submitting the changes that
33    those changes may be distributed with this exception intact.
34 
35    If you write modifications of your own for SANE, it is your choice
36    whether to permit this exception to apply to your modifications.
37    If you do not wish that, delete this exception notice.
38 
39    This file is part of a SANE backend for HP Scanners supporting
40    HP Scanner Control Language (SCL).
41 */
42 
43 #ifndef HP_OPTION_H_INCLUDED
44 #define HP_OPTION_H_INCLUDED
45 #include "hp.h"
46 
47 /*
48  * Non-standard SANE options
49  *
50  * FIXME: this should become standard
51  */
52 
53 #ifndef SANE_NAME_SHARPENING
54 # define SANE_NAME_SHARPENING "sharpening"
55 # define SANE_TITLE_SHARPENING SANE_I18N("Sharpening")
56 # define SANE_DESC_SHARPENING SANE_I18N("Set sharpening value.")
57 #endif
58 
59 #ifndef SANE_NAME_AUTO_THRESHOLD
60 # define SANE_NAME_AUTO_THRESHOLD "auto-threshold"
61 # define SANE_TITLE_AUTO_THRESHOLD SANE_I18N("Auto Threshold")
62 # define SANE_DESC_AUTO_THRESHOLD \
63     SANE_I18N("Enable automatic determination of threshold for line-art scans.")
64 #endif
65 
66 #ifndef SANE_NAME_SMOOTHING
67 # define SANE_NAME_SMOOTHING "smoothing"
68 # define SANE_TITLE_SMOOTHING SANE_I18N("Smoothing")
69 # define SANE_DESC_SMOOTHING SANE_I18N("Select smoothing filter.")
70 #endif
71 
72 #ifndef SANE_NAME_UNLOAD_AFTER_SCAN
73 # define SANE_NAME_UNLOAD_AFTER_SCAN "unload-after-scan"
74 # define SANE_TITLE_UNLOAD_AFTER_SCAN SANE_I18N("Unload media after scan")
75 # define SANE_DESC_UNLOAD_AFTER_SCAN SANE_I18N("Unloads the media after a scan.")
76 #endif
77 
78 #ifndef SANE_NAME_CHANGE_DOC
79 # define SANE_NAME_CHANGE_DOC "change-document"
80 # define SANE_TITLE_CHANGE_DOC SANE_I18N("Change document")
81 # define SANE_DESC_CHANGE_DOC SANE_I18N("Change Document.")
82 #endif
83 
84 #ifndef SANE_NAME_UNLOAD
85 # define SANE_NAME_UNLOAD "unload"
86 # define SANE_TITLE_UNLOAD SANE_I18N("Unload")
87 # define SANE_DESC_UNLOAD SANE_I18N("Unload Document.")
88 #endif
89 
90 #ifndef SANE_NAME_CALIBRATE
91 # define SANE_NAME_CALIBRATE "calibrate"
92 # define SANE_TITLE_CALIBRATE SANE_I18N("Calibrate")
93 # define SANE_DESC_CALIBRATE SANE_I18N("Start calibration process.")
94 #endif
95 
96 #ifndef SANE_NAME_MEDIA
97 # define SANE_NAME_MEDIA "media-type"
98 # define SANE_TITLE_MEDIA SANE_I18N("Media")
99 # define SANE_DESC_MEDIA SANE_I18N("Set type of media.")
100 #endif
101 
102 #ifndef SANE_NAME_PS_EXPOSURE_TIME
103 # define SANE_NAME_PS_EXPOSURE_TIME "ps-exposure-time"
104 # define SANE_TITLE_PS_EXPOSURE_TIME SANE_I18N("Exposure time")
105 # define SANE_DESC_PS_EXPOSURE_TIME \
106     SANE_I18N("A longer exposure time lets the scanner\
107  collect more light. Suggested use is 175% for prints,\
108  150% for normal slides and \"Negative\" for\
109  negative film. For dark (underexposed) images you can increase this value.")
110 #endif
111 
112 #ifndef SANE_NAME_MATRIX_TYPE
113 # define SANE_NAME_MATRIX_TYPE "matrix-type"
114 # define SANE_TITLE_MATRIX_TYPE SANE_I18N("Color Matrix")
115 /* FIXME: better description */
116 # define SANE_DESC_MATRIX_TYPE SANE_I18N("Set the scanner's color matrix.")
117 #endif
118 
119 #ifndef SANE_NAME_MATRIX_RGB
120 # define SANE_NAME_MATRIX_RGB "matrix-rgb"
121 # define SANE_TITLE_MATRIX_RGB SANE_I18N("Color Matrix")
122 # define SANE_DESC_MATRIX_RGB SANE_I18N("Custom color matrix.")
123 #endif
124 
125 #ifndef SANE_NAME_MATRIX_GRAY
126 # define SANE_NAME_MATRIX_GRAY "matrix-gray"
127 # define SANE_TITLE_MATRIX_GRAY SANE_I18N("Mono Color Matrix")
128 # define SANE_DESC_MATRIX_GRAY SANE_I18N("Custom color matrix for grayscale scans.")
129 #endif
130 
131 #ifndef SANE_NAME_MIRROR_HORIZ
132 # define SANE_NAME_MIRROR_HORIZ "mirror-horizontal"
133 # define SANE_TITLE_MIRROR_HORIZ SANE_I18N("Mirror horizontal")
134 # define SANE_DESC_MIRROR_HORIZ SANE_I18N("Mirror image horizontally.")
135 #endif
136 
137 #ifndef SANE_NAME_MIRROR_VERT
138 # define SANE_NAME_MIRROR_VERT "mirror-vertical"
139 # define SANE_TITLE_MIRROR_VERT SANE_I18N("Mirror vertical")
140 # define SANE_DESC_MIRROR_VERT SANE_I18N("Mirror image vertically.")
141 #endif
142 
143 #ifndef SANE_NAME_UPDATE
144 # define SANE_NAME_UPDATE "update-options"
145 # define SANE_TITLE_UPDATE SANE_I18N("Update options")
146 # define SANE_DESC_UPDATE SANE_I18N("Update options.")
147 #endif
148 
149 #ifndef SANE_NAME_OUTPUT_8BIT
150 # define SANE_NAME_OUTPUT_8BIT   "output-8bit"
151 # define SANE_TITLE_OUTPUT_8BIT  SANE_I18N("8 bit output")
152 # define SANE_DESC_OUTPUT_8BIT   \
153    SANE_I18N("Use bit depth greater eight internally,\
154  but output only eight bits.")
155 #endif
156 
157 #ifndef SANE_NAME_BUTTON_WAIT
158 # define SANE_NAME_BUTTON_WAIT   "button-wait"
159 # define SANE_TITLE_BUTTON_WAIT  SANE_I18N("Front button wait")
160 # define SANE_DESC_BUTTON_WAIT   SANE_I18N("Wait to scan for front-panel button push.")
161 # define HP_BUTTON_WAIT_NO       0
162 # define HP_BUTTON_WAIT_YES      1
163 #endif
164 
165 #ifndef SANE_NAME_LAMP_OFF
166 # define SANE_NAME_LAMP_OFF      "lamp-off"
167 # define SANE_TITLE_LAMP_OFF     SANE_I18N("Shut off lamp")
168 # define SANE_DESC_LAMP_OFF      SANE_I18N("Shut off scanner lamp.")
169 # define HP_LAMP_OFF_NO          0
170 # define HP_LAMP_OFF_YES         1
171 #endif
172 
173 /* Some test stuff to see what undocumented SCL-commands do */
174 # define SANE_NAME_10470 "10470"
175 # define SANE_TITLE_10470 "10470"
176 # define SANE_DESC_10470 "10470."
177 
178 # define SANE_NAME_10485 "10485"
179 # define SANE_TITLE_10485 "10485"
180 # define SANE_DESC_10485 "10485."
181 
182 # define SANE_NAME_10952 "10952"
183 # define SANE_TITLE_10952 "10952"
184 # define SANE_DESC_10952 "10952."
185 
186 # define SANE_NAME_10967 "10967"
187 # define SANE_TITLE_10967 "10967"
188 # define SANE_DESC_10967 "10967."
189 
190 /*
191  * Internal option names which are not presented to the SANE frontend.
192  */
193 #define HP_NAME_HORIZONTAL_DITHER	"__hdither__"
194 #define HP_NAME_DEVPIX_RESOLUTION	"__devpix_resolution__"
195 #ifdef ENABLE_7x12_TONEMAPS
196 # define HP_NAME_RGB_TONEMAP		"__rgb_tonemap__"
197 #endif
198 #ifdef FAKE_COLORSEP_MATRIXES
199 # define HP_NAME_SEPMATRIX		"__sepmatrix__"
200 #endif
201 
202 struct hp_choice_s
203 {
204     int		val;
205     const char *name;
206     hp_bool_t	(*enable)(HpChoice this, HpOptSet optset, HpData data,
207                           const HpDeviceInfo *info);
208     hp_bool_t	is_emulated:1;
209     HpChoice	next;
210 };
211 
212 enum hp_scanmode_e
213 {
214     HP_SCANMODE_LINEART	= 0,
215     HP_SCANMODE_HALFTONE	= 3,
216     HP_SCANMODE_GRAYSCALE	= 4,
217     HP_SCANMODE_COLOR	= 5
218 };
219 
220 enum hp_scantype_e
221 {
222     HP_SCANTYPE_NORMAL   = 0,
223     HP_SCANTYPE_ADF      = 1,
224     HP_SCANTYPE_XPA      = 2
225 };
226 
227 enum hp_dither_type_e {
228     HP_DITHER_CUSTOM		= -1,
229     HP_DITHER_COARSE		= 0,
230     HP_DITHER_FINE		= 1,
231     HP_DITHER_BAYER		= 2,
232     HP_DITHER_VERTICAL		= 3,
233     HP_DITHER_HORIZONTAL
234 };
235 
236 enum hp_matrix_type_e {
237     HP_MATRIX_AUTO		= -256,
238     HP_MATRIX_GREEN		= -257,
239     HP_MATRIX_CUSTOM_BW		= -2,
240     HP_MATRIX_CUSTOM		= -1,
241     HP_MATRIX_RGB		= 0,
242     HP_MATRIX_BW		= 1,
243     HP_MATRIX_PASS		= 2,
244     HP_MATRIX_RED		= 3,
245     HP_MATRIX_BLUE		= 4,
246     HP_MATRIX_XPA_RGB		= 5,
247     HP_MATRIX_XPA_BW		= 6
248 };
249 
250 enum hp_mirror_horiz_e {
251     HP_MIRROR_HORIZ_CONDITIONAL = -256,
252     HP_MIRROR_HORIZ_OFF         = 0,
253     HP_MIRROR_HORIZ_ON          = 1
254 };
255 
256 enum hp_mirror_vert_e {
257     HP_MIRROR_VERT_OFF         = -258,
258     HP_MIRROR_VERT_ON          = -257,
259     HP_MIRROR_VERT_CONDITIONAL = -256
260 };
261 
262 enum hp_media_e {
263     HP_MEDIA_NEGATIVE = 1,
264     HP_MEDIA_SLIDE = 2,
265     HP_MEDIA_PRINT = 3
266 };
267 
268 hp_bool_t   sanei_hp_choice_isEnabled (HpChoice this, HpOptSet optset,
269                                HpData data, const HpDeviceInfo *info);
270 
271 SANE_Status sanei_hp_optset_new(HpOptSet * newp, HpScsi scsi, HpDevice dev);
272 SANE_Status sanei_hp_optset_download (HpOptSet this, HpData data, HpScsi scsi);
273 SANE_Status sanei_hp_optset_control (HpOptSet this, HpData data,
274                                int optnum, SANE_Action action,
275 			       void * valp, SANE_Int *infop, HpScsi scsi,
276                                hp_bool_t immediate);
277 SANE_Status sanei_hp_optset_guessParameters (HpOptSet this, HpData data,
278                                SANE_Parameters * p);
279 enum hp_scanmode_e sanei_hp_optset_scanmode (HpOptSet this, HpData data);
280 hp_bool_t sanei_hp_optset_output_8bit (HpOptSet this, HpData data);
281 int sanei_hp_optset_data_width (HpOptSet this, HpData data);
282 hp_bool_t sanei_hp_optset_isImmediate (HpOptSet this, int optnum);
283 hp_bool_t sanei_hp_optset_mirror_vert (HpOptSet this, HpData data, HpScsi scsi);
284 hp_bool_t sanei_hp_optset_start_wait(HpOptSet this, HpData data);
285 HpScl sanei_hp_optset_scan_type (HpOptSet this, HpData data);
286 const SANE_Option_Descriptor * sanei_hp_optset_saneoption (HpOptSet this,
287                                HpData data, int optnum);
288 
289 #endif /* HP_OPTION_H_INCLUDED */
290