1 /*****************************************************************************\
2 dj9xxvip.h : Interface for the DJ9xxVIP class
4 Copyright (c) 1996 - 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 #ifndef APDK_DJ9XXVIP_H
33 #define APDK_DJ9XXVIP_H
37 //extern char *ModelString[MAX_ID_STRING];
42 class DJ9xxVIP : public Printer
45 DJ9xxVIP(SystemServices* pSS, BOOL proto=FALSE);
47 Header* SelectHeader(PrintContext* pc);
48 DRIVER_ERROR VerifyPenInfo();
49 DRIVER_ERROR ParsePenInfo(PEN_TYPE& ePen, BOOL QueryPrinter=TRUE);
50 DISPLAY_STATUS ParseError(BYTE status_reg);
52 Compressor* CreateCompressor(unsigned int RasterSize);
54 virtual BOOL UseGUIMode(PrintMode* pPrintMode);
55 BOOL UseCMYK(unsigned int iPrintMode) { return FALSE; }
57 DRIVER_ERROR CleanPen();
59 virtual PAPER_SIZE MandatoryPaperSize();
61 virtual DRIVER_ERROR CheckInkLevel();
63 virtual BOOL PhotoTrayPresent(BOOL bQueryPrinter);
65 virtual PHOTOTRAY_STATE PhotoTrayEngaged (BOOL bQueryPrinter);
67 inline virtual BOOL SupportSeparateBlack (PrintMode *pCurrentMode)
69 if (pCurrentMode->medium == mediaAuto ||
70 pCurrentMode->medium == mediaPlain)
77 virtual DRIVER_ERROR SetHint (PRINTER_HINT eHint, int iValue)
\r
81 case PAGES_IN_DOC_HINT:
\r
83 m_iNumPages = iValue;
\r
86 case SPEED_MECH_HINT:
\r
88 return SendSpeedMechCmd (iValue);
\r
90 case EXTRA_DRYTIME_HINT:
\r
92 m_cExtraDryTime = (BYTE) (iValue & 0xFF);
\r
95 case LEFT_OVERSPRAY_HINT:
\r
97 m_iLeftOverspray = iValue;
\r
100 case RIGHT_OVERSPRAY_HINT:
\r
102 m_iRightOverspray = iValue;
\r
105 case TOP_OVERSPRAY_HINT:
\r
107 m_iTopOverspray = iValue;
\r
110 case BOTTOM_OVERSPRAY_HINT:
\r
112 m_iBottomOverspray = iValue;
\r
121 virtual int GetHint (PRINTER_HINT eHint)
\r
123 if (eHint == EXTRA_DRYTIME_HINT)
\r
125 return (int) m_cExtraDryTime;
\r
130 virtual DRIVER_ERROR AddPJLHeader ();
\r
134 virtual DJ9xxVIP & operator = (Printer& rhs)
140 BOOL PCL3acceptsDriverware;
141 virtual BYTE PhotoTrayStatus(BOOL bQueryPrinter);
143 int m_iLeftOverspray;
\r
144 int m_iTopOverspray;
\r
145 int m_iRightOverspray;
\r
146 int m_iBottomOverspray;
\r
149 BOOL IsPCL3DriverwareAvailable();
\r
150 virtual DRIVER_ERROR SendSpeedMechCmd (BOOL bLastPage)
\r
154 BYTE m_cExtraDryTime;
\r
158 class DJ990Mode : public PrintMode
165 class GrayModeDJ990 : public GrayMode
168 GrayModeDJ990 (uint32_t *map, BOOL PCL3OK);
171 class DJ990CMYGrayMode : public PrintMode
175 }; //DJ990CMYGrayMode
177 #ifdef APDK_EXTENDED_MEDIASIZE
178 class DJ990KGrayMode : public PrintMode
184 class DJ9902400Mode : public PrintMode
188 virtual inline BOOL MediaCompatible (MEDIATYPE eMedia)
\r
190 return (eMedia == pmMediaType || eMedia == MEDIA_PHOTO);
\r
194 class DJ990DraftMode : public PrintMode
200 #endif // APDK_EXTENDED_MEDIASIZE
202 class DJ990BestMode : public PrintMode
208 class DJ990PhotoNormalMode : public PrintMode
211 DJ990PhotoNormalMode ();
212 }; // DJ990 PhotoNormalMode
214 #ifdef APDK_HIGH_RES_MODES
215 const int VIP_BASE_RES = 600;
217 const int VIP_BASE_RES = 300;
220 /////////////////////////////
221 #define kWhite 0x00FFFFFE
222 #define GetRed(x) (((x >> 16) & 0x0FF))
223 #define GetGreen(x) (((x >> 8) & 0x0FF))
224 #define GetBlue(x) ((x & 0x0FF))
226 #define kBertDecompressPixelSize 3
228 // Follows are all the masks for the command byte.
229 #define kTypeMask 0x80
230 #define kTypeShiftAmount 7
232 #define kCacheLiteralBitsMask 0x60
233 #define kCacheLiteralBitsShiftAmount 5
235 #define kCacheBitsMask 0x60
236 #define kCacheBitsShiftAmount 5
238 #define kRoffMask 0x18
239 #define kRoffShiftAmount 3
241 #define kReplace_countMask 0x07
243 // Now have the compiler check to make sure none of the masks overlap/underlap bits accidently.
244 #if ((kTypeMask | kCacheLiteralBitsMask | kRoffMask | kReplace_countMask) != 255)
245 #error "Your mask bits are messed up!"
248 #if ((kTypeMask | kCacheBitsMask | kRoffMask | kReplace_countMask) != 255)
249 #error "Your mask bits are messed up!"
271 eNorthEastColor = 0x2,
277 #define M10_MAX_OFFSET0 2 /* Largest unscaled value an offset can have before extra byte is needed. */
278 #define M10_MAX_COUNT0 6 /* Largest unscaled and unbiased value a count can have before extra byte is needed */
279 #define M10_COUNT_START0 1 /* What a count of zero has a value of. */
282 #define M10_MAX_OFFSET1 2
283 #define M10_MAX_COUNT1 6
284 #define M10_COUNT_START1 2
287 #define MIN(a,b) (((a)>=(b))?(b):(a))
290 #define MAX(a,b) (((a)<=(b))?(b):(a))
294 We don't actually support 4-byte RGB for anything excpet VIP printers.
295 So implimenting this and documenting it as a build option is misleading.
296 We must make halftoning support 4-byte RGB before we can publish this.
297 If we hear from someone that they need support for 4-byte RGB (and it's
298 worth it) then we will add it to halftoning, put the define in config.h,
299 and uncomment the #if here. 1/17/2002 - JLM
301 #if defined(APDK_4BYTE_RGB)
302 #define getPixel get4Pixel
303 #define putPixel put4Pixel
304 const unsigned int BYTES_PER_PIXEL = 4;
307 #define getPixel get3Pixel
308 #define putPixel put3Pixel
309 const unsigned int BYTES_PER_PIXEL = 3;
316 class Mode10 : public Compressor
319 Mode10(SystemServices* pSys, Printer* pPrinter, unsigned int RasterSize);
321 BOOL Process(RASTERDATA* input);
322 BYTE* NextOutputRaster(COLORTYPE color);
328 inline uint32_t get4Pixel(unsigned char *pixAddress, unsigned int bPrint = FALSE)
330 #ifdef APDK_LITTLE_ENDIAN
331 return (((unsigned int*)pixAddress)[0]) & kWhite;
333 return (((unsigned int*)pixAddress)[0]) & 0xFFFFFF00;
338 inline uint32_t get4Pixel(unsigned char *pixAddress, int pixelOffset)
340 #ifdef APDK_LITTLE_ENDIAN
341 return ((unsigned int*)pixAddress)[pixelOffset] & kWhite;
343 return ((unsigned int*)pixAddress)[pixelOffset] & 0xFFFFFF00;
348 inline void put4Pixel(unsigned char *pixAddress, int pixelOffset, uint32_t pixel)
350 #ifdef APDK_LITTLE_ENDIAN
351 (((unsigned int*)pixAddress)[pixelOffset] = pixel & kWhite);
353 (((unsigned int*)pixAddress)[pixelOffset] = pixel & 0xFFFFFF00);
358 inline void outputVLIBytesConsecutively(int number, unsigned char *&compressedDataPtr)
362 *compressedDataPtr++ = MIN(number, 255);
365 *compressedDataPtr++ = 0;
367 number -= MIN(number,255);
372 void put3Pixel(BYTE* pixAddress, int pixelOffset, uint32_t pixel);
373 inline uint32_t get3Pixel(BYTE* pixAddress, int pixelOffset);
374 unsigned short ShortDelta(uint32_t lastPixel, uint32_t lastUpperPixel);
382 ******************************************************************************/
383 class DJ9xxVIPProxy : public PrinterProxy
386 DJ9xxVIPProxy() : PrinterProxy(
387 "DJ9xxVIP", // family name
388 "DESKJET 96\0" // DeskJet 96x series
389 "DESKJET 98\0" // DeskJet 98x series
390 "DESKJET 99\0" // DeskJet 99x series
391 "deskjet 6122\0" // deskjet 6122
392 "deskjet 6127\0" // deskjet 6127
394 "PHOTOSMART 1215\0" // PSP 1215
395 "PHOTOSMART 1218\0" // PSP 1218
396 "PHOTOSMART 1115\0" // PSP 1115
397 "PHOTOSMART 1315\0" // PSP 1315
398 "HP BUSINESS INKJET 22\0" // 2200, 2230, 2250, 2280
399 "cp1160\0" // CP 1160
400 "HP Color Inkjet CP1700\0" // CP 1700
401 "HP BUSINESS INKJET 22\0"
404 #ifdef APDK_MLC_PRINTER
405 "officejet d\0" // officejet d series
406 "officejet 7100\0" // offjetjet 7100 series
408 ) {m_iPrinterType = eDJ9xxVIP;}
409 inline Printer* CreatePrinter(SystemServices* pSS) const { return new DJ9xxVIP(pSS); }
410 inline PRINTER_TYPE GetPrinterType() const { return eDJ9xxVIP;}
411 inline unsigned int GetModelBit() const { return 0x10000;}
417 #endif //APDK_DJ9XXVIP_H