• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* sane - Scanner Access Now Easy.
2    Copyright (C) 20020 Ralph Little <skelband@gmail.com>
3    Copyright (C) 2003 Martijn van Oosterhout <kleptog@svana.org>
4    Copyright (C) 2003 Thomas Soumarmon <thomas.soumarmon@cogitae.net>
5 
6    Originally copied from HP3300 testtools. Original notice follows:
7 
8    Copyright (C) 2001 Bertrik Sikken (bertrik@zonnet.nl)
9 
10    This file is part of the SANE package.
11 
12    This program is free software; you can redistribute it and/or
13    modify it under the terms of the GNU General Public License
14    as published by the Free Software Foundation; either version 2
15    of the License, or (at your option) any later version.
16 
17    This program is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20    GNU General Public License for more details.
21 
22    You should have received a copy of the GNU General Public License
23    along with this program.  If not, see <https://www.gnu.org/licenses/>.
24 
25    As a special exception, the authors of SANE give permission for
26    additional uses of the libraries contained in this release of SANE.
27 
28    The exception is that, if you link a SANE library with other files
29    to produce an executable, this does not by itself cause the
30    resulting executable to be covered by the GNU General Public
31    License.  Your use of that executable is in no way restricted on
32    account of linking the SANE library code into it.
33 
34    This exception does not, however, invalidate any other reasons why
35    the executable file might be covered by the GNU General Public
36    License.
37 
38    If you submit changes to SANE to the maintainers to be included in
39    a subsequent release, you agree by submitting the changes that
40    those changes may be distributed with this exception intact.
41 
42    If you write modifications of your own for SANE, it is your choice
43    whether to permit this exception to apply to your modifications.
44    If you do not wish that, delete this exception notice.
45 */
46 
47 
48 /*
49     Core HP5400 functions.
50 */
51 
52 
53 #ifndef _HP5400_H_
54 #define _HP5400_H_
55 
56 #include <unistd.h>
57 
58 #include "hp5400_xfer.h"	/* for EScannerModel */
59 
60 #define HW_DPI      300		/* horizontal resolution of hardware */
61 #define HW_LPI      300		/* vertical resolution of hardware */
62 
63 enum ScanType
64 {
65   SCAN_TYPE_CALIBRATION,
66   SCAN_TYPE_PREVIEW,
67   SCAN_TYPE_NORMAL
68 };
69 
70 /* In case we ever need to track multiple models */
71 typedef struct
72 {
73   char *pszVendor;
74   char *pszName;
75 }
76 TScannerModel;
77 
78 typedef struct
79 {
80   /* transfer buffer */
81   void *buffer;			/* Pointer to memory allocated for buffer */
82   int roff, goff, boff;		/* Offset into buffer of rows to be copied *next* */
83   int bufstart, bufend;		/* What is currently the valid buffer */
84   int bpp;			/* Bytes per pixel per colour (1 or 2) */
85   int linelength, pixels;	/* Bytes per line from scanner */
86   int transfersize;		/* Number of bytes to transfer resulting image */
87   int blksize;			/* Size of blocks to pull from scanner */
88   int buffersize;		/* Size of the buffer */
89 }
90 TDataPipe;
91 
92 typedef struct
93 {
94   int iXferHandle;		/* handle used for data transfer to HW */
95   TDataPipe pipe;		/* Pipe for data */
96 
97   int iTopLeftX;		/* in mm */
98   int iTopLeftY;		/* in mm */
99   /*  int           iSensorSkew;   *//* in units of 1/1200 inch */
100   /*  int           iSkipLines;    *//* lines of garbage to skip */
101   /*  int           fReg07;        *//* NIASH00019 */
102   /*  int           fGamma16;      *//* if TRUE, gamma entries are 16 bit */
103 /*  int           iExpTime;      */
104   /*  int           iReversedHead; *//* Head is reversed */
105   /*  int           iBufferSize;   *//* Size of internal scan buffer */
106 /*  EScannerModel eModel;        */
107 }
108 THWParams;
109 
110 /* The scanner needs a Base DPI off which all it's calibration and
111  * offset/size parameters are based.  For the time being this is the same as
112  * the iDpi but maybe we want it separate. This is because while this field
113  * would have limited values (300,600,1200,2400) the x/y dpi can vary. The
114  * windows interface seems to allow 200dpi (though I've never tried it). We
115  * need to decide how these values are related to the HW coordinates. */
116 
117 
118 typedef struct
119 {
120   int iDpi;			/* horizontal resolution */
121   int iLpi;			/* vertical resolution */
122   int iTop;			/* in HW coordinates (units HW_LPI) */
123   int iLeft;			/* in HW coordinates (units HW_LPI) */
124   int iWidth;			/* in HW coordinates (units HW_LPI) */
125   int iHeight;			/* in HW coordinates (units HW_LPI) */
126 
127   int iBytesPerLine;		/* Resulting bytes per line */
128   int iLines;			/* Resulting lines of image */
129   int iLinesRead;		/* Lines of image already read */
130 
131   int iColourOffset;		/* How far the colours are offset. Currently this is
132 				 * set by the caller. This doesn't seem to be
133 				 * necessary anymore since the scanner is doing it
134 				 * internally. Leave it for the time being as it
135 				 * may be needed later. */
136 }
137 TScanParams;
138 
139 /*
140  * Panel settings. We can read and set these.
141  *
142  */
143 typedef struct
144 {
145   SANE_Word copycount;  // 0..99 LCD display value
146   SANE_Word bwcolour;   // 1=Colour or 2=Black/White from scan type LEDs
147 }
148 TPanelInfo;
149 
150 
151 #endif /* NO _HP5400_H_ */
152