⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dj9xx.cpp

📁 HP喷墨打印机驱动代码 HP内部资料! 珍贵 珍贵 珍贵
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************\  dj9xx.cpp : Implimentation for the DJ9xx class  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.\*****************************************************************************/#if APDK_DJ9xx#include "header.h"#include "io_defs.h"#include "dj8xx.h"#include "dj9xx.h"#include "resources.h"#include "printerproxy.h"APDK_BEGIN_NAMESPACEextern BYTE* GetHT3x3_4();extern BYTE* GetHT6x6_4_970();APDK_END_NAMESPACEAPDK_BEGIN_NAMESPACEextern uint32_t ulMapBROADWAY_KCMY[ 9 * 9 * 9 ];extern uint32_t ulMapBROADWAY_KCMY_3x3x2[ 9 * 9 * 9 ];extern uint32_t ulMapBROADWAY_Gossimer_Normal_KCMY[ 9 * 9 * 9 ];extern uint32_t ulMapVOLTAIRE_CCM_K[ 9 * 9 * 9 ];extern uint32_t ulMapGRAY_K_6x6x1[9 * 9 * 9];extern uint32_t ulMapBROADWAY_Draft_KCMY[9 * 9 * 9];extern void AsciiHexToBinary(BYTE* dest, char* src, int count);DJ9xx::DJ9xx(SystemServices* pSS, BOOL proto): Printer(pSS,NUM_DJ6XX_FONTS,proto){    if (IOMode.bDevID)    {        bCheckForCancelButton = TRUE;        constructor_error = VerifyPenInfo();        CERRCHECK;    }    else ePen=BOTH_PENS;    // matches default mode    pMode[DEFAULTMODE_INDEX] = new BroadwayMode1();   // Normal Color    pMode[SPECIALMODE_INDEX] = new BroadwayMode2();   // Photo#ifdef APDK_AUTODUPLEX/* *  When bidi is available, query printer for duplexer *  For now, this is available only on Linux which is unidi only. */    bDuplexCapable = TRUE;#endif#ifdef APDK_EXTENDED_MEDIASIZE    pMode[GRAYMODE_INDEX]      = new BroadwayMode3 ();   // Draft Grayscale K    pMode[SPECIALMODE_INDEX+1] = new BroadwayMode4 ();   // Normal Grayscale K    pMode[SPECIALMODE_INDEX+2] = new BroadwayMode5 ();   // Draft Color    pMode[SPECIALMODE_INDEX+3] = new BroadwayModePres();       // Best Color    pMode[SPECIALMODE_INDEX+4] = new BroadwayModePhotoPres();  // HiRes    ModeCount=7;#else    pMode[GRAYMODE_INDEX]    = new GrayMode (ulMapVOLTAIRE_CCM_K);    ModeCount=3;#endif    CMYMap = ulMapBROADWAY_KCMY;}DJ9xx::~DJ9xx(){ }BroadwayMode1::BroadwayMode1()   // Normal Color: PrintMode(ulMapBROADWAY_KCMY_3x3x2)// 600x600x1 K// 300x300x2 CMY{    ColorDepth[K]=1;  // 600x600x1 K    for (int i=1; i < 4; i++)        ColorDepth[i]=2;    // 300x300x2 CMY    ResolutionX[K]=ResolutionY[K]=600;    MixedRes = TRUE;#ifdef APDK_AUTODUPLEX    bDuplexCapable = TRUE;#endif    ColorFEDTable = (BYTE*) HT300x3004level970_open;}BroadwayMode2::BroadwayMode2()    // Photo: PrintMode(ulMapBROADWAY_Gossimer_Normal_KCMY)// 600x600x1 K// 600x600x2 CMY{    int i;    ColorDepth[K]=1;  // 600x600x1 K    for (i=1; i < 4; i++)        ColorDepth[i]=2;    // 300x300x2 CMY    for (i=0; i < 4; i++)        ResolutionX[i]=ResolutionY[i]=600;    BaseResX = BaseResY = 600;    MixedRes = FALSE;    medium = mediaGlossy;    ColorFEDTable = GetHT6x6_4_970();//    strcpy(ModeName, "Photo");    bFontCapable=FALSE;#ifdef APDK_AUTODUPLEX    bDuplexCapable = FALSE;#endif    pmQuality   = QUALITY_BEST;    pmMediaType = MEDIA_PHOTO;}#ifdef APDK_EXTENDED_MEDIASIZEBroadwayMode3::BroadwayMode3 () : GrayMode (ulMapVOLTAIRE_CCM_K)   // Draft Grayscale K{#ifdef APDK_AUTODUPLEX    bDuplexCapable = TRUE;#endif    pmQuality = QUALITY_DRAFT;    theQuality = qualityDraft;}BroadwayMode4::BroadwayMode4 () : PrintMode (ulMapGRAY_K_6x6x1)    // Normal Grayscale K{    bFontCapable = FALSE;#ifdef APDK_AUTODUPLEX    bDuplexCapable = TRUE;#endif    ResolutionX[0] =    ResolutionY[0] = 600;    BaseResX = 600;    BaseResY = 600;    CompatiblePens[1] = BLACK_PEN;    pmQuality = QUALITY_NORMAL;    theQuality = qualityNormal;    dyeCount = 1;    pmColor = GREY_K;}BroadwayMode5::BroadwayMode5()    // Draft Color: PrintMode(ulMapBROADWAY_Draft_KCMY)// 300x300x1 K// 300x300x1 CMY{#ifdef APDK_AUTODUPLEX    bDuplexCapable = TRUE;#endif    pmQuality = QUALITY_DRAFT;    theQuality = qualityDraft;}// 2001.06.14 mrb: Added Presentation Mode: 600x600x2 for color,//                                          600x600x1 for b/wBroadwayModePres::BroadwayModePres() : PrintMode(ulMapBROADWAY_KCMY)// 600x600x1 K// 600x600x2 CMY{    ColorDepth[K]=1;        ColorDepth[C]=2;    ColorDepth[M]=2;    ColorDepth[Y]=2;    ResolutionX[K]=ResolutionY[K]=600;    ResolutionX[C]=ResolutionY[C]=600;    ResolutionX[M]=ResolutionY[M]=600;    ResolutionX[Y]=ResolutionY[Y]=600;    BaseResX = BaseResY = 600;    theQuality = qualityPresentation;    // 2001.07.09 mrb: Added for presentation mode of DJ970    ColorFEDTable = (BYTE*) HT600x600x4_Pres970_open;#ifdef APDK_AUTODUPLEX    bDuplexCapable = TRUE;#endif    pmQuality   = QUALITY_BEST;}// 2001.06.14 mrb: Added Presentation Photo Mode: 1200x1200x1 for color.BroadwayModePhotoPres::BroadwayModePhotoPres() : PrintMode(ulMapBROADWAY_Gossimer_Normal_KCMY) // 1200x1200x1 CMY{    ColorDepth[K]=1;    ColorDepth[C]=1;    ColorDepth[M]=1;    ColorDepth[Y]=1;    ResolutionX[K]=ResolutionY[K]=1200;    ResolutionX[C]=ResolutionY[C]=1200;    ResolutionX[M]=ResolutionY[M]=1200;    ResolutionX[Y]=ResolutionY[Y]=1200;    BaseResX = BaseResY = 1200;    medium = mediaGlossy;    theQuality = qualityPresentation;    // 2001.07.09 mrb: Added for presentation mode of DJ970    ColorFEDTable = (BYTE*) HT1200x1200x1_PhotoPres970_open;    bFontCapable=FALSE;    pmQuality   = QUALITY_HIGHRES_PHOTO;    pmMediaType = MEDIA_PHOTO;}#endif  // APDK_EXTENDED_MEDIASIZEBOOL DJ9xx::UseGUIMode(PrintMode* pPrintMode){    if ((!pPrintMode->bFontCapable)#ifdef APDK_AUTODUPLEX        || pPrintMode->QueryDuplexMode ()#endif        )        return TRUE;    return FALSE;}Compressor* DJ9xx::CreateCompressor(unsigned int RasterSize){    return new Mode2(pSS,RasterSize);}Header900::Header900(Printer* p,PrintContext* pc)    : Header895(p,pc){ }Header* DJ9xx::SelectHeader(PrintContext* pc){    return new Header900(this,pc);}DRIVER_ERROR Header900::Send(){    DRIVER_ERROR err;    //BOOL bDuplex = FALSE;    StartSend();    // this code will look for the duplexer enabled in the device ID and send the right    // escape to the printer to enable duplexing.  At this time, however, we are not    // going to support duplexing.  One, it is not supported with PCL3, which we need    // for device font support.  Second, we don't have the resources to reformat the page    // for book duplexing and can only do tablet.    /*BYTE bDevIDBuff[DevIDBuffSize];    err = theTranslator->pSS->GetDeviceID(bDevIDBuff, DevIDBuffSize, TRUE);    ERRCHECK;    // look for duplex code in bDevIDBuff    Duplex = DuplexEnabled(bDevIDBuff);    if(bDuplex)    {        err = thePrinter->Send((const BYTE*)EnableDuplex,sizeof(EnableDuplex));        ERRCHECK;    }*/#ifdef APDK_AUTODUPLEX    if (thePrintContext->QueryDuplexMode () != DUPLEXMODE_NONE)        err = thePrinter->Send ((const BYTE *) EnableDuplex, sizeof (EnableDuplex));#endif    err = ConfigureRasterData();    ERRCHECK;    err=Graphics();     // start raster graphics and set compression mode    return err;}BOOL Header900::DuplexEnabled(BYTE* bDevIDBuff){    char* pStrVstatus = NULL;    char* pStrDuplex = NULL;    char* pStrSemicolon = NULL;    if((pStrVstatus = strstr((char*)bDevIDBuff + 2,"VSTATUS:")))        pStrVstatus += 8;    else        return FALSE;    pStrDuplex = pStrVstatus;    pStrSemicolon = pStrVstatus;    // now parse VSTATUS parameters to find if we are in simplex or duplex    if (!(pStrSemicolon = strstr((char*)pStrVstatus,";")))        return FALSE;    if ( (pStrDuplex = strstr((char*)pStrVstatus,"DP")) )        if(pStrDuplex < pStrSemicolon)            return TRUE;    if ( (pStrDuplex = strstr((char*)pStrVstatus,"SM")) )        if(pStrDuplex < pStrSemicolon)            return FALSE;    DBG1("didn't find SM or DP!!\n");    return FALSE;}BYTE DJ9xx::PhotoTrayStatus(    BOOL bQueryPrinter){    DRIVER_ERROR err;    char* pStrVstatus = NULL;    char* pStrPhotoTray = NULL;    char* pStrSemicolon = NULL;    BYTE bDevIDBuff[DevIDBuffSize];    if (!IOMode.bDevID)    {        bQueryPrinter = FALSE;    }    err=pSS->GetDeviceID(bDevIDBuff, DevIDBuffSize, bQueryPrinter);    if (err!=NO_ERROR)    {        return 0;    }    if((pStrVstatus = strstr((char*)bDevIDBuff + 2,"VSTATUS:")))    {        pStrVstatus += 8;    }    else    {        return 0;    }    pStrPhotoTray = pStrVstatus;    pStrSemicolon = pStrVstatus;    // now parse VSTATUS parameters to find if we are in simplex or duplex    if (!(pStrSemicolon = strstr((char*)pStrVstatus,";")))    {        return 0;    }    if ( (pStrPhotoTray = strstr((char*)pStrVstatus,"PH")) )    {        if(pStrPhotoTray < pStrSemicolon)        {            return '9';  // return same as VIP installed and engaged status        }    }    if ( (pStrPhotoTray = strstr((char*)pStrVstatus,"NR")) )    {        if(pStrPhotoTray < pStrSemicolon)        {            return 0;        }    }    DBG1("didn't find PH or NR!!\n");    return 0;} //PhotoTrayStatusBOOL DJ9xx::PhotoTrayPresent(    BOOL bQueryPrinter){    // present (and not engaged) == 8    return ((PhotoTrayStatus(bQueryPrinter) & 8) == 8);} //PhotoTrayInstalledPHOTOTRAY_STATE DJ9xx::PhotoTrayEngaged(    BOOL bQueryPrinter){    // present and engaged == 9    return ((PHOTOTRAY_STATE) ((PhotoTrayStatus(bQueryPrinter) & 9) == 9));} //PhotoTrayEngagedPAPER_SIZE DJ9xx::MandatoryPaperSize(){    if (PhotoTrayEngaged (TRUE))    {        return PHOTO_SIZE;    }    else    {        return UNSUPPORTED_SIZE;   // code for "nothing mandatory"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -