• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* sane - Scanner Access Now Easy.
2 
3    ScanMaker 3840 Backend
4    Copyright (C) 2005-7 Earle F. Philhower, III
5    earle@ziplabel.com - http://www.ziplabel.com
6 
7    This program is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License as
9    published by the Free Software Foundation; either version 2 of the
10    License, or (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <https://www.gnu.org/licenses/>.
19 
20    As a special exception, the authors of SANE give permission for
21    additional uses of the libraries contained in this release of SANE.
22 
23    The exception is that, if you link a SANE library with other files
24    to produce an executable, this does not by itself cause the
25    resulting executable to be covered by the GNU General Public
26    License.  Your use of that executable is in no way restricted on
27    account of linking the SANE library code into it.
28 
29    This exception does not, however, invalidate any other reasons why
30    the executable file might be covered by the GNU General Public
31    License.
32 
33    If you submit changes to SANE to the maintainers to be included in
34    a subsequent release, you agree by submitting the changes that
35    those changes may be distributed with this exception intact.
36 
37    If you write modifications of your own for SANE, it is your choice
38    whether to permit this exception to apply to your modifications.
39    If you do not wish that, delete this exception notice.
40 
41 */
42 
43 #ifndef sm3840_h
44 #define sm3840_h
45 
46 #include <sys/stat.h>
47 #include <sys/types.h>
48 #include "../include/sane/sane.h"
49 
50 
51 typedef enum SM3840_Option
52 {
53   OPT_NUM_OPTS = 0,
54   OPT_MODE,
55   OPT_RESOLUTION,
56   OPT_BIT_DEPTH,
57 
58   OPT_TL_X,			/* top-left x */
59   OPT_TL_Y,			/* top-left y */
60   OPT_BR_X,			/* bottom-right x */
61   OPT_BR_Y,			/* bottom-right y */
62 
63   OPT_BRIGHTNESS,
64   OPT_CONTRAST,
65 
66   OPT_LAMP_TIMEOUT,
67   OPT_THRESHOLD,
68 
69   /* must come last */
70   NUM_OPTIONS
71 } SM3840_Option;
72 
73 #include "sm3840_params.h"
74 
75 
76 typedef struct SM3840_Device
77 {
78   struct SM3840_Device *next;
79   SANE_Device sane;
80 } SM3840_Device;
81 
82 
83 
84 typedef struct SM3840_Scan
85 {
86   struct SM3840_Scan *next;
87   SANE_Option_Descriptor options_list[NUM_OPTIONS];
88   Option_Value value[NUM_OPTIONS];
89 
90   SANE_Int udev;
91 
92   SANE_Bool scanning;
93   SANE_Bool cancelled;
94   SANE_Parameters sane_params;
95   SM3840_Params sm3840_params;
96 
97   SANE_Byte *line_buffer;	/* One remapped/etc line */
98   size_t remaining;		/* How much of line_buffer is still good? */
99   size_t offset;		/* Offset in line_buffer where unread data lives */
100   int linesleft;		/* How many lines to read from scanner? */
101   int linesread;		/* Total lines returned to SANE */
102 
103   /* record_line state parameters */
104   int save_i;
105   unsigned char *save_scan_line;
106   unsigned char *save_dpi1200_remap;
107   unsigned char *save_color_remap;
108   unsigned char threshold;
109   int save_dither_err;
110 
111 } SM3840_Scan;
112 
113 
114 #ifndef PATH_MAX
115 #define PATH_MAX	1024
116 #endif
117 
118 #define SM3840_CONFIG_FILE "sm3840.conf"
119 
120 
121 #define SCAN_BUF_SIZE 65536
122 
123 #endif /* sm3840_h */
124