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

📄 dj8xx.cpp

📁 HP喷墨打印机驱动代码 HP内部资料! 珍贵 珍贵 珍贵
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************\  dj8xx.cpp : Implimentation for the DJ8xx 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 defined(APDK_DJ8xx)|| defined(APDK_DJ9xx)#include "header.h"#include "io_defs.h"#include "dj8xx.h"#include "printerproxy.h"APDK_BEGIN_NAMESPACEextern BYTE* GetHT3x3_4();extern BYTE* GetHT6x6_4();APDK_END_NAMESPACEAPDK_BEGIN_NAMESPACEextern uint32_t ulMapVENICE_KCMY[ 9 * 9 * 9 ];extern uint32_t ulMapVOLTAIRE_CCM_K[ 9 * 9 * 9 ];extern uint32_t ulMapVENICE_HB_KCMY[ 9 * 9 * 9 ];extern uint32_t ulMapVENICE_Binary_KCMY[ 9 * 9 * 9 ];extern uint32_t ulMapGRAY_K_6x6x1[9 * 9 * 9];VeniceMode1::VeniceMode1()    // Normal Color: PrintMode(ulMapVENICE_KCMY)// 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;    ColorFEDTable = GetHT3x3_4();    bFontCapable = FALSE;       // Venice can't do fonts and hifipe at same time}VeniceMode2::VeniceMode2()    // Photo: PrintMode(ulMapVENICE_HB_KCMY)// 600x600x1 K// 600x600x2 CMY{    int i;    ColorDepth[K]=1;  // 600x600x1 K    for (i=1; i < 4; i++)        ColorDepth[i]=2;    // 600x600x2 CMY    for (i=0; i < 4; i++)        ResolutionX[i]=ResolutionY[i]=600;    BaseResX = BaseResY = 600;    MixedRes = FALSE;    medium     = mediaGlossy;    theQuality = qualityPresentation;    ColorFEDTable = GetHT6x6_4();     bFontCapable = FALSE;       // Venice can't do fonts and hifipe at same time//     strcpy(ModeName, "Photo");     pmQuality   = QUALITY_BEST;     pmMediaType = MEDIA_PHOTO;}VeniceMode3::VeniceMode3()    // Draft Color: PrintMode(ulMapVENICE_Binary_KCMY)// 300x300x1 KCMY{    theQuality = qualityDraft;//    strcpy(ModeName,"Draft");    pmQuality = QUALITY_DRAFT;}VeniceMode4::VeniceMode4()    // Draft Gray K: GrayMode(ulMapVOLTAIRE_CCM_K)// 300x300x1 K{    theQuality = qualityDraft;    pmQuality = QUALITY_DRAFT;}#ifdef APDK_EXTENDED_MEDIASIZEVeniceMode5::VeniceMode5()    // Normal Gray K: GrayMode(ulMapGRAY_K_6x6x1)// 600x600x1 K{    BaseResX = BaseResY = 600;    ResolutionX[K]=ResolutionY[K]=600;    bFontCapable = FALSE;}#endifDJ8xx::DJ8xx(SystemServices* pSS,                       int numfonts, BOOL proto)    : Printer(pSS, numfonts, proto){    if ((!proto) && (IOMode.bDevID))    {        constructor_error = VerifyPenInfo();        CERRCHECK;    }    else ePen=BOTH_PENS;    // matches default mode#ifdef APDK_EXTENDED_MEDIASIZE    pMode[GRAYMODE_INDEX]      = new VeniceMode5 ();   // Normal Gray K#else    pMode[GRAYMODE_INDEX]      = new GrayMode (ulMapVOLTAIRE_CCM_K);   // Normal Gray K#endif    pMode[DEFAULTMODE_INDEX]   = new VeniceMode1 ();   // Normal Color    pMode[SPECIALMODE_INDEX]   = new VeniceMode2 ();   // Photo    pMode[SPECIALMODE_INDEX+1] = new VeniceMode3 ();   // Draft Color    pMode[SPECIALMODE_INDEX+2] = new VeniceMode4 ();   // Draft Gray K    ModeCount = 5;    CMYMap = ulMapVENICE_Binary_KCMY;    DBG1("DJ8xx created\n");}Header895::Header895(Printer* p,PrintContext* pc)    : Header(p,pc){ }DRIVER_ERROR Header895::Send(){   DRIVER_ERROR err;    StartSend();    err = ConfigureRasterData();    ERRCHECK;    err=Graphics();     // start raster graphics and set compression mode    // this is the pre-pick command but it doesn't work.  hmm...    //    err = thePrinter->Send((const BYTE*)Venice_Pre_Pick,sizeof(Venice_Pre_Pick));return err;}DRIVER_ERROR Header895::StartSend()// common items gathered for code savings{    DRIVER_ERROR err;    err = thePrinter->Send((const BYTE*)Reset,sizeof(Reset));    ERRCHECK;    err = thePrinter->Send((const BYTE*)UEL,sizeof(UEL));    ERRCHECK;    err = thePrinter->Send((const BYTE*)EnterLanguage,sizeof(EnterLanguage));    ERRCHECK;    if (!thePrinter->UseGUIMode(thePrintContext->CurrentMode))        err = thePrinter->Send((const BYTE*)PCL3,sizeof(PCL3));    else        err = thePrinter->Send((const BYTE*)PCLGUI,sizeof(PCLGUI));    ERRCHECK;    err = thePrinter->Send((const BYTE*)&LF,1);    ERRCHECK;    err=Modes();            // Set media source, type, size and quality modes.    ERRCHECK;//  Now send media pre-load command    err = thePrinter->Send ((const BYTE *) "\033&l-2H", 6);       ERRCHECK;    char uom[10];    sprintf(uom,"%c%c%c%d%c",ESC,'&','u',thePrintContext->EffectiveResolutionY(),'D');    err=thePrinter->Send((const BYTE*)uom, strlen (uom));    ERRCHECK;    if (!thePrinter->UseGUIMode(thePrintContext->CurrentMode))        err=Margins();          // set margins    else    // special GUI mode top margin set    {        CAPy = thePrintContext->GUITopMargin();    }    return err;}extern BYTE EscAmplCopy(BYTE *dest, int num, char end);DRIVER_ERROR Header895::Graphics()// variant due to compression problems{    DRIVER_ERROR error= thePrinter->Send((const BYTE*)grafStart, sizeof(grafStart) );    if (error!=NO_ERROR)        return error;    if (thePrintMode->Config.bCompress)        {            error= thePrinter->Send((const BYTE*)grafMode2, sizeof(grafMode2) );            if (error!=NO_ERROR)                return error;        }    else        error= thePrinter->Send((const BYTE*)grafMode0, sizeof(grafMode0) );return error;#define GRAPHICSIZE (sizeof(grafStart)+sizeof(grafMode9)+sizeof(SeedSame))}Header* DJ8xx::SelectHeader(PrintContext* pc){    return new Header895(this,pc);}DRIVER_ERROR DJ8xx::VerifyPenInfo(){    DRIVER_ERROR err = NO_ERROR;    if(IOMode.bDevID == FALSE)    {        return err;    }    err = ParsePenInfo(ePen);    if(err == UNSUPPORTED_PEN) // probably Power Off - pens couldn't be read    {        DBG1("DJ8xx::Need to do a POWER ON to get penIDs\n");        // have to delay for Broadway or the POWER ON will be ignored        if (pSS->BusyWait((DWORD)2000) == JOB_CANCELED)        {            return JOB_CANCELED;        }        DWORD length = sizeof(Venice_Power_On);        err = pSS->ToDevice(Venice_Power_On,&length);        ERRCHECK;        err = pSS->FlushIO();        ERRCHECK;        // give the printer some time to power up        if (pSS->BusyWait ((DWORD) 2500) == JOB_CANCELED)        {            return JOB_CANCELED;        }        err = ParsePenInfo(ePen);

⌨️ 快捷键说明

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