1 /*****************************************************************************\
2 ljzjsmono.cpp : Implementation for the LJZjsMono class
4 Copyright (c) 1996 - 2007, 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 \*****************************************************************************/
31 #ifdef APDK_LJZJS_MONO
35 #include "printerproxy.h"
36 #include "resources.h"
38 #include "ljzjsmono.h"
42 extern uint32_t ulMapGRAY_K_6x6x1[9 * 9 * 9];
44 extern uint32_t ulMapDJ600_CCM_K[9 * 9 * 9];
46 LJZjsMono::LJZjsMono (SystemServices* pSS, int numfonts, BOOL proto)
47 : LJZjs (pSS, numfonts, proto)
52 pMode[GRAYMODE_INDEX] = new LJZjsMonoDraftGrayMode ();
53 pMode[DEFAULTMODE_INDEX] = new LJZjsMonoNormalGrayMode ();
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 = eLJZjsMono;
75 LJZjsMono::~LJZjsMono ()
79 LJZjsMonoDraftGrayMode::LJZjsMonoDraftGrayMode ()
80 : GrayMode(/*ulMapDJ600_CCM_K*/ulMapGRAY_K_6x6x1)
89 theQuality = qualityDraft;
90 pmQuality = QUALITY_DRAFT;
91 #ifdef APDK_AUTODUPLEX
92 bDuplexCapable = TRUE;
94 Config.bCompress = FALSE;
95 medium = mediaAuto; // compatible with any media type
98 LJZjsMonoNormalGrayMode::LJZjsMonoNormalGrayMode ()
99 : GrayMode(/*ulMapDJ600_CCM_K*/ulMapGRAY_K_6x6x1)
103 ResolutionY[0] = 600;
108 bFontCapable = FALSE;
109 #ifdef APDK_AUTODUPLEX
110 bDuplexCapable = TRUE;
112 Config.bCompress = FALSE;
113 medium = mediaAuto; // compatible with any media type
116 DRIVER_ERROR LJZjsMono::Encapsulate (const RASTERDATA *pRasterData, BOOL bLastPlane)
118 if (pRasterData != NULL)
120 memcpy (m_pszCurPtr, pRasterData->rasterdata[COLORTYPE_COLOR],
121 pRasterData->rastersize[COLORTYPE_COLOR]);
125 m_pszCurPtr += m_dwWidth;
126 if (m_dwCurrentRaster == m_dwLastRaster)
133 DRIVER_ERROR LJZjsMono::EndPage ()
135 DRIVER_ERROR err = NO_ERROR;
138 SendChunkHeader (szStr, 16, ZJT_END_PAGE, 0);
139 err = Send ((const BYTE *) szStr, 16);
141 m_bStartPageSent = FALSE;
143 m_dwCurrentRaster = 0;
144 m_pszCurPtr = m_pszInputRasterData;
149 DRIVER_ERROR LJZjsMono::SendPlaneData (int iPlaneNumber, HPLJZjsJbgEncSt *se, HPLJZjcBuff *pcBuff, BOOL bLastStride)
151 DRIVER_ERROR err = NO_ERROR;
156 * Send JBIG header info
159 i = SendChunkHeader (szStr, 36, ZJT_JBIG_BIH, 0);
161 memcpy (szStr + 16, pcBuff->pszCompressedData, 20);
162 err = Send ((const BYTE *) szStr, 36);
165 pcBuff->dwTotalSize -= 20;
167 if (pcBuff->dwTotalSize % 16)
169 iPadCount = ((pcBuff->dwTotalSize / 16 + 1) * 16) - pcBuff->dwTotalSize;
171 DWORD dwTotal = pcBuff->dwTotalSize;
172 BYTE *p = pcBuff->pszCompressedData + 20;
174 for (int j = 0; j < i; j++)
176 SendChunkHeader (szStr, 16 + 65536, ZJT_JBIG_HID, 0);
177 err = Send ((const BYTE *) szStr, 16);
178 err = Send ((const BYTE *) p, 65536);
182 i = SendChunkHeader (szStr, 16 + dwTotal + iPadCount, ZJT_JBIG_HID, 0);
183 err = Send ((const BYTE *) szStr, 16);
184 err = Send ((const BYTE *) p, dwTotal);
188 memset (szStr, 0, iPadCount);
189 err = Send ((const BYTE *) szStr, iPadCount);
191 i = SendChunkHeader (szStr, 16, ZJT_END_JBIG, 0);
192 err = Send ((const BYTE *) szStr, 16);
196 DRIVER_ERROR LJZjsMono::VerifyPenInfo()
202 DRIVER_ERROR LJZjsMono::ParsePenInfo (PEN_TYPE& ePen, BOOL QueryPrinter)
211 #endif // APDK_LJZJS_MONO