~ubuntu-branches/ubuntu/raring/hplip/raring

« back to all changes in this revision

Viewing changes to prnt/hpcups/Lidil.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2009-12-14 20:08:44 UTC
  • mfrom: (2.1.118 lucid)
  • Revision ID: james.westby@ubuntu.com-20091214200844-z8qhqwgppbu3t7ze
Tags: 3.9.10-4
KBSD patch from KiBi (Closes: #560796)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************\
 
2
  Lidil.h : Interface for Lidil class
 
3
 
 
4
  Copyright (c) 1996 - 2009, Hewlett-Packard 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 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.
 
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
#ifndef LIDIL_H
 
32
#define LIDIL_H
 
33
 
 
34
class LidilCompress;
 
35
 
 
36
#define SWATH_HEIGHT        100
 
37
#define DEVUNITS_XBOW       2400
 
38
 
 
39
const int CANCELSIZE        = 16;
 
40
const int SYNCSIZE          = 2304;
 
41
const int SYNC_CMD_OPT_SIZE = 245;
 
42
 
 
43
typedef enum
 
44
{
 
45
    eLDLStartJob          = 0,
 
46
    eLDLEndJob            = 0,
 
47
    eLDLLoadPage          = 1,
 
48
    eLDLEjectPage         = 2,
 
49
    eLDLPrintSweep        = 3,
 
50
    eLDLLoadSweepData     = 4,
 
51
    eLDLQueryPrinter      = 5,
 
52
    eLDLComments          = 7,
 
53
    eLDLHandlePen         = 8,
 
54
    eLDLControl           = 12,
 
55
    eLDLDataStreamVersion = 12
 
56
} LDLCMD;
 
57
 
 
58
typedef enum
 
59
{
 
60
    eLDLUnknownColor = -1,
 
61
    eLDLBlack,
 
62
    eLDLCyan,
 
63
    eLDLMagenta,
 
64
    eLDLYellow,
 
65
    eLDLLoCyan,
 
66
    eLDLLoMagenta,
 
67
    eLDLLoBlack,
 
68
    eLDLMaxColor
 
69
} COLORENUM;
 
70
 
 
71
 
 
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
 
76
 
 
77
#define LDL_MAX_IMAGE_SIZE  2048
 
78
 
 
79
#define SIZEOF_LDLHDR         10
 
80
#define SIZEOF_LDLTERM        1
 
81
#define SIZEOF_LDL_JOB_CMDOPT 5
 
82
 
 
83
// define possible operation field
 
84
#define OPERATION_STJOB     0
 
85
#define OPERATION_ENDJOB    1
 
86
#define OPERATION_CANCJOB   2
 
87
 
 
88
#define SIZEOF_LDL_LDPAGE_CMDOPT 17
 
89
 
 
90
// defn for possible option field settings
 
91
#define MEDIATYPE_PLAIN 0           // possible types for mediatype field
 
92
#define MEDIATYPE_PHOTO 3
 
93
 
 
94
#define MEDIASRC_MAINTRAY 0         // possible setting for mediasrc
 
95
#define MEDIADEST_MAINBIN 0         // possible setting for mediadest
 
96
 
 
97
#define DRAFT_QUALITY -1       // possible setting for quality
 
98
#define NORMAL_QUALITY 0
 
99
#define BEST_QUALITY   1
 
100
#define MAXDPI_QIALITY 2
 
101
 
 
102
#define SPECLOAD_NONE       0       // possible setting for specload
 
103
#define SPECLOAD_ENVELOPE   1
 
104
 
 
105
#define MEDIALD_SPEED           0x00000001  // bitfield defn for opt_fields
 
106
#define NEED_TO_SERVICE_PERIOD  0x00000002
 
107
#define MINTIME_BTW_SWEEP       0x00000004
 
108
 
 
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
 
120
 
 
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
 
127
 
 
128
#define SIZEOF_LDL_PRTSWP_OPTFLDS 3
 
129
#define SIZEOF_LDL_PRTSWP_COLROPT 29
 
130
#define SIZEOF_LDL_LDSWPDATA_CMDOPT 2
 
131
 
 
132
#define OPERATION_CONTINUE   2
 
133
#define DATASTREAMVERSION    3
 
134
#define OPERATION_SPIT_PEN   2
 
135
 
 
136
class Lidil: public Encapsulator
 
137
{
 
138
public:
 
139
    Lidil();
 
140
    ~Lidil();
 
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);
 
148
    void            CancelJob();
 
149
protected:
 
150
    DRIVER_ERROR    addJobSettings() {return NO_ERROR;}
 
151
    DRIVER_ERROR    flushPrinterBuffer() {return NO_ERROR;}
 
152
private:
 
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,
 
168
                             bool ColorPresent,
 
169
                             bool BlackPresent,
 
170
                                                     bool PhotoPresent,
 
171
                             Int32 VerticalPosition,
 
172
                             Int32 LeftEdge,
 
173
                             Int32 RightEdge,
 
174
                             char PrintDirection,
 
175
                             Int16 sFirstNozzle,
 
176
                             Int16 sLastNozzle);
 
177
 
 
178
    PrintMode    *m_pPM;
 
179
    bool         m_bBidirectionalPrintingOn;
 
180
    bool         m_bPrevRowWasBlank;
 
181
    bool         m_bLittleEndian;
 
182
    char         m_cPassNumber;
 
183
    char         m_cPrintDirection;
 
184
    char         m_cKtoCVertAlign;
 
185
    char         m_cPtoCVertAlign;
 
186
    char         m_cPlaneNumber;
 
187
    UInt16       m_sSwathHeight;
 
188
    UInt16       m_sRefCount;
 
189
    int          m_iBitDepth;
 
190
    int          m_iNextRaster;
 
191
    int          m_iBlankRasters;
 
192
    int          m_iVertPosn;
 
193
    int          m_iImageWidth;
 
194
    int          m_iRasterCount;
 
195
    int          m_lidil_version;
 
196
    int          m_iBytesPerSwing;
 
197
    int          m_iColorPenResolution;
 
198
    int          m_iNextColor;
 
199
    int          m_iLeftMargin;
 
200
    BYTE         *m_ldlCompressData;
 
201
    BYTE         *m_szCompressBuf;
 
202
    BYTE         ***m_SwathData;
 
203
    LidilCompress    *m_pLidilCompress;
 
204
};
 
205
 
 
206
#endif // LIDIL_H
 
207