1 /*****************************************************************************\
2 hpijsfax.h : HP Inkjet Server
4 Copyright (c) 2001 - 2002, Hewlett-Packard Co.
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 3. Neither the name of the Hewlett-Packard nor the names of its
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 NOT LIMITED TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR
25 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 POSSIBILITY OF SUCH DAMAGE.
30 \*****************************************************************************/
37 #define IJS_MAX_PARAM 256
42 * Raster data encoding methods
45 #define RASTER_BITMAP 0
46 #define RASTER_GRAYMAP 1
51 #define RASTER_YCC411 6
55 #define RASTER_AUTO 99
57 #define HPLIPFAX_MONO 1
58 #define HPLIPFAX_COLOR 2
60 #define HPLIPPUTINT32(bytearr, val) \
61 bytearr[0] = (val & 0xFF000000) >> 24; \
62 bytearr[1] = (val & 0x00FF0000) >> 16; \
63 bytearr[2] = (val & 0x0000FF00) >> 8; \
64 bytearr[3] = (val & 0x000000FF)
66 #define HPLIPPUTINT16(bytearr, val) \
67 bytearr[0] = (val & 0x0000FF00) >> 8; \
68 bytearr[1] = (val & 0x000000FF)
75 uint32_t uiNumPages; // >= 1
76 uint32_t uiHorzRes; // 200 or 300
77 uint32_t uiVertRes; // 100, 200 or 300
78 uint32_t uiPageSize; // Letter - 1, A4 - 2, Legal - 3
79 uint32_t uiOutputQuality; // Standard - 1, Fine - 2 or Super Fine - 3
86 uint32_t uiPixelsPerRow;
87 uint32_t uiNumOfRowsThisPage;
88 uint32_t uiImageSize; // Size of fax data only, in bytes
104 iFaxEncoding = RASTER_MH;
107 strcpy (m_szDeviceName, "HPFax");
109 char *GetDeviceName ()
111 return m_szDeviceName;
113 void SetDeviceName (char *szDeviceName)
115 strcpy (m_szDeviceName, szDeviceName);
117 void SetOutputPath (int fd)
121 void SetPaperSize (float w, float h)
125 if (fabs (8.5 - w) < 0.05 && fabs (11.0 - w) < 0.05)
129 else if (fabs (8.27 - w) < 0.05 && fabs (11.69 - h) < 0.05)
133 else if (fabs (8.5 - w) < 0.05 && fabs (14.0 - h) < 0.05)
138 void SetPaperWidth (float w)
142 void SetPaperHeight (float h)
150 void SetQuality (int iQ)
154 void SetMediaType (int iM)
158 void SetColorMode (int iCm)
160 iColorMode = iCm; // 1 - Monochrome, 2 - Color
161 if (iCm == HPLIPFAX_COLOR)
163 iFaxEncoding = RASTER_JPEG;
166 void SetFirstRaster (int iFirst)
168 iFirstRaster = iFirst;
170 void SetFaxEncoding (int iVal)
173 if (iColorMode == HPLIPFAX_COLOR)
175 iFaxEncoding = RASTER_JPEG;
178 if (iVal == RASTER_AUTO)
180 char *pDev = getenv ("DEVICE_URI");
181 iFaxEncoding = RASTER_MH;
186 if ((strstr (pDev, "Laser") || strstr (pDev, "laser")))
188 iFaxEncoding = RASTER_MMR;
193 int GetFaxEncoding ()
209 float GetPaperWidth ()
213 float GetPaperHeight ()
221 float PrintableStartX ()
223 //return (float) 0.25;
224 return (float) 0.125;
226 float PrintableStartY ()
228 return (float) 0.125;
230 float PrintableWidth ()
232 return fPaperWidth - (2.0 * 0.125);
234 float PrintableHeight ()
236 return fPaperHeight - (2.0 * 0.125);
238 float PhysicalPageSizeX ()
242 float PhysicalPageSizeY ()
246 int EffectiveResolutionX ()
254 int EffectiveResolutionY ()
278 char m_szDeviceName[64];
281 void RGB2Gray (BYTE *pRGBData, int iNumPixels, BYTE *pBWData);
283 #endif /* HPIJSFAX_H */
285 #endif // HAVE_LIBHPIP