1 /*****************************************************************************\
2 LJJetReady.h : Interface for the LJJetReady class
4 Copyright (c) 1996 - 2008, 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 #ifndef APDK_LJJETREADY_H
33 #define APDK_LJJETREADY_H
35 #ifdef APDK_LJJETREADY
\r
49 enum COMPRESS_MODE { COMPRESS_MODE0 = 0,
52 COMPRESS_MODE_AUTO = 10,
53 COMPRESS_MODE_JPEG = 11,
54 COMPRESS_MODE_LJ = 12,
\r
55 COMPRESS_MODE_GRAFIT = 16
58 class LJJetReady : public Printer
61 LJJetReady (SystemServices* pSS,int numfonts=0, BOOL proto=FALSE);
64 virtual Header* SelectHeader (PrintContext* pc);
65 virtual DRIVER_ERROR VerifyPenInfo ();
66 virtual DRIVER_ERROR ParsePenInfo (PEN_TYPE& ePen, BOOL QueryPrinter=TRUE);
67 virtual DISPLAY_STATUS ParseError (BYTE status_reg);
68 inline virtual BOOL SupportSeparateBlack() {return FALSE;}
69 virtual DRIVER_ERROR Flush (int FlushSize)
74 virtual BOOL GetMargins (PAPER_SIZE ps, float *fMargins)
76 fMargins[0] = (float) 0.1667;
77 fMargins[1] = (float) 0.1667;
78 fMargins[2] = (float) 0.1667;
79 fMargins[3] = (float) 0.1667;
83 virtual BOOL UseCMYK (unsigned int iPrintMode) { return FALSE;}
84 virtual DRIVER_ERROR Encapsulate (const RASTERDATA* InputRaster, BOOL bLastPlane);
86 // See comments in ljmono.h for an explanation.
88 virtual BOOL HagakiFeedDuplexerPresent (BOOL bQueryPrinter)
92 virtual BOOL SupportSeparateBlack (PrintMode *pCurrentMode)
98 Compressor* CreateCompressor (unsigned int RasterSize);
99 Compressor* GetCompressor() { return m_pCompressor; }
103 bool m_bStartPageNotSent;
104 HeaderLJJetReady *phLJJetReady;
109 virtual LJJetReady & operator = (Printer& rhs)
115 virtual DATA_FORMAT GetDataFormat() { return RASTER_STRIP; }
118 Compressor *m_pCompressor;
119 PrintContext *thePrintContext;
121 void *m_hHPLibHandle;
123 COMPRESS_MODE m_eCompressMode;
127 class LJJetReadyNormalMode : public PrintMode
130 LJJetReadyNormalMode ();
131 }; // LJJetReadyNormalMode
133 class LJJetReadyBestColorMode : public PrintMode
136 LJJetReadyBestColorMode ();
137 }; // LJJetReadyBestColorMode
139 class LJJetReadyGrayMode : public PrintMode
142 LJJetReadyGrayMode ();
143 }; // LJJetReadyGrayMode
145 class LJJetReadyBestGrayMode : public PrintMode
148 LJJetReadyBestGrayMode ();
149 }; // LJJetReadyBestGrayMode
155 const int JPEG_HEADER_SIZE = 600; //As recommended by JPEG Library Docs
156 const int JPEG_TRAILER_SIZE = 100; //As recommended by JPEG Library Docs
158 const int QTABLE_SIZE = 64;
160 DWORD qtable0[QTABLE_SIZE];
161 DWORD qtable1[QTABLE_SIZE];
162 DWORD qtable2[QTABLE_SIZE];
166 class ModeJPEG : public Compressor
168 friend class LJJetReady;
169 friend class HeaderLJJetReady;
172 ModeJPEG(SystemServices* pSys, Printer* pPrinter, unsigned int RasterSize, COMPRESS_MODE eCompressMode);
174 BOOL Process(RASTERDATA* input);
175 BYTE* NextOutputRaster(COLORTYPE color);
176 unsigned int GetOutputWidth(COLORTYPE color);
177 long GetCoordinates() { return m_lPrinterRasterRow; }
178 DRIVER_ERROR SendWhiteStrips (int iPageHeight, BOOL bGray);
181 BOOL Compress( HPLJBITMAP *pSrcBmap,
182 HPLJBITMAP *pTrgBitmap,
187 BYTE* GetBuffer(void);
188 void SetBuffer(BYTE* pJPEGBuffer);
189 DWORD GetJPEGBufferSize(void) const;
191 static BYTE* fpJPEGBuffer; // This is passed destination JPEG buffer
192 static DWORD fJPEGBufferPos; // position of first empty Byte in return Buffer
194 JSAMPROW fRow_array[1]; // JPEG processing routine expects an
195 // array of pointers. We always send
201 //----------------------------------------------------------------
202 // These are JPEG library "objects" used in the actual jpeg compression routines
203 //----------------------------------------------------------------
204 struct jpeg_compress_struct cinfo;
205 struct jpeg_decompress_struct dinfo;
206 struct jpeg_error_mgr jerr;
207 struct jpeg_destination_mgr dest;
208 jmp_buf setjmp_buffer; /* for return to caller */
210 //----------------------------------------------------------------
211 // IJG dest manager callback
212 //----------------------------------------------------------------
213 static void jpeg_flush_output_buffer_callback(JOCTET *outbuf, BYTE* buffer, DWORD size);
218 HPLJBITMAP m_SourceBitmap;
219 HPLJBITMAP m_DestBitmap;
220 long m_lCurrCDRasterRow; // Current raster index. in PrintNextBand
221 long m_lPrinterRasterRow; // Current printer raster row.
222 int m_iRasterWidth; // Input image width
223 COMPRESS_MODE m_eCompressMode;
227 #ifdef APDK_LJJETREADY
230 ******************************************************************************/
231 class LJJetReadyProxy : public PrinterProxy
234 LJJetReadyProxy() : PrinterProxy(
235 "LJJetReady", // family name
236 "hp color LaserJet 3500\0"
237 "hp color LaserJet 3550\0"
238 "hp color LaserJet 3600\0"
\r
239 "Hp Color LaserJet CP151\0"
240 #ifdef APDK_MLC_PRINTER
242 ) {m_iPrinterType = eLJJetReady;}
243 inline Printer* CreatePrinter(SystemServices* pSS) const { return new LJJetReady(pSS); }
244 inline PRINTER_TYPE GetPrinterType() const { return eLJJetReady;}
245 inline unsigned int GetModelBit() const { return 0x1;}
251 #endif // APDK_LJJETREADY
252 #endif //APDK_LJJETREADY_H