📄 internal.h
字号:
/*****************************************************************************\ internal.h : Interface for internal classes Copyright (c) 1996 - 2001, Hewlett-Packard Co. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Hewlett-Packard nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\*****************************************************************************/#ifndef APDK_INTERNAL_H#define APDK_INTERNAL_HAPDK_BEGIN_NAMESPACE/////////////////////////////////////////////////////////////////////////// contains all class declarations// for Slimhost++ driver//// merged in from file "Objects.h" 5/18/98/////////////////////////////////////////////////////////////////////////// these correspond to PCL codestypedef int TYPEFACE;#define COURIER 3#define LETTERGOTHIC 6#define CGTIMES 4101#define UNIVERS 52// character set names for PCL#define LATIN1 "0N" // aka ECMA94#define PC8 "10U"#define HP_LEGAL "1U"// used to encourage consistent ordering of color planes#define K 0#define C 1#define M 2#define Y 3#define Clight 4#define Mlight 5#define RANDSEED 77#define DEFAULT_SLOW_POLL_COUNT 30#define DEFAULT_SLOW_POLL_BIDI 3//////////////////////////////////////////enum STYLE_TYPE { UPRIGHT, ITALIC };enum WEIGHT_TYPE { NORMAL, BOLD };///////////////////////////////////////////////////////////////////#define MAX_ESC_SEQ 40#define MAX_RASTERSIZE 10000 // REVISIT#define MAX_Y_OFFSET 32767// very frequently used fragments made into macros for readability#define CERRCHECK if (constructor_error != NO_ERROR) {DBG1("CERRCHECK fired\n"); return;}#define ERRCHECK if (err != NO_ERROR) {DBG1("ERRCHECK fired\n"); return err;}#define NEWCHECK(x) if (x==NULL) return ALLOCMEM_ERROR;#define CNEWCHECK(x) if (x==NULL) { constructor_error=ALLOCMEM_ERROR; return; }//////// STATIC DATA ////////////////////////////////////////////////////////////////// escape sequences -- see PCL Implementor's Guide or Software Developer's PCL Guides// for documentation#define ESC 0x1bconst char UEL[] = {ESC, '%', '-','1','2','3','4','5','X' };const char EnterLanguage[] = {'@','P','J','L',' ','E','N','T','E','R',' ', 'L','A','N','G','U','A','G','E','=' };const char PCL3[] = {'P','C','L','3' };const char PCLGUI[] = {'P','C','L','3','G','U','I' };const char JobName[] = {'@','P','J','L',' ','J','O','B',' ','N','A','M','E',' ','=',' '};const char Reset[] = {ESC,'E'};const char crdStart[] = {ESC, '*', 'g'}; // configure raster data commandconst char cidStart[] = {ESC, '*', 'v'}; // configure image data commandconst char crdFormat = 2; // only format for 600const char grafStart[] = {ESC, '*', 'r', '1', 'A'}; // raster graphics modeconst char grafMode0[] = {ESC, '*', 'b', '0', 'M'}; // compression methodsconst char grafMode9[] = {ESC, '*', 'b', '9', 'M'};const char grafMode2[] = {ESC, '*', 'b', '2', 'M'};const char SeedSame[] = {ESC, '*', 'b', '0', 'S'};//const char EjectPage[] = {ESC, '&', 'l', '0', 'H'}; // not needed by us; will pick if no page already pickedconst char BlackExtractOff[] = {ESC, '*', 'o', '5', 'W', 0x04, 0xC, 0, 0, 0 };const char LF = '\012';const char Quote = '\042';const BYTE Venice_Power_On[] = {ESC, '%','P','u','i','f','p','.', 'p','o','w','e','r',' ','1',';', 'u','d','w','.','q','u','i','t',';',ESC,'%','-','1','2','3','4','5','X' };/*const BYTE Venice_Pre_Pick[] = {ESC, '&', 'l', -2, 'H'};{ESC, '%','P','m','e','c','h','.', 'l','o','a','d','_','p','a','p','e','r',';', 'u','d','w','.','q','u','i','t',';' };//,ESC,'%','-','1','2','3','4','5','X' };*/const char EnableDuplex[] = { ESC,'&','l', '2', 'S'};const char NoDepletion[] = {ESC, '*', 'o', '1', 'D'};const char NoGrayBalance[] = {ESC, '*', 'b', '2', 'B'};const char EnableBufferFlushing[] = { ESC,'&','b','1','5','W','P','M','L',32,4,0,5,1,2,1,1,5,4,1,1 };const char DisableBufferFlushing[] = { ESC,'&','b','1','5','W','P','M','L',32,4,0,5,1,2,1,1,5,4,1,2 };const char DriverwareJobName[] = { ESC,'*','o','5','W',0x0d,0x06,0x00,0x00,0x01 };const BYTE PEN_CLEAN_PML[]={0x1B,0x45,0x1B,0x26,0x62,0x31,0x36,0x57, 0x50,0x4D,0x4C,0x20, // EscE Esc&b16WPML{space} 0x04,0x00,0x06,0x01,0x04,0x01,0x05,0x01, 0x01,0x04,0x01,0x64}; // PML Marking-Agent-Maintenance=100//// ** move these to intenal.hstruct fOptSubSig{ float pi; const float *means;};struct fOptClassSig{ int nsubclasses; float variance; float inv_variance; float cnst; struct fOptSubSig *OptSubSig;};struct fOptSigSet{ int nbands; struct fOptClassSig *OptClassSig;};struct RESSYNSTRUCT{ int Width; int ScaleFactorMultiplier; int ScaleFactorDivisor;// int CallerAlloc; // Who does the memory alloc. int Remainder; // For use in non integer scaling cases int Repeat; // When to send an extra output raster int RastersinBuffer; // # of currently buffered rasters unsigned char* Bufferpt[NUMBER_RASTERS]; int BufferSize; unsigned char* Buffer; struct fOptSigSet OS; struct fOptSubSig rsOptSubSigPtr1[45]; struct fOptClassSig OCS; float **joint_means; float ***filter; float filterPtr1[45]; float filterPtr2[45][9]; float joint_meansPtr1[45];};typedef enum{ COLORTYPE_COLOR, // 0 COLORTYPE_BLACK, // 1 COLORTYPE_BOTH} COLORTYPE;#define MAX_COLORTYPE 2struct RASTERDATA{ int rastersize[MAX_COLORTYPE]; BYTE* rasterdata[MAX_COLORTYPE];};//////////////////////////////////////////class Pipeline;//Scaler, Halftoner, ColorMatcher, ErnieFilter, PixelReplicator,//(FRE object, ...) are subclasses of Processor.//Processor//!\internal//! Executes the "Process" method in it's containee./*!Enter a full description of the class here. This will be the API doc.\sa Scaler Halftoner ColorMatcher ErnieFilter PixelReplicator******************************************************************************/class Processor{public: Processor(); virtual ~Processor(); //virtual BOOL Process(BYTE* InputRaster=NULL, unsigned int size=0)=0; // returns TRUE iff output ready virtual BOOL Process(RASTERDATA *InputRaster=NULL)=0; // returns TRUE iff output ready virtual void Flush()=0; // take any concluding actions based on internal state virtual BYTE* NextOutputRaster(COLORTYPE rastercolor)=0; virtual unsigned int GetOutputWidth(COLORTYPE rastercolor)=0; // in bytes, not pixels virtual unsigned int GetMaxOutputWidth(COLORTYPE rastercolor) { return GetOutputWidth(rastercolor); } unsigned int iRastersReady, iRastersDelivered; Pipeline* myphase; COLORTYPE myplane; RASTERDATA raster;}; //Processor//Pipeline//! Manages the processes used in a pipeline/*!\internalEnter a full description of the class here. This will be the API doc.******************************************************************************/class Pipeline{public: Pipeline(Processor* E); virtual ~Pipeline(); void AddPhase(Pipeline* p); // add p at end //DRIVER_ERROR Execute(BYTE* InputRaster=NULL, unsigned int size=0); // run pipeline DRIVER_ERROR Execute(RASTERDATA* InputRaster=NULL); // run pipeline DRIVER_ERROR Flush(); //BOOL Process(BYTE* InputRaster=NULL, unsigned int size=0); // call processor for this phase BOOL Process(RASTERDATA* InputRaster=NULL); // call processor for this phase BYTE* NextOutputRaster(COLORTYPE rastercolor) { return Exec->NextOutputRaster(rastercolor); } unsigned int GetOutputWidth(COLORTYPE rastercolor) { return Exec->GetOutputWidth(rastercolor); } unsigned int GetMaxOutputWidth(COLORTYPE rastercolor) { return Exec->GetMaxOutputWidth(rastercolor); } Pipeline* next; Pipeline* prev; Processor* Exec; DRIVER_ERROR err;}; //Pipelinestruct PipeConfigTable{ BOOL bResSynth;#if defined(APDK_VIP_COLORFILTERING) BOOL bErnie;#endif BOOL bPixelReplicate; BOOL bColorImage; BOOL bCompress; HALFTONING_ALGORITHM eHT;};//Scaler//! Scales input by a factor/*!\internalEnter a full description of the class here. This will be the API doc.******************************************************************************/class Scaler : public Processor{public: // constructor protected -- use Create_Scaler() virtual ~Scaler(); //virtual BOOL Process(BYTE* InputRaster=NULL, unsigned int size=0)=0; virtual BOOL Process(RASTERDATA* InputRaster=NULL)=0; virtual void Flush() { Process(); } DRIVER_ERROR constructor_error; float ScaleFactor; unsigned int remainder; virtual unsigned int GetOutputWidth(COLORTYPE rastercolor); virtual unsigned int GetMaxOutputWidth(COLORTYPE rastercolor); virtual BYTE* NextOutputRaster(COLORTYPE rastercolor)=0;protected: Scaler(SystemServices* pSys,unsigned int inputwidth, unsigned int numerator,unsigned int denominator, BOOL vip, unsigned int BytesPerPixel); SystemServices* pSS; BOOL scaling; // false iff ScaleFactor==1.0 BOOL ReplicateOnly; // true iff 1<ScaleFactor<2 unsigned int iOutputWidth; unsigned int iInputWidth; BYTE* pOutputBuffer[MAX_COLORTYPE]; BOOL fractional;}; //Scaler#ifdef APDK_PSCRIPTclass PScriptProxy;#endif#ifdef APDK_LJMONOclass LJMonoProxy;#endif#ifdef APDK_LJCOLORclass LJColorProxy;#endif#if defined(APDK_PSP100) && defined (APDK_DJ9xxVIP)class PSP100Proxy;#endif#if defined(APDK_DJGENERICVIP) && defined (APDK_DJ9xxVIP)class DJGenericVIPProxy;#endif#ifdef APDK_DJ9xxVIPclass DJ9xxVIPProxy;#endif#ifdef APDK_DJ9xxclass DJ9xxProxy;#endif#if defined(APDK_DJ8xx)|| defined(APDK_DJ9xx)class DJ8xxProxy;#endif#if defined(APDK_DJ8xx)|| defined(APDK_DJ9xx)#ifdef APDK_DJ8x5class DJ8x5Proxy;#endif#endif#if defined(APDK_DJ890)class DJ890Proxy;#endif#if defined(APDK_DJ850)class DJ850Proxy;#endif#ifdef APDK_DJ6xxPhotoclass DJ6xxPhotoProxy;#endif#ifdef APDK_DJ6xxclass DJ660Proxy;#endif#ifdef APDK_DJ630class DJ630Proxy;#endif#ifdef APDK_DJ600class DJ600Proxy;#endif#ifdef APDK_DJ540class DJ540Proxy;#endif#ifdef APDK_DJ400class DJ400Proxy;#endif#ifdef APDK_DJ350class DJ350Proxy;#endif#if defined(APDK_DJ3600) && defined (APDK_DJ3320)class DJ3600Proxy;#endif#if defined (APDK_DJ3320)class DJ3320Proxy;#endif#ifdef APDK_APOLLO2560class Apollo2560Proxy;#endif#ifdef APDK_APOLLO21XXclass Apollo21xxProxy;#endif#ifdef APDK_APOLLO2XXXclass Apollo2xxxProxy;#endif//DeviceRegistry//! Isolates device dependencies/*!\internalDeviceRegistry, for isolating all device dependenciesThe data is contained in Registry.cppThis object encapsulates all model-specific data for a build.Its features are presented to client through the PrintContext.******************************************************************************/class DeviceRegistry{public: DeviceRegistry(); virtual ~DeviceRegistry(); // get model string from DevID string DRIVER_ERROR ParseDevIDString(const char* sDevID, char* strModel, int *pVIPVersion, char* strPens); // set "device" to index of entry virtual DRIVER_ERROR SelectDevice(char* model, int* pVIPVersion, char* pens, SystemServices* pSS); virtual DRIVER_ERROR SelectDevice(const char* sDevID, SystemServices* pSS); virtual DRIVER_ERROR SelectDevice(const PRINTER_TYPE Model); virtual DRIVER_ERROR GetPrinterModel(char* strModel, int* pVIPVersion, char* strPens, SystemServices* pSS); // create a Printer object as pointee of p, using the given SystemServices // and the current value of device; still needs to be configured virtual DRIVER_ERROR InstantiatePrinter(Printer*& p,SystemServices* pSS); int device; // ordinal of device from list (or UNSUPPORTED=-1)#ifdef APDK_PSCRIPT static PScriptProxy s_PScriptProxy;#endif#ifdef APDK_LJMONO static LJMonoProxy s_LJMonoProxy;#endif#ifdef APDK_LJCOLOR static LJColorProxy s_LJColorProxy;#endif#if defined(APDK_PSP100) && defined (APDK_DJ9xxVIP) static PSP100Proxy s_PSP100Proxy;#endif#if defined(APDK_DJGENERICVIP) && defined (APDK_DJ9xxVIP) static DJGenericVIPProxy s_DJGenericVIPProxy;#endif#ifdef APDK_DJ9xxVIP static DJ9xxVIPProxy s_DJ9xxVIPProxy;#endif#ifdef APDK_DJ9xx static DJ9xxProxy s_DJ9xxProxy;#endif#if defined(APDK_DJ8xx)|| defined(APDK_DJ9xx) static DJ8xxProxy s_DJ8xxProxy;#endif#if defined(APDK_DJ8xx)|| defined(APDK_DJ9xx)#ifdef APDK_DJ8x5 static DJ8x5Proxy s_DJ8x5Proxy;#endif#endif#if defined(APDK_DJ890) static DJ890Proxy s_DJ890Proxy;#endif#if defined(APDK_DJ850) static DJ850Proxy s_DJ850Proxy;#endif#ifdef APDK_DJ6xxPhoto static DJ6xxPhotoProxy s_DJ6xxPhotoProxy;#endif#ifdef APDK_DJ6xx static DJ660Proxy s_DJ660Proxy;#endif#ifdef APDK_DJ630 static DJ630Proxy s_DJ630Proxy;#endif#ifdef APDK_DJ600 static DJ600Proxy s_DJ600Proxy;#endif#ifdef APDK_DJ540 static DJ540Proxy s_DJ540Proxy;#endif#ifdef APDK_DJ400 static DJ400Proxy s_DJ400Proxy;#endif#ifdef APDK_DJ350 static DJ350Proxy s_DJ350Proxy;#endif#if defined(APDK_DJ3600) && defined (APDK_DJ3320) static DJ3600Proxy s_DJ3600Proxy;#endif#if defined (APDK_DJ3320) static DJ3320Proxy s_DJ3320Proxy;#endif#ifdef APDK_APOLLO2560 static Apollo2560Proxy s_Apollo2560Proxy;#endif#ifdef APDK_APOLLO21XX static Apollo21xxProxy s_Apollo21xxProxy;#endif#ifdef APDK_APOLLO2XXX static Apollo2xxxProxy s_Apollo2xxxProxy;#endif}; //DeviceRegistry////////////////////////////////////////////////typedef struct{ const uint32_t *ulMap1; const uint32_t *ulMap2;} ColorMap;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -