1 /*****************************************************************************\
2   ljzjs.h : Interface for the LJZjs class
3 
4   Copyright (c) 1996 - 2007, HP Co.
5   All rights reserved.
6 
7   Redistribution and use in source and binary forms, with or without
8   modification, are permitted provided that the following conditions
9   are met:
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 HP 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.
18 
19   THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
20   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
22   NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24   TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
25   OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26   ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 \*****************************************************************************/
30 
31 
32 #ifndef APDK_LJZJS_H
33 #define APDK_LJZJS_H
34 
35 #if defined (APDK_LJZJS_MONO) || defined (APDK_LJZJS_COLOR) || defined (APDK_LJM1005)
36 
37 #include "hpjbig_wrapper.h"
38 
39 APDK_BEGIN_NAMESPACE
40 
41 
42 /*!
43 \internal
44 */
45 class LJZjs : public Printer
46 {
47 public:
48     LJZjs (SystemServices* pSS, int numfonts = 0, BOOL proto = FALSE);
49     ~LJZjs ();
50 
51     virtual Header* SelectHeader (PrintContext* pc);
52     virtual DRIVER_ERROR VerifyPenInfo ();
53     virtual DRIVER_ERROR ParsePenInfo (PEN_TYPE& ePen, BOOL QueryPrinter = TRUE);
Encapsulate(const RASTERDATA * pRasterData,BOOL bLastPlane)54     virtual DRIVER_ERROR Encapsulate (const RASTERDATA *pRasterData, BOOL bLastPlane)
55     {
56         return SYSTEM_ERROR;
57     }
58     virtual DRIVER_ERROR Flush (int FlushSize);
59     virtual DRIVER_ERROR SkipRasters (int iBlankRasters);
60     int SendChunkHeader (BYTE *szStr, DWORD dwSize, DWORD dwChunkType, DWORD dwNumItems);
61     int SendItem (BYTE *szStr, BYTE cType, WORD wItem, DWORD dwValue, DWORD dwExtra = 0);
62     int SendIntItem (BYTE *szStr, int iItem, int iItemType, int iItemValue);
63     DRIVER_ERROR SendChunkAndItemHeader (BYTE type, void *obj);
64 
GetMargins(PAPER_SIZE ps,float * fMargins)65     virtual BOOL GetMargins (PAPER_SIZE ps, float *fMargins)
66     {
67         fMargins[0] = (float) 0.25;
68         fMargins[1] = (float) 0.25;
69         fMargins[2] = (float) 0.2;
70         fMargins[3] = (float) 0.2;
71         return TRUE;
72     }
73     PRINTER_TYPE    m_iPrinterType;
74 
75 protected:
76 
77 #ifdef APDK_HP_UX
78     virtual LJZjs & operator = (Printer& rhs)
79     {
80         return *this;
81     }
82 #endif
83 
84 //private:
85     int             MapPaperSize ();
86     DRIVER_ERROR    JbigCompress ();
87 	DRIVER_ERROR    JbigCompress_LJZjsColor2 ();
88     DRIVER_ERROR    SendItemData (BYTE ItemType, WORD Item, DWORD dwValue);
89     DRIVER_ERROR    StartPage (DWORD dwWidth, DWORD dwHeight);
EndPage()90     virtual DRIVER_ERROR    EndPage ()
91     {
92         return SYSTEM_ERROR;
93     }
SendPlaneData(int iPlaneNumber,HPLJZjsJbgEncSt * se,HPLJZjcBuff * pcBuff,BOOL bLastStride)94     virtual DRIVER_ERROR    SendPlaneData (int iPlaneNumber, HPLJZjsJbgEncSt *se, HPLJZjcBuff *pcBuff, BOOL bLastStride)
95     {
96         return SYSTEM_ERROR;
97     }
GetOutputResolutionY()98     virtual int GetOutputResolutionY ()
99     {
100         return 600;
101     }
102 
103     static const unsigned char szByte1[256];
104     static const unsigned char szByte2[256];
105     void            *m_hHPLibHandle;
106 
107     DWORD           m_dwWidth;
108     DWORD           m_dwCurrentRaster;
109     DWORD           m_dwLastRaster;
110     BYTE            *m_pszInputRasterData;
111     BYTE            *m_pszCurPtr;
112     PrintContext    *thePrintContext;
113     BOOL            m_bStartPageSent;
114     COLORMODE       m_cmColorMode;
115     BOOL            m_bIamColor;
116     int             m_iPlaneNumber;
117     int             m_iBPP;
118     int             m_iP[4];
119 	BOOL			m_bLJZjsColor2Printer ; /*TRUE when the Printer model follows LJZjsColor-2 encapsulation format, else FALSE*/
120 }; // LJZjs
121 
122 typedef enum
123 {
124     ZJT_START_DOC,
125     ZJT_END_DOC,
126     ZJT_START_PAGE,
127     ZJT_END_PAGE,
128     ZJT_JBIG_BIH,
129     ZJT_JBIG_HID,
130     ZJT_END_JBIG,
131     ZJT_SIGNATURE,
132     ZJT_RAW_IMAGE,
133     ZJT_START_PLANE,
134     ZJT_END_PLANE,
135     ZJT_PAUSE,
136     ZJT_BITMAP
137 } CHUNK_TYPE;
138 
139 typedef enum
140 {
141 /* 0x00*/    ZJI_PAGECOUNT,
142 /* 0x01*/    ZJI_DMCOLLATE,
143 /* 0x02*/    ZJI_DMDUPLEX,
144 
145 /* 0x03*/    ZJI_DMPAPER,
146 /* 0x04*/    ZJI_DMCOPIES,
147 /* 0x05*/    ZJI_DMDEFAULTSOURCE,
148 /* 0x06*/    ZJI_DMMEDIATYPE,
149 /* 0x07*/    ZJI_NBIE,
150 /* 0x08*/    ZJI_RESOLUTION_X,
151 /* 0x09*/    ZJI_RESOLUTION_Y,
152 /* 0x0A */    ZJI_OFFSET_X,
153 /* 0x0B */    ZJI_OFFSET_Y,
154 /* 0x0C */    ZJI_RASTER_X,
155 /* 0x0D */    ZJI_RASTER_Y,
156 
157 /* 0x0E */    ZJI_COLLATE,
158 /* 0x0F */    ZJI_QUANTITY,
159 
160 /* 0x10 */    ZJI_VIDEO_BPP,
161 /* 0x11 */    ZJI_VIDEO_X,
162 /* 0x12 */    ZJI_VIDEO_Y,
163 /* 0x13 */    ZJI_INTERLACE,
164 /* 0x14 */    ZJI_PLANE,
165 /* 0x15 */    ZJI_PALETTE,
166 
167 /* 0x16 */    ZJI_RET,
168 /* 0x17 */    ZJI_TONER_SAVE,
169 
170 /* 0x18 */    ZJI_MEDIA_SIZE_X,
171 /* 0x19 */    ZJI_MEDIA_SIZE_Y,
172 /* 0x1A */    ZJI_MEDIA_SIZE_UNITS,
173 
174 /* 0x1B */    ZJI_CHROMATIC,
175 
176 /* 0x63 */    ZJI_PAD = 99,
177 
178 /* 0x64 */    ZJI_PROMPT,
179 
180 /* 0x65 */    ZJI_BITMAP_TYPE,
181 /* 0x66 */    ZJI_ENCODING_DATA,
182 /* 0x67 */    ZJI_END_PLANE,
183 
184 /* 0x68 */    ZJI_BITMAP_PIXELS,
185 /* 0x69 */    ZJI_BITMAP_LINES,
186 /* 0x6A */    ZJI_BITMAP_BPP,
187 /* 0x6B */    ZJI_BITMAP_STRIDE,
188 
189 } ZJ_ITEM;
190 
191 typedef enum
192 {
193     RET_OFF = 0,
194     RET_ON,
195     RET_AUTO,
196     RET_LIGHT,
197     RET_MEDIUM,
198     RET_DARK
199 } RET_VALUE;
200 
201 typedef enum
202 {
203     ZJIT_UINT32 = 1,
204     ZJIT_INT32,
205     ZJIT_STRING,
206     ZJIT_BYTELUT
207 } CHUNK_ITEM_TYPE;
208 
209 APDK_END_NAMESPACE
210 
211 #endif // defned (APDK_LJZJS_MONO) || defined (APDK_LJZJS_COLOR) || defined (APDK_LJM1005)
212 #endif //APDK_LJZJS_H
213 
214