1 /*****************************************************************************\ 2 LJFastRaster.h : Interface for the LJFastRaster class 3 4 Copyright (c) 1996 - 2015, HP Co. 5 All rights reserved. 6 7 Redistribution and use in source and binary forms, with or without 8 modification, are permitted provided that the following conditions 9 are met: 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 HP 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. 18 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 \*****************************************************************************/ 30 31 32 #ifndef APDK_LJFASTRASTER_H 33 #define APDK_LJFASTRASTER_H 34 35 36 APDK_BEGIN_NAMESPACE 37 /*! 38 \internal 39 */ 40 class LJFastRaster : public Printer 41 { 42 public: 43 LJFastRaster (SystemServices* pSS,int numfonts=0, BOOL proto=FALSE); 44 ~LJFastRaster (); 45 46 virtual Header* SelectHeader (PrintContext* pc); 47 virtual DRIVER_ERROR VerifyPenInfo (); 48 virtual DRIVER_ERROR ParsePenInfo (PEN_TYPE& ePen, BOOL QueryPrinter=TRUE); 49 virtual DISPLAY_STATUS ParseError (BYTE status_reg); Flush(int FlushSize)50 virtual DRIVER_ERROR Flush (int FlushSize) 51 { 52 return NO_ERROR; 53 } 54 GetMargins(PAPER_SIZE ps,float * fMargins)55 virtual BOOL GetMargins (PAPER_SIZE ps, float *fMargins) 56 { 57 fMargins[0] = (float) 0.1667; 58 fMargins[1] = (float) 0.1667; 59 fMargins[2] = (float) 0.1667; 60 fMargins[3] = (float) 0.1667; 61 return TRUE; 62 } 63 UseCMYK(unsigned int iPrintMode)64 virtual BOOL UseCMYK (unsigned int iPrintMode) { return FALSE;} 65 virtual DRIVER_ERROR Encapsulate (const RASTERDATA* InputRaster, BOOL bLastPlane); SupportSeparateBlack(PrintMode * pCurrentMode)66 virtual BOOL SupportSeparateBlack (PrintMode *pCurrentMode) 67 { 68 return FALSE; 69 } 70 71 Compressor* CreateCompressor (unsigned int RasterSize); 72 int m_iYPos; 73 BOOL m_bStartPageNotSent; 74 75 HeaderLJFastRaster *phLJFastRaster; 76 protected: 77 78 #ifdef APDK_HP_UX 79 virtual LJFastRaster & operator = (Printer& rhs) 80 { 81 return *this; 82 } 83 #endif 84 GetDataFormat()85 virtual DATA_FORMAT GetDataFormat() { return RASTER_STRIP; } 86 87 BOOL m_bJobStarted; 88 89 Compressor *m_pCompressor; 90 }; // LJFastRaster 91 92 class LJFastRasterNormalMode : public GrayMode 93 { 94 public: 95 LJFastRasterNormalMode (); 96 }; // LJFastRasterNormalMode 97 98 class LJFastRasterDraftMode : public GrayMode 99 { 100 public: 101 LJFastRasterDraftMode (); 102 }; // LJFastRasterDraftMode 103 104 /*! 105 \internal 106 */ 107 108 #include "hptypes.h" 109 110 #define HIBYTE(sVar) (BYTE) ((sVar & 0xFF00) >> 8) 111 #define LOBYTE(sVar) (BYTE) ((sVar & 0x00FF)) 112 113 class ModeDeltaPlus : public Compressor 114 { 115 friend class LJFastRaster; 116 friend class HeaderLJFastRaster; 117 118 public: 119 ModeDeltaPlus(SystemServices* pSys, Printer* pPrinter, unsigned int RasterSize); 120 virtual ~ModeDeltaPlus(); 121 BOOL Process(RASTERDATA* input); 122 BYTE* NextOutputRaster(COLORTYPE color); 123 unsigned int GetOutputWidth(COLORTYPE color); 124 125 protected: 126 BOOL Compress(HPUInt8* outmem, uint32_t* outlen, const HPUInt8* inmem, const uint32_t row_width, const uint32_t inheight, uint32_t horz_ht_dist); 127 private: 128 Printer* thePrinter; 129 130 HPUInt8* encode_header(HPUInt8* outptr, const HPUInt8* pastoutmem, uint32_t isrun, uint32_t location, uint32_t seedrow_count, uint32_t run_count, const HPUInt8 new_color); 131 132 unsigned char *pbyInputImageBuffer; 133 134 HPLJBITMAP m_DestBitmap;; 135 long m_lCurrCDRasterRow; // Current raster index. in PrintNextBand 136 long m_lCurrBlockHeight; 137 long m_lPrinterRasterRow; // Current printer raster row. 138 139 uint32_t m_compressedsize; 140 BOOL m_bCompressed; 141 float m_fRatio; 142 HPUInt8 *pbySeedRow; 143 }; //ModeDeltaPlus 144 145 146 #ifdef APDK_LJFASTRASTER 147 //! LJFastRasterProxy 148 /*! 149 ******************************************************************************/ 150 class LJFastRasterProxy : public PrinterProxy 151 { 152 public: LJFastRasterProxy()153 LJFastRasterProxy () : PrinterProxy( 154 "LJFastRaster", // family name 155 "hp LaserJet 1010\0" 156 "hp LaserJet 1012\0" 157 /* 158 * The 1015 also supports a PCL path. It will be used a a LJMono printer. 159 * 160 "hp LaserJet 1015\0" 161 */ 162 ) 163 { 164 m_iPrinterType = eLJFastRaster; 165 } CreatePrinter(SystemServices * pSS)166 inline Printer* CreatePrinter (SystemServices* pSS) const 167 { 168 return new LJFastRaster(pSS); 169 } GetPrinterType()170 inline PRINTER_TYPE GetPrinterType () const 171 { 172 return eLJFastRaster; 173 } GetModelBit()174 inline unsigned int GetModelBit () const 175 { 176 return 0x1; 177 } 178 }; 179 #endif 180 181 APDK_END_NAMESPACE 182 183 #endif //APDK_LJFASTRASTER_H 184