1 /*****************************************************************************\
2 DJ3320.h : Interface for the DJ3320 class
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 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 \***************************************************************************/
32 * Author: Raghothama Cauligi
46 class DJ3320 : public Printer
49 DJ3320 (SystemServices* pSS, BOOL proto = FALSE);
53 Header* SelectHeader(PrintContext* pc);
54 virtual DRIVER_ERROR Send (const BYTE *pWriteBuff, DWORD dwWriteLen);
57 virtual DRIVER_ERROR Send (const BYTE *pWriteBuff)
59 return Send (pWriteBuff, strlen ((const char *) pWriteBuff));
63 virtual DRIVER_ERROR Encapsulate (const RASTERDATA *pRasterData, BOOL bLastPlane);
64 DRIVER_ERROR VerifyPenInfo ();
65 virtual DRIVER_ERROR ParsePenInfo (PEN_TYPE& ePen, BOOL QueryPrinter = TRUE);
66 virtual DRIVER_ERROR SkipRasters (int nBlankRasters);
67 virtual DRIVER_ERROR CleanPen ();
68 virtual DRIVER_ERROR Flush (int FlushSize);
69 DRIVER_ERROR SetPens (PEN_TYPE eNewPen);
70 virtual DRIVER_ERROR CheckInkLevel();
72 DISPLAY_STATUS ParseError (BYTE byStatusReg);
74 inline virtual BOOL SupportSeparateBlack (PrintMode *pCurrentMode)
76 if (pCurrentMode->ColorDepth[1] == 2)
87 int m_iColorPenResolution;
\r
88 int m_iBlackPenResolution;
\r
89 int m_iNumBlackNozzles;
92 DISPLAY_STATUS m_dsCurrentStatus;
93 virtual void InitPrintModes ();
94 virtual void AdjustResolution ()
101 virtual DJ3320& operator = (Printer& rhs)
109 class DJ3320GrayMode : public PrintMode
112 DJ3320GrayMode (PEN_TYPE ePen);
115 class DJ3320KDraftMode : public GrayMode
121 class DJ3320DraftMode : public PrintMode
124 DJ3320DraftMode (PEN_TYPE ePen);
128 class DJ3320NormalMode : public PrintMode
131 DJ3320NormalMode (PEN_TYPE ePen);
135 class DJ3320PhotoMode : public PrintMode
141 class DJ3600MDLNormalMode : public PrintMode
144 DJ3600MDLNormalMode ();
148 class DJ3600MDLDraftMode : public PrintMode
151 DJ3600MDLDraftMode ();
155 class DJ3600MDLPhotoMode : public PrintMode
158 DJ3600MDLPhotoMode ();
162 #if defined (APDK_DJ3320)
166 ******************************************************************************/
167 class DJ3320Proxy : public PrinterProxy
170 DJ3320Proxy() : PrinterProxy(
171 "DJ3320", // family name
187 #ifdef APDK_MLC_PRINTER
200 ) {m_iPrinterType = eDJ3320;}
201 inline Printer* CreatePrinter(SystemServices* pSS) const { return new DJ3320(pSS); }
202 inline PRINTER_TYPE GetPrinterType() const { return eDJ3320;}
203 inline unsigned int GetModelBit() const { return 0x100;}
208 #define SWATH_HEIGHT 100 // Number of color nozzles to be used
210 #ifdef APDK_LDL_COMPRESS
212 /************************************************************/
213 /* Compression Classes */
215 /************************************************************/
217 #define ALLOW_FILL_NEXT_CMD 1
219 #define FILL_0000_CMD 0x1000
220 #define FILL_FFFF_CMD 0x2000
221 #define FILL_NEXT_CMD 0x3000
222 #define FILL_IMAGE_CMD 0x4000
223 #define FILL_ODD_CMD 0x5000
224 #define FILL_EVEN_CMD 0x6000
226 #define MAX_HEADER_FRAME_SIZE 512
227 #define MAX_DATA_FRAME_SIZE 6048
228 #define MAX_RUNLENGTH 5
241 comp_ptrs_t (UInt16 *data,UInt16 datasize):image_ptr(data),raw_data(data),
242 data_length(datasize){};
247 BOOL Init(UInt16 *data, UInt16 datasize);
248 UInt16 *out_ptr, *image_ptr; /* image ptr points into the raw data */
249 UInt16 out_cnt, image_cnt, copy_cnt;
250 UInt16 out_array[2048+16];
256 UInt16 run_length; /* minimun run length */
258 UInt16 data_length; /* actual data size in record */
259 UInt16 image_bytes; /* uncompressed size */
260 UInt16 command_number;
263 #endif // APDK_LDL_COMPRESS
265 class LDLEncap //: public Compressor
268 LDLEncap (DJ3320 *pPrinter, SystemServices *pSys, PrintContext *pc);
269 DRIVER_ERROR Encapsulate (const BYTE* input, DWORD size, BOOL bLastPlane);
272 DRIVER_ERROR StartJob ();
273 DRIVER_ERROR EndPage ();
274 DRIVER_ERROR EndJob ();
275 DRIVER_ERROR Continue ();
276 DRIVER_ERROR CleanPen ();
279 DRIVER_ERROR SetVerticalSkip (int nBlankRasters);
280 void AllocateSwathBuffer (unsigned int RasterSize);
282 BOOL UpdateState (BOOL bInitialize);
284 DJ3320 *pPrinterXBow;
285 DRIVER_ERROR constructor_error;
287 short int *piCreditCount;
288 BYTE byNumberOfCommands;
289 BYTE byStatusBuff[DevIDBuffSize];
291 // BYTE byQuery[QUERYSIZE];
292 BYTE pbyCancel[CANCELSIZE];
296 DRIVER_ERROR StartPage ();
298 SystemServices *m_pSys;
305 char m_cPrintDirection;
307 BOOL m_bLittleEndian;
308 PrintContext *m_pthisPC;
310 short m_sSwathHeight;
314 BOOL m_bBidirectionalPrintingOn;
318 BYTE m_cPrintQuality;
320 BYTE *m_szCompressBuf;
324 BOOL m_bStartPageNotSent;
329 BYTE *m_pbyPacketBuff;
330 DWORD m_dwPacketBuffSize;
333 * Pen Alignment Values.
336 BYTE m_cKtoCVertAlign;
337 BYTE m_cPtoCVertAlign;
339 DRIVER_ERROR PrintSweep (UInt32 SweepSize,
343 Int32 VerticalPosition,
348 Int16 sLastNozzle = 0);
349 DRIVER_ERROR LoadSweepData (BYTE *dataPtr, int imagesize);
350 void FillLidilHeader (void *pLidilHdr, int Command,
351 UInt16 CmdLen, UInt16 DataLen);
352 unsigned int GetSwathWidth (int iFirst, int iLast, int iWidth);
353 BOOL IsBlankRaster (BYTE *input, int iWidth);
354 DRIVER_ERROR ProcessSwath (int iCurRasterWidth);
356 BOOL GetPackets (DWORD &dwBytesRead);
358 #ifdef APDK_LDL_COMPRESS
360 * Compression Related
363 BOOL GetFrameInfo (BYTE **outdata, UInt16 *datasize);
364 void CompressData (Int16 compressmode = 1);
366 UInt16 FlushCopy (UInt16 value);
367 UInt16 FlushImage ();
369 comp_ptrs_t *m_ldlCompressData;
370 #endif // APDK_LDL_COMPRESS
374 #define WRITE16(value) \
376 m_cByte = (BYTE *) &m_uVal16; \
377 if (m_bLittleEndian) \
379 m_szCmdBuf[index++] = m_cByte[1]; \
380 m_szCmdBuf[index++] = m_cByte[0]; \
384 memcpy (m_szCmdBuf+index, m_cByte, 2); \
388 #define WRITE32(value) \
390 m_cByte = (BYTE *) &m_uVal32; \
391 if (m_bLittleEndian) \
393 m_szCmdBuf[index++] = m_cByte[3]; \
394 m_szCmdBuf[index++] = m_cByte[2]; \
395 m_szCmdBuf[index++] = m_cByte[1]; \
396 m_szCmdBuf[index++] = m_cByte[0]; \
400 memcpy (m_szCmdBuf+index, m_cByte, 4); \
406 #endif //APDK_DJ3320_H