1 /*****************************************************************************\
2 Lidil.h : Interface for Lidil class
4 Copyright (c) 1996 - 2009, 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 \*****************************************************************************/
36 #define SWATH_HEIGHT 100
37 #define DEVUNITS_XBOW 2400
39 const int CANCELSIZE = 16;
40 const int SYNCSIZE = 2304;
41 const int SYNC_CMD_OPT_SIZE = 245;
50 eLDLLoadSweepData = 4,
55 eLDLDataStreamVersion = 12
60 eLDLUnknownColor = -1,
72 #define LDLPACKET_MINSIZE 16 // define the minimum packet size defined by the protocol
73 #define FRAME_SYN '$' // defined the synchronization frame
74 #define OPTIMIZED_DELAYLIMIT 0 // defined how many PrintSweep will be sent before the
75 // first LoadSweepData command
77 #define LDL_MAX_IMAGE_SIZE 2048
79 #define SIZEOF_LDLHDR 10
80 #define SIZEOF_LDLTERM 1
81 #define SIZEOF_LDL_JOB_CMDOPT 5
83 // define possible operation field
84 #define OPERATION_STJOB 0
85 #define OPERATION_ENDJOB 1
86 #define OPERATION_CANCJOB 2
88 #define SIZEOF_LDL_LDPAGE_CMDOPT 17
90 // defn for possible option field settings
91 #define MEDIATYPE_PLAIN 0 // possible types for mediatype field
92 #define MEDIATYPE_PHOTO 3
94 #define MEDIASRC_MAINTRAY 0 // possible setting for mediasrc
95 #define MEDIADEST_MAINBIN 0 // possible setting for mediadest
97 #define DRAFT_QUALITY -1 // possible setting for quality
98 #define NORMAL_QUALITY 0
99 #define BEST_QUALITY 1
100 #define MAXDPI_QIALITY 2
102 #define SPECLOAD_NONE 0 // possible setting for specload
103 #define SPECLOAD_ENVELOPE 1
105 #define MEDIALD_SPEED 0x00000001 // bitfield defn for opt_fields
106 #define NEED_TO_SERVICE_PERIOD 0x00000002
107 #define MINTIME_BTW_SWEEP 0x00000004
109 #define DEVUNITS_XBOW 2400 // Crossbow device units is 2400 dots per inch
110 #define SIZEOF_LDL_LDPAGE_OPTFLDS 4
111 #define SIZEOF_LDL_COLROPT_ACTIVECOLR 2
112 #define NO_ACTIVE_COLORS 0
113 #define SIZEOF_LDL_EJPAGE_CMDOPT 4
114 #define MEDIA_EJSPEED 1 // bitfield defn for opt_fields
115 #define SIZEOF_LDL_EJPAGE_OPTFLDS 1
116 #define SIZEOF_LDL_PRTSWP_CMDOPT 18
117 #define SWINGFMT_UNCOMPRSS 0 // define possible swing format
118 #define PRNDRN_LEFTTORIGHT 0 // define the possible print direction
119 #define PRNDRN_RIGHTTOLEFT 1
121 #define IPS_CARRSPEED 0x00000001 // bitfield defn for printsweep optional field
122 #define IPS_INIPRNSPEED 0x00000002
123 #define IPS_MEDIASPEED 0x00000004
124 #define PAPER_ACCURACY 0x00000008
125 #define ACCURATEPOSN_NEEDED 0x00000010
126 #define DRYTIME 0x00000020 // bit 6-31 undefined
128 #define SIZEOF_LDL_PRTSWP_OPTFLDS 3
129 #define SIZEOF_LDL_PRTSWP_COLROPT 29
130 #define SIZEOF_LDL_LDSWPDATA_CMDOPT 2
132 #define OPERATION_CONTINUE 2
133 #define DATASTREAMVERSION 3
134 #define OPERATION_SPIT_PEN 2
136 class Lidil: public Encapsulator
141 DRIVER_ERROR Encapsulate (RASTERDATA *InputRaster, bool bLastPlane);
142 DRIVER_ERROR StartJob(SystemServices *pSystemServices, JobAttributes *pJA);
143 DRIVER_ERROR EndJob();
144 DRIVER_ERROR StartPage(JobAttributes *pJA);
145 DRIVER_ERROR FormFeed();
146 DRIVER_ERROR Configure(Pipeline **pipeline);
147 DRIVER_ERROR SendCAPy (int iOffset);
150 DRIVER_ERROR addJobSettings() {return NO_ERROR;}
151 DRIVER_ERROR flushPrinterBuffer() {return NO_ERROR;}
153 bool selectPrintMode();
154 bool selectPrintMode(int index);
155 DRIVER_ERROR allocateSwathBuffers();
156 void addInt32(Int32 iVal);
157 void addInt16(Int16 iVal);
158 void fillLidilHeader(void *pLidilHdr, int Command, UInt16 CmdLen, UInt16 DataLen = 0);
159 unsigned int getSwathWidth (int iStart, int iLast, int iWidth);
160 DRIVER_ERROR processSwath();
161 DRIVER_ERROR processBlackSwath(bool bBlackPresent, bool bColorPresent, short sColorSize, int LeftEdge, BYTE mask);
162 DRIVER_ERROR processColorSwath(bool bPhotoPresent, bool bColorPresent, bool bBlackPresent, short *sColorSize, BYTE mask);
163 DRIVER_ERROR processPhotoSwath(bool bPhotoPresent, bool bColorPresent, BYTE mask);
164 bool isBlankRaster(BYTE *raster, int width);
165 void applyShingleMask(int iCPlane, BYTE *input);
166 DRIVER_ERROR loadSweepData (BYTE *imagedata, int imagesize);
167 DRIVER_ERROR printSweep (UInt32 SweepSize,
171 Int32 VerticalPosition,
179 bool m_bBidirectionalPrintingOn;
180 bool m_bPrevRowWasBlank;
181 bool m_bLittleEndian;
183 char m_cPrintDirection;
184 char m_cKtoCVertAlign;
185 char m_cPtoCVertAlign;
187 UInt16 m_sSwathHeight;
196 int m_iBytesPerSwing;
197 int m_iColorPenResolution;
198 int m_iBlackPenResolution;
199 int m_iNumBlackNozzles;
202 BYTE *m_ldlCompressData;
203 BYTE *m_szCompressBuf;
205 LidilCompress *m_pLidilCompress;