1 /*****************************************************************************\
2 ljm1005.cpp : Implementation for the LJM1005 class
4 Copyright (c) 1996 - 2006, 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 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 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 \*****************************************************************************/
35 #include "printerproxy.h"
36 #include "resources.h"
42 extern uint32_t ulMapGRAY_K_6x6x1[9 * 9 * 9];
44 extern uint32_t ulMapDJ600_CCM_K[9 * 9 * 9];
46 LJM1005::LJM1005 (SystemServices* pSS, int numfonts, BOOL proto)
47 : LJZjs (pSS, numfonts, proto)
52 pMode[GRAYMODE_INDEX] = new LJM1005DraftGrayMode ();
53 pMode[DEFAULTMODE_INDEX] = new LJM1005NormalGrayMode ();
57 #ifdef APDK_AUTODUPLEX
58 m_bRotateBackPage = FALSE; // Lasers don't require back side image to be rotated
60 m_pszInputRasterData = NULL;
61 m_dwCurrentRaster = 0;
62 m_cmColorMode = GREY_K;
63 m_bStartPageSent = FALSE;
66 for (int i = 1; i < 4; i++)
68 m_iP[i] = i - 1; //{3, 0, 1, 2};
72 m_iPrinterType = eLJM1005;
79 LJM1005DraftGrayMode::LJM1005DraftGrayMode ()
80 : GrayMode(/*ulMapDJ600_CCM_K*/ulMapGRAY_K_6x6x1)
88 theQuality = qualityDraft;
89 pmQuality = QUALITY_DRAFT;
90 Config.bCompress = FALSE;
93 LJM1005NormalGrayMode::LJM1005NormalGrayMode ()
94 : GrayMode(/*ulMapDJ600_CCM_K*/ulMapGRAY_K_6x6x1)
103 bFontCapable = FALSE;
104 Config.bCompress = FALSE;
107 DRIVER_ERROR LJM1005::Encapsulate (const RASTERDATA *pRasterData, BOOL bLastPlane)
109 if (pRasterData != NULL)
111 for (int i = 0; i < pRasterData->rastersize[COLORTYPE_COLOR]; i++)
113 m_pszCurPtr[i*m_iBPP] = szByte1[pRasterData->rasterdata[COLORTYPE_COLOR][i]];
114 m_pszCurPtr[i*m_iBPP+1] = szByte2[pRasterData->rasterdata[COLORTYPE_COLOR][i]];
115 m_pszCurPtr[i*m_iBPP] |= (m_pszCurPtr[i*m_iBPP] >> 1);
116 m_pszCurPtr[i*m_iBPP+1] |= (m_pszCurPtr[i*m_iBPP+1] >> 1);
121 m_pszCurPtr += (m_iBPP * m_dwWidth);
122 if (m_dwCurrentRaster == m_dwLastRaster)
129 DRIVER_ERROR LJM1005::EndPage ()
131 DRIVER_ERROR err = NO_ERROR;
134 memset (szStr, 0, 16);
137 err = Send ((const BYTE *) szStr, 16);
139 m_bStartPageSent = FALSE;
141 m_dwCurrentRaster = 0;
142 m_pszCurPtr = m_pszInputRasterData;
147 DRIVER_ERROR LJM1005::SendPlaneData (int iPlaneNumber, HPLJZjsJbgEncSt *se, HPLJZjcBuff *pcBuff, BOOL bLastStride)
149 DRIVER_ERROR err = NO_ERROR;
154 * Send JBIG header info
157 memset (szStr, 0x0, 128);
161 i += SendIntItem (szStr+i, 0x80000000, 0x04, 0x40);
162 i += SendIntItem (szStr+i, 0x40000000, 0x04, 0x00);
163 i += SendIntItem (szStr+i, 0x40000002, 0x14, 0x00);
167 szStr[i++] = se->planes;
169 for (int j = 3; j >= 0; j--)
171 szStr[i] = (BYTE) ((se->xd >> (8 * j)) & 0xFF);
172 szStr[4+i] = (BYTE) ((se->yd >> (8 * j)) & 0xFF);
173 szStr[8+i] = (BYTE) ((se->l0 >> (8 * j)) & 0xFF);
179 szStr[i++] = se->order;
180 szStr[i++] = se->options;
181 i += SendIntItem (szStr+i, 0x80000001, 0x04, 0xDEADBEEF);
183 BYTE *p = pcBuff->pszCompressedData + 20;
184 int iDataSize = pcBuff->dwTotalSize - 20;
186 memset (szTmpStr, 0x0, 32);
191 while (iDataSize > 65536)
193 err = Send ((const BYTE *) szStr, i);
195 err = Send ((const BYTE *) szTmpStr, 8);
197 err = Send ((const BYTE *) p, 65536);
201 // err = Send ((const BYTE *) szTmpStr+16, 16);
205 err = Send ((const BYTE *) szStr, i);
207 szTmpStr[5] = (char) ((iDataSize >> 16) & 0xFF);
208 szTmpStr[6] = (char) ((iDataSize >> 8) & 0xFF);
209 szTmpStr[7] = (char) (iDataSize & 0xFF);
210 err = Send ((const BYTE *) szTmpStr, 8);
212 err = Send ((const BYTE *) p, iDataSize);
214 // err = Send ((const BYTE *) szTmpStr+16, 16);
220 DRIVER_ERROR LJM1005::VerifyPenInfo()
226 DRIVER_ERROR LJM1005::ParsePenInfo (PEN_TYPE& ePen, BOOL QueryPrinter)
235 #endif // APDK_LJM1005