~mimose/+junk/hplip-3.16.11

« back to all changes in this revision

Viewing changes to prnt/hpijs/pscript.h

  • Committer: guoyalong
  • Date: 2017-09-20 10:13:05 UTC
  • Revision ID: guoyalong@kylinos.cn-20170920101305-82zaolzpv1qghz29
Modified debian/control & debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************\
 
2
  pscript.h : Interface for the PScript 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_PSCRIPT_H
 
33
#define APDK_PSCRIPT_H
 
34
 
 
35
#ifdef APDK_PSCRIPT
 
36
 
 
37
extern "C"
 
38
{
 
39
#include "jpeglib.h"
 
40
}
 
41
#include <setjmp.h>
 
42
 
 
43
APDK_BEGIN_NAMESPACE
 
44
 
 
45
#ifdef  APDK_HIGH_RES_MODES
 
46
#define PS_BASE_RES 300
 
47
#else
 
48
#define PS_BASE_RES 150
 
49
#endif
 
50
 
 
51
 
 
52
typedef struct _StrList
 
53
{
 
54
        char *pPSString;
 
55
        struct _StrList *next;
 
56
} StrList;
 
57
 
 
58
/*!
 
59
\internal
 
60
*/
 
61
class PScript : public Printer
 
62
{
 
63
public:
 
64
    PScript (SystemServices* pSS,int numfonts=0, BOOL proto=FALSE);
 
65
        ~PScript ();
 
66
 
 
67
    PrintMode* GetMode (int index);
 
68
 
 
69
    virtual Header* SelectHeader (PrintContext* pc);
 
70
    virtual DRIVER_ERROR VerifyPenInfo ();
 
71
    virtual DRIVER_ERROR ParsePenInfo (PEN_TYPE& ePen, BOOL QueryPrinter=TRUE);
 
72
    virtual DISPLAY_STATUS ParseError (BYTE status_reg);
 
73
    virtual DRIVER_ERROR Encapsulate (const RASTERDATA* InputRaster, BOOL bLastPlane);
 
74
    inline virtual BOOL SupportSeparateBlack (PrintMode *pCurrentMode) {return FALSE;}
 
75
    virtual DRIVER_ERROR Flush (int FlushSize);
 
76
    DRIVER_ERROR SkipRasters (int nBlankRasters);
 
77
 
 
78
    virtual int PrinterLanguage ()
 
79
    {
 
80
        return 10;      // PostScript
 
81
    }
 
82
 
 
83
    virtual DRIVER_ERROR SaveText (const char *psStr, int iPointSize, int iX, int iY,
 
84
                                   const char *pTextString, int iTextStringLen,
 
85
                                   BOOL bUnderline);
 
86
 
 
87
    virtual BOOL UseCMYK(unsigned int iPrintMode) { return FALSE;}
 
88
 
 
89
    DRIVER_ERROR SendText (int iCurYPos);
 
90
    void FreeList ();
 
91
    void            JpegData (BYTE *buffer, int iSize);
 
92
 
 
93
protected:
 
94
 
 
95
#ifdef APDK_HP_UX
 
96
    virtual PScript & operator = (Printer& rhs)
 
97
    {
 
98
        return *this;
 
99
    }
 
100
#endif
 
101
 
 
102
private:
 
103
    DRIVER_ERROR    SendImage ();
 
104
    void            AddRaster (BYTE *pbyRow, int iLength);
 
105
    void            JpegRaster ();
 
106
    int             EncodeJpeg ();
 
107
    DRIVER_ERROR    StartJpegCompression ();
 
108
    void            FinishJpegCompression ();
 
109
    StrList         *m_pHeadPtr;
 
110
    StrList         *m_pCurItem;
 
111
    PrintContext    *m_pPC;
 
112
    struct jpeg_compress_struct m_cinfo;
 
113
    struct jpeg_error_mgr       m_jerr;
 
114
    jmp_buf                     m_setjmp_buffer;
 
115
 
 
116
    unsigned int     m_iRowNumber;
 
117
    int     m_iRowWidth;
 
118
    int     m_iJpegBufferPos;
 
119
    int     m_iJpegBufferSize;
 
120
    BYTE    *m_pbyInputRaster;
 
121
    BYTE    *m_pbyJpegBuffer;
 
122
    BYTE    *m_pbyEncodedBuffer;
 
123
    int     m_iPageNumber;
 
124
    COLORMODE    m_eColorMode;
 
125
}; // PScript
 
126
 
 
127
class PScriptDraftMode : public PrintMode
 
128
{
 
129
public:
 
130
        PScriptDraftMode ();
 
131
};      // PScriptDraftMode
 
132
 
 
133
class PScriptNormalMode : public PrintMode
 
134
{
 
135
public:
 
136
    PScriptNormalMode ();
 
137
}; // PScriptNormalMode
 
138
 
 
139
class PScriptGrayMode : public PrintMode
 
140
{
 
141
public:
 
142
        PScriptGrayMode ();
 
143
}; // PScriptGrayMode
 
144
 
 
145
#ifdef APDK_PSCRIPT
 
146
//! PScriptProxy
 
147
/*!
 
148
******************************************************************************/
 
149
class PScriptProxy : public PrinterProxy
 
150
{
 
151
public:
 
152
    PScriptProxy() : PrinterProxy(
 
153
    "PostScript",                   // family name
 
154
    "postscript\0"                  // models
 
155
    "HP Color LaserJet 2605\0"
 
156
    "HP Color LaserJet 2605dn\0"
 
157
#ifdef APDK_MLC_PRINTER
 
158
#endif
 
159
    ) {m_iPrinterType = ePScript;}
 
160
    inline Printer* CreatePrinter(SystemServices* pSS) const { return new PScript(pSS); }
 
161
    inline PRINTER_TYPE GetPrinterType() const { return ePScript;}
 
162
    inline unsigned int GetModelBit() const { return 0x10;}
 
163
};
 
164
#endif
 
165
 
 
166
APDK_END_NAMESPACE
 
167
 
 
168
#endif // APDK_PSCRIPT
 
169
#endif //APDK_PSCRIPT_H