diff options
author | Till Kamppeter <till.kamppeter@gmail.com> | 2009-04-20 17:44:20 +0000 |
---|---|---|
committer | Till Kamppeter <till.kamppeter@gmail.com> | 2009-04-20 17:44:20 +0000 |
commit | b80fea25937511912c06d84e381b99216a1461e9 (patch) | |
tree | fdefd685a6ef838d89bdc3af278148325e025b24 /gs | |
parent | 17472071508c81fb75c40ba5276b76ae130f45b4 (diff) |
Added "cdnj500" device to support HP DesignJet 500 (patch from Timur Maximov).
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@9664 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs')
-rw-r--r-- | gs/base/configure.ac | 2 | ||||
-rw-r--r-- | gs/contrib/contrib.mak | 9 | ||||
-rw-r--r-- | gs/contrib/gdevcd8.c | 265 |
3 files changed, 268 insertions, 8 deletions
diff --git a/gs/base/configure.ac b/gs/base/configure.ac index 85eddfa2b..45abc9e41 100644 --- a/gs/base/configure.ac +++ b/gs/base/configure.ac @@ -793,7 +793,7 @@ P_DEVS="" F_DEVS="" dnl Known printers -HP_DEVS="cdj500 djet500 djet500c dnj650c cljet5pr deskjet laserjet ljetplus ljet2p ljet3 ljet3d ljet4 ljet4d lj4dith lj5mono lj5gray cdeskjet cdjcolor cdjmono cdj550 pj pjxl pjxl300 lp2563 paintjet pjetxl cljet5 cljet5c pxlmono pxlcolor cdj670 cdj850 cdj880 cdj890 cdj970 cdj1600 chp2200 pcl3 hpdjplus hpdjportable hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510 hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c hpdj690c hpdj850c hpdj855c hpdj870c hpdj890c hpdj1120c lj3100sw" +HP_DEVS="cdj500 djet500 djet500c dnj650c cljet5pr deskjet laserjet ljetplus ljet2p ljet3 ljet3d ljet4 ljet4d lj4dith lj5mono lj5gray cdeskjet cdjcolor cdjmono cdj550 pj pjxl pjxl300 lp2563 paintjet pjetxl cljet5 cljet5c pxlmono pxlcolor cdj670 cdj850 cdj880 cdj890 cdj970 cdj1600 cdnj500 chp2200 pcl3 hpdjplus hpdjportable hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510 hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c hpdj690c hpdj850c hpdj855c hpdj870c hpdj890c hpdj1120c lj3100sw" PCLXL_DEVS="pxlmono pxlcolor" EPSON_DEVS="eps9high eps9mid epson epsonc escp lp8000 lq850 photoex st800 stcolor alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 lp3000c lp8000c lp8200c lp8300c lp8500c lp8800c lp9000c lp9200c lp9500c lp9800c lps6500 epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900 epl6100 epl6200 lp1800 lp1900 lp2200 lp2400 lp2500 lp7500 lp7700 lp7900 lp8100 lp8300f lp8400f lp8600 lp8600f lp8700 lp8900 lp9000b lp9100 lp9200b lp9300 lp9400 lp9600 lp9600s lps4500" CANON_DEVS="bj10e bj200 bjc600 bjc800 lbp8 lips3 bjcmono bjcgray bjccmyk bjccolor" diff --git a/gs/contrib/contrib.mak b/gs/contrib/contrib.mak index e8fd617e6..e8c394934 100644 --- a/gs/contrib/contrib.mak +++ b/gs/contrib/contrib.mak @@ -50,6 +50,7 @@ CONTRIBSRC=$(CONTRIBDIR)$(D) # cdj880 HP DeskJet 880 # cdj890 HP DeskJet 890 # cdj970 HP DeskJet 970 +# cdnj500 HP DesignJet 500 # chp2200 HP Business Inkjet 2200 # dl2100 DEC DL2100 # dmprt dot matrix printer driver for Ghostscript (it can use @@ -232,6 +233,14 @@ $(GLOBJ)gdevdj9.$(OBJ) : $(CONTRIBSRC)gdevdj9.c $(PDEVH) $(math__h) $(string__h) $(GLCC) $(GLO_)gdevdj9.$(OBJ) $(C_) $(CONTRIBSRC)gdevdj9.c +### -------------- cdnj500 - HP DesignJet 500 ------------- ### + +### NOTE: Same as chp2200 (some PJL and CRD changes). + +$(DD)cdnj500.dev : $(cdeskjet8_) $(DD)page.dev + $(SETPDEV2) $(DD)cdnj500 $(cdeskjet8_) + + ### -------------- chp2200 - HP Business Inkjet 2200 ------------- ### ### NOTE: Depends on the presence of the cdj850 section. diff --git a/gs/contrib/gdevcd8.c b/gs/contrib/gdevcd8.c index 2c22b6514..cd4c4152f 100644 --- a/gs/contrib/gdevcd8.c +++ b/gs/contrib/gdevcd8.c @@ -34,6 +34,7 @@ A printer driver for the HP670, HP690, HP850, HP855 HP870, HP890, HP1100, HP1600 and HP2200 color printers. + Also work with HP DesignJet 500 large-format color printer. To be used with the Ghostscript printing system. CREDITS: Much of the driver is based on ideas derived @@ -44,6 +45,8 @@ The support for the hp2200 was added by Siow-Kiat Tan. + The support for the dnj500 was added by Timur Maximov. + -------------------------------------------------------------------*/ /* Note: Depending on how you transfered the files, @@ -459,7 +462,7 @@ typedef enum { /* Printer types */ typedef enum { - DJ670C, DJ850C, DJ880C, DJ890C, DJ1600C, HP2200C + DJ670C, DJ850C, DJ880C, DJ890C, DJ1600C, HP2200C, DNJ500C } cdj_printer_type_t; @@ -492,6 +495,7 @@ static dev_proc_put_params(cdj850_put_params); static dev_proc_print_page(cdj850_print_page); static dev_proc_print_page(chp2200_print_page); +static dev_proc_print_page(cdnj500_print_page); /* The device descriptors */ @@ -636,7 +640,7 @@ typedef struct { (bpp > 8 ? 5 : 2), (bpp > 8 ? 5 : bpp > 1 ? 2 : 0),\ print_page, -1 /* cmyk */, correct) -/* The prn_rgb_color_device is used by the HP2200 */ +/* The prn_rgb_color_device is used by the HP2200 and DNJ500 */ #define prn_rgb_colour_device(dtype, procs, dev_name, x_dpi, y_dpi, bpp, print_page, correct)\ prn_colour_device_body(dtype, procs, dev_name,\ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, x_dpi, y_dpi, 0, 0, 0, 0,\ @@ -683,7 +687,7 @@ typedef struct { terminate_page\ } -/* HP2200 is a RGB printer */ +/* HP2200 and DNJ500 is a RGB printer */ #define chp_2200_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page, correction, quality, papertype, intensities,ptype,compression,mastergamma,gammavalc,gammavalm,gammavaly,gammavalk,blackcorrect,start_raster_mode,print_non_blank_line,terminate_page)\ { prn_rgb_colour_device(gx_device_cdj850, procs, dev_name, x_dpi, y_dpi, bpp, print_page, correction),\ quality,\ @@ -783,6 +787,14 @@ static void static void chp2200_terminate_page(gx_device_printer * pdev, FILE * prn_stream); +/* Functions for the DNJ500C */ +static void + cdnj500_start_raster_mode(gx_device_printer * pdev, + int papersize, FILE * prn_stream); + +static void + cdnj500_terminate_page(gx_device_printer * pdev, FILE * prn_stream); + static const gx_device_procs cdj670_procs = cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params, @@ -804,7 +816,7 @@ static const gx_device_procs cdj1600_procs = cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params, gdev_pcl_map_rgb_color, gdev_pcl_map_color_rgb, NULL); -/* HP2200 is a RGB printer */ +/* HP2200 and DNJ500 is a RGB printer */ static const gx_device_procs chp2200_procs = cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params, gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb, NULL); @@ -853,6 +865,14 @@ chp_2200_device(chp2200_procs, "chp2200", 300, 300, 24, chp2200_print_page, 0, chp2200_start_raster_mode, NULL /*unused*/, chp2200_terminate_page); +/* DNJ500 does not need color matching and halftoning parameters */ +const gx_device_cdj850 gs_cdnj500_device = +chp_2200_device(chp2200_procs, "cdnj500", 300, 300, 24, cdnj500_print_page, 0, + NORMAL, PLAIN_PAPER, 0 /*unused*/, DNJ500C, 10, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, /*all unused*/ + cdnj500_start_raster_mode, NULL /*unused*/, + cdnj500_terminate_page); + /* Forward references */ static int cdj_put_param_int(gs_param_list *, gs_param_name, int *, int, int, int); @@ -892,6 +912,11 @@ hp_colour_open(gx_device * pdev) 0.25, 0.46, 0.25, 0.08 }; + /* margins for DNJ500C */ + static const float cdnj500[4] = { + 0.00, 0.00, 0.00, 0.00 + }; + const float *m = (float *)0; /* Set up colour params if put_params has not already done so */ @@ -1011,6 +1036,20 @@ hp_colour_open(gx_device * pdev) } m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? chp2200_a4 : chp2200_letter); break; + /* DNJ500 supports 300dpi and 600dpi with any combinations */ + case DNJ500C: + cdj850->xscal = 0; /* unused */ + cdj850->yscal = 0; /* unused */ + cdj850->intensities = 0; /* unused */ + if (cdj850->quality == DRAFT) { + gx_device_set_resolution(pdev, 300.0, 300.0); + } else if (cdj850->quality == NORMAL) { + gx_device_set_resolution(pdev, 600.0, 600.0); + } else { /* quality == PRESENTATION */ + gx_device_set_resolution(pdev, 600.0, 600.0); + } + m = cdnj500; + break; default: assert(0); } @@ -1205,6 +1244,14 @@ chp2200_terminate_page(gx_device_printer * pdev, FILE * prn_stream) fputs("\033%-12345X@PJL EOJ\012\033%-12345X", prn_stream); /* Send the PJL EOJ */ } +/* DNJ500 terminate page routine */ +static void +cdnj500_terminate_page(gx_device_printer * pdev, FILE * prn_stream) +{ + fputs("\033*rC", prn_stream); /* End graphics */ + fputs("\033%-12345X@PJL EOJ \n", prn_stream); /* Send the PJL EOJ */ +} + /* Here comes the hp850 output routine -------------------- */ static int cdj850_print_page(gx_device_printer * pdev, FILE * prn_stream) @@ -1781,6 +1828,149 @@ chp2200_print_page(gx_device_printer * pdev, FILE * prn_stream) return 0; } +#define HIBYTE(w) ((byte)(((unsigned int) (w) >> 8) & 0xFF)) +#define LOBYTE(w) ((byte)(w)) + +/* DNJ500 output routine -------------------- */ +static int +cdnj500_print_page(gx_device_printer * pdev, FILE * prn_stream) +{ + byte CRD_SeqC[] = {0x1b, 0x2a, 0x67, 0x31, 0x32, 0x57, 0x06, 0x1F, 0x00, 0x01, + /* Esc * |g |# of bytes |W |frmt |SP |# of cmpnts*/ + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x20, 0x01}; + /* |Horz Res |Vert Rez |compr|orien|bits |planes*/ + + /* x,y resolution for color planes, assume x=y */ + int xres = cdj850->x_pixels_per_inch; + int yres = cdj850->y_pixels_per_inch; + + gs_memory_t *mem = pdev->memory; + int width_in_pixels = pdev->width; + int width_in_bytes = width_in_pixels * 3; /* assume 24 bits (3 bytes per pixel) */ + byte *lbuf = gs_alloc_bytes(mem, width_in_bytes, + "(input)cdnj500_print_page"); + byte *lseedbuf = gs_alloc_bytes(mem, width_in_bytes, + "(seed)cdnj500_print_page"); + /* allocate twice the input size for worse case compressed output*/ + byte *loutputbuf = gs_alloc_bytes(mem, width_in_bytes*2, + "(output)cdnj500_print_page"); + + int lnum = 0; + int iEmptyRows = 0; + int iBlock = 0; + bool begin = true; + byte *data = lbuf; + + if ((lbuf == 0) || (lseedbuf == 0) || (loutputbuf == 0)) + return_error(gs_error_VMerror); + + /* Start Raster mode */ + (*cdj850->start_raster_mode) (pdev, + gdev_pcl_paper_size((gx_device *)pdev), + prn_stream); + + /* This will configure the raster-mode */ + CRD_SeqC[10] = HIBYTE(xres); + CRD_SeqC[11] = LOBYTE(xres); + CRD_SeqC[12] = HIBYTE(yres); + CRD_SeqC[13] = LOBYTE(yres); + + for (lnum = 0; lnum < pdev->height; ++lnum) + { + int result = -1; + + /*gdev_prn_get_bits(pdev, lnum, lbuf, &data);*/ + result = gdev_prn_copy_scan_lines(pdev, lnum, data, width_in_bytes); + + if ((result == 1) && IsScanlineDirty(data, width_in_bytes)) + { + unsigned int OutputLen = 0; + + /* + * Printers with low memory (64 MB or less) can run out of memory during decompressing + * the image data and will abort the job. To prevent this, restart raster command. + * Raghu (hpijs) + */ + if (iBlock == 448) /* from DesignJet 500 winNT driver */ + { + /* terminate the scanline */ + fputs("0Y", prn_stream); + + /* End graphics */ + fputs("\033*rC", prn_stream); + + /* Reset in block lines counter */ + iBlock = 0; + } + if (iBlock == 0) + { + /* Send CRD */ + fwrite(CRD_SeqC, sizeof(byte), sizeof(CRD_SeqC), prn_stream); + + /* Raster mode */ + fputs("\033*r1A", prn_stream); + + /* start the scanline */ + fputs("\033*b", prn_stream); + + /* reset seed buffer */ + INIT_WHITE(lseedbuf, width_in_bytes); + } + iBlock++; + + if (iEmptyRows) + { + /* send vertical Y move */ + fprintf(prn_stream, "%dy", iEmptyRows); + + /* reset empty row count */ + iEmptyRows = 0; + + /* reset seed buffer */ + INIT_WHITE(lseedbuf, width_in_bytes); + } + + OutputLen = Mode10(width_in_pixels, + data, + lseedbuf, + loutputbuf); + + if (OutputLen) + { + fprintf(prn_stream, "%dw", OutputLen); + fwrite(loutputbuf, sizeof(byte), OutputLen, prn_stream); + + /* save the current scanline as the seed for the next scanline*/ + memcpy((void*)lseedbuf, (const void*)data, width_in_bytes); + } + else + { + fputs("0w", prn_stream); + } + + /* Content printing already started */ + begin = false; + } + else + { + /* Skip empty area on top page */ + if (begin == false) iEmptyRows++; + } + } + + /* terminate the scanline */ + fputs("0Y", prn_stream); + + /* terminate page and eject paper */ + (*cdj850->terminate_page) (pdev, prn_stream); + + gs_free_object(mem, lbuf, "(input)cdnj500_print_page"); + gs_free_object(mem, lseedbuf, "(seed)cdnj500_print_page"); + gs_free_object(mem, loutputbuf, "(output)cdnj500_print_page"); + + return 0; +} + #define odd(i) ((i & 01) != 0) @@ -3084,9 +3274,6 @@ cdj880_start_raster_mode(gx_device_printer * pdev, int paper_size, return; } /* end configure raster-mode */ -#define HIBYTE(w) ((byte)(((unsigned int) (w) >> 8) & 0xFF)) -#define LOBYTE(w) ((byte)(w)) - /* Start Raster mode for HP2200 */ static void chp2200_start_raster_mode(gx_device_printer * pdev, int paper_size, @@ -3153,6 +3340,70 @@ chp2200_start_raster_mode(gx_device_printer * pdev, int paper_size, return; } /* end configure raster-mode */ +/* Start Raster mode for DNJ500 */ +static void +cdnj500_start_raster_mode(gx_device_printer * pdev, int paper_size, + FILE * prn_stream) +{ + /* x,y resolution for color planes, assume x=y */ + int xres = cdj850->x_pixels_per_inch; + int yres = cdj850->y_pixels_per_inch; + float x = pdev->width / pdev->x_pixels_per_inch * 10; + float y = pdev->height / pdev->y_pixels_per_inch * 10; + + /* Exit from any previous language */ + fprintf(prn_stream, "\033%%-12345X"); + + /* send @PJL JOB NAME before entering the language + * this will be matched by a @PJL EOJ after leaving the language + */ + fprintf(prn_stream, "@PJL JOB NAME=\"GS %.2fx%.2f\" \n", x * 2.54, y * 2.54); + + /* Color use */ + fprintf(prn_stream, "@PJL SET RENDERMODE = COLOR \n"); +// fprintf(prn_stream, "@PJL SET RENDERMODE = TRUEBLACK \n"); + + /* Color correction */ + fprintf(prn_stream, "@PJL SET COLORSPACE = SRGB \n"); +// fprintf(prn_stream, "@PJL SET COLORSPACE = DEVICERGB \n"); + + /* Predef qual set (TODO: need add options) */ + if (cdj850->quality == DRAFT) { + fprintf(prn_stream, "@PJL SET RENDERINTENT = PERCEPTUAL \n"); + fprintf(prn_stream, "@PJL SET RET = ON \n"); + fprintf(prn_stream, "@PJL SET MAXDETAIL = OFF \n"); + } else if (cdj850->quality == NORMAL) { + fprintf(prn_stream, "@PJL SET RENDERINTENT = PERCEPTUAL \n"); + fprintf(prn_stream, "@PJL SET RET = ON \n"); + fprintf(prn_stream, "@PJL SET MAXDETAIL = ON \n"); + } else { /* quality == PRESENTATION */ + fprintf(prn_stream, "@PJL SET RENDERINTENT = SATURATION \n"); + fprintf(prn_stream, "@PJL SET RET = OFF \n"); + fprintf(prn_stream, "@PJL SET MAXDETAIL = ON \n"); + } + + /* Set "remove margins between pages" (need not separated pages) */ +// fprintf(prn_stream, "@PJL SET NESTMODE = OFF \n"); + + /* Disable automatic cutter */ +// fprintf(prn_stream, "@PJL SET CUTTER = OFF \n"); + + /* Set page size (useful for standart format cutting) */ +// fprintf(prn_stream, "@PJL SET PAPERLENGTH = %d \n", (int)(y * 72.0)); +// fprintf(prn_stream, "@PJL SET PAPERWIDTH = %d \n" , (int)(x * 72.0)); + + /* Set the language to PCL3 enhanced */ + fprintf(prn_stream, "@PJL ENTER LANGUAGE=PCL3GUI \n"); + + /* Print Quality, -1 = draft, 0 = normal, 1 = presentation */ + fprintf(prn_stream, "\033*o%dM", cdj850->quality); + + /* Unit of Measure*/ + fprintf(prn_stream, "\033&u%dD", (int)xres); + + return; +} /* end configure raster-mode */ + static int near cdj_put_param_int(gs_param_list * plist, gs_param_name pname, int *pvalue, int minval, int maxval, int ecode) |