~ubuntu-branches/ubuntu/hardy/ghostscript/hardy

« back to all changes in this revision

Viewing changes to src/gdevcdj.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2007-11-22 12:17:43 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071122121743-cd70s3ypq0r243mp
Tags: 8.61.dfsg.1-0ubtuntu1
* New upstream release
  o Final 8.61 release
* debian/patches/09_ijs_krgb_support.dpatch: Adapted to upstream changes.
* debian/rules: Updated CUPS-related variables for "make install" calls.
* debian/rules: Remove /usr/include/ghostscript from the ghostscript
  package, they go into lings-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
   or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
12
*/
13
 
/* $Id: gdevcdj.c 8113 2007-07-10 17:14:09Z till $*/
 
13
/* $Id: gdevcdj.c 8250 2007-09-25 13:31:24Z giles $*/
14
14
/* HP and Canon colour printer drivers */
15
15
 
16
16
/*
167
167
        pa.data = 0;            /* mark as not filled */\
168
168
  }
169
169
 
170
 
private int cdj_param_check_bytes(gs_param_list *, gs_param_name, const byte *, uint, bool);
171
 
private int cdj_param_check_float(gs_param_list *, gs_param_name, floatp, bool);
 
170
static int cdj_param_check_bytes(gs_param_list *, gs_param_name, const byte *, uint, bool);
 
171
static int cdj_param_check_float(gs_param_list *, gs_param_name, floatp, bool);
172
172
#define cdj_param_check_string(plist, pname, str, is_defined)\
173
173
  cdj_param_check_bytes(plist, pname, (const byte *)(str), strlen(str),\
174
174
                        is_defined)
247
247
#define HEAD_ROWS_COLOUR 16
248
248
 
249
249
/* Colour mapping procedures */
250
 
private dev_proc_map_cmyk_color (gdev_cmyk_map_cmyk_color);
251
 
private dev_proc_map_rgb_color (gdev_cmyk_map_rgb_color);
 
250
static dev_proc_map_cmyk_color (gdev_cmyk_map_cmyk_color);
 
251
static dev_proc_map_rgb_color (gdev_cmyk_map_rgb_color);
252
252
 
253
 
private dev_proc_map_rgb_color (gdev_pcl_map_rgb_color);
254
 
private dev_proc_map_color_rgb (gdev_pcl_map_color_rgb);
255
 
private dev_proc_decode_color  (gdev_cmyk_map_color_cmyk);
 
253
static dev_proc_map_rgb_color (gdev_pcl_map_rgb_color);
 
254
static dev_proc_map_color_rgb (gdev_pcl_map_color_rgb);
 
255
static dev_proc_decode_color  (gdev_cmyk_map_color_cmyk);
256
256
 
257
257
/* Print-page, parameters and miscellaneous procedures */
258
 
private dev_proc_open_device(dj500c_open);
259
 
private dev_proc_open_device(dj550c_open);
260
 
private dev_proc_open_device(dj505j_open);
261
 
private dev_proc_open_device(dnj650c_open);
262
 
private dev_proc_open_device(lj4dith_open);
263
 
private dev_proc_open_device(pj_open);
264
 
private dev_proc_open_device(pjxl_open);
265
 
private dev_proc_open_device(pjxl300_open);
266
 
private dev_proc_open_device(escp_open);
267
 
private dev_proc_open_device(bjc_open);
268
 
 
269
 
private dev_proc_print_page(declj250_print_page);
270
 
private dev_proc_print_page(dj500c_print_page);
271
 
private dev_proc_print_page(dj550c_print_page);
272
 
private dev_proc_print_page(dj505j_print_page);
273
 
private dev_proc_print_page(picty180_print_page);
274
 
private dev_proc_print_page(dnj650c_print_page);
275
 
private dev_proc_print_page(lj4dith_print_page);
276
 
private dev_proc_print_page(lj4dithp_print_page);
277
 
private dev_proc_print_page(pj_print_page);
278
 
private dev_proc_print_page(pjxl_print_page);
279
 
private dev_proc_print_page(pjxl300_print_page);
280
 
private dev_proc_print_page(escp_print_page);
281
 
private dev_proc_print_page(bjc_print_page);
282
 
 
283
 
private dev_proc_get_params(cdj_get_params);
284
 
private dev_proc_get_params(pjxl_get_params);
285
 
private dev_proc_get_params(bjc_get_params);
 
258
static dev_proc_open_device(dj500c_open);
 
259
static dev_proc_open_device(dj550c_open);
 
260
static dev_proc_open_device(dj505j_open);
 
261
static dev_proc_open_device(dnj650c_open);
 
262
static dev_proc_open_device(lj4dith_open);
 
263
static dev_proc_open_device(pj_open);
 
264
static dev_proc_open_device(pjxl_open);
 
265
static dev_proc_open_device(pjxl300_open);
 
266
static dev_proc_open_device(escp_open);
 
267
static dev_proc_open_device(bjc_open);
 
268
 
 
269
static dev_proc_print_page(declj250_print_page);
 
270
static dev_proc_print_page(dj500c_print_page);
 
271
static dev_proc_print_page(dj550c_print_page);
 
272
static dev_proc_print_page(dj505j_print_page);
 
273
static dev_proc_print_page(picty180_print_page);
 
274
static dev_proc_print_page(dnj650c_print_page);
 
275
static dev_proc_print_page(lj4dith_print_page);
 
276
static dev_proc_print_page(lj4dithp_print_page);
 
277
static dev_proc_print_page(pj_print_page);
 
278
static dev_proc_print_page(pjxl_print_page);
 
279
static dev_proc_print_page(pjxl300_print_page);
 
280
static dev_proc_print_page(escp_print_page);
 
281
static dev_proc_print_page(bjc_print_page);
 
282
 
 
283
static dev_proc_get_params(cdj_get_params);
 
284
static dev_proc_get_params(pjxl_get_params);
 
285
static dev_proc_get_params(bjc_get_params);
286
286
#define ep_get_params cdj_get_params
287
287
 
288
 
private dev_proc_put_params(cdj_put_params);
289
 
private dev_proc_put_params(pj_put_params);
290
 
private dev_proc_put_params(pjxl_put_params);
291
 
private dev_proc_put_params(bjc_put_params);
 
288
static dev_proc_put_params(cdj_put_params);
 
289
static dev_proc_put_params(pj_put_params);
 
290
static dev_proc_put_params(pjxl_put_params);
 
291
static dev_proc_put_params(bjc_put_params);
292
292
#define ep_put_params cdj_put_params
293
293
 
294
294
/* The device descriptors */
527
527
        gdev_cmyk_map_color_cmyk        /* decode_color */\
528
528
}
529
529
 
530
 
private gx_device_procs cdj500_procs =
 
530
static gx_device_procs cdj500_procs =
531
531
hp_colour_procs(dj500c_open, cdj_get_params, cdj_put_params);
532
532
 
533
 
private gx_device_procs cdj550_procs =
 
533
static gx_device_procs cdj550_procs =
534
534
hp_colour_procs(dj550c_open, cdj_get_params, cdj_put_params);
535
535
 
536
536
#ifdef USE_CDJ550_CMYK
537
 
private gx_device_procs cdj550cmyk_procs =
 
537
static gx_device_procs cdj550cmyk_procs =
538
538
cmyk_colour_procs(dj550c_open, cdj_get_params, cdj_put_params);
539
539
#endif
540
540
 
541
 
private gx_device_procs dj505j_procs =
 
541
static gx_device_procs dj505j_procs =
542
542
hp_colour_procs(dj505j_open, cdj_get_params, cdj_put_params);
543
543
 
544
 
private gx_device_procs dnj650c_procs =
 
544
static gx_device_procs dnj650c_procs =
545
545
hp_colour_procs(dnj650c_open, cdj_get_params, cdj_put_params);
546
546
 
547
 
private gx_device_procs lj4dith_procs =
 
547
static gx_device_procs lj4dith_procs =
548
548
hp_colour_procs(lj4dith_open, cdj_get_params, cdj_put_params);
549
549
 
550
 
private gx_device_procs pj_procs =
 
550
static gx_device_procs pj_procs =
551
551
hp_colour_procs(pj_open, gdev_prn_get_params, pj_put_params);
552
552
 
553
 
private gx_device_procs pjxl_procs =
 
553
static gx_device_procs pjxl_procs =
554
554
hp_colour_procs(pjxl_open, pjxl_get_params, pjxl_put_params);
555
555
 
556
 
private gx_device_procs pjxl300_procs =
 
556
static gx_device_procs pjxl300_procs =
557
557
hp_colour_procs(pjxl300_open, pjxl_get_params, pjxl_put_params);
558
558
 
559
 
private gx_device_procs bjc_procs =
 
559
static gx_device_procs bjc_procs =
560
560
cmyk_colour_procs(bjc_open, bjc_get_params, bjc_put_params);
561
561
 
562
 
private gx_device_procs escp_procs =
 
562
static gx_device_procs escp_procs =
563
563
hp_colour_procs(escp_open, ep_get_params, ep_put_params);
564
564
 
565
565
gx_device_cdj far_data gs_cdjmono_device =
674
674
        BJC800_DEFAULT_PRINTCOLORS);
675
675
 
676
676
/* Forward references */
677
 
private int gdev_pcl_mode1compress(const byte *, const byte *, byte *);
678
 
private int hp_colour_open(gx_device *, int);
679
 
private int hp_colour_print_page(gx_device_printer *, FILE *, int);
680
 
private int cdj_put_param_int(gs_param_list *, gs_param_name, int *, int, int, int);
681
 
private uint gdev_prn_rasterwidth(const gx_device_printer *, int);
682
 
private int cdj_put_param_bpp(gx_device *, gs_param_list *, int, int, int);
683
 
private int cdj_set_bpp(gx_device *, int, int);
684
 
private void cdj_expand_line(word *, int, short, int, int);
685
 
private int bjc_fscmyk(byte**, byte*[4][4], int**, int, int);
 
677
static int gdev_pcl_mode1compress(const byte *, const byte *, byte *);
 
678
static int hp_colour_open(gx_device *, int);
 
679
static int hp_colour_print_page(gx_device_printer *, FILE *, int);
 
680
static int cdj_put_param_int(gs_param_list *, gs_param_name, int *, int, int, int);
 
681
static uint gdev_prn_rasterwidth(const gx_device_printer *, int);
 
682
static int cdj_put_param_bpp(gx_device *, gs_param_list *, int, int, int);
 
683
static int cdj_set_bpp(gx_device *, int, int);
 
684
static void cdj_expand_line(word *, int, short, int, int);
 
685
static int bjc_fscmyk(byte**, byte*[4][4], int**, int, int);
686
686
 
687
687
/* String parameters manipulation */
688
688
 
691
691
    int p_value;
692
692
} stringParamDescription;
693
693
 
694
 
private const byte* paramValueToString(const stringParamDescription*, int);
695
 
private int paramStringValue(const stringParamDescription*,
 
694
static const byte* paramValueToString(const stringParamDescription*, int);
 
695
static int paramStringValue(const stringParamDescription*,
696
696
    const byte*, int, int*);
697
697
 
698
 
private int put_param_string(gs_param_list*, const byte*,
 
698
static int put_param_string(gs_param_list*, const byte*,
699
699
    gs_param_string*, const stringParamDescription*, int *, int);
700
 
private int get_param_string(gs_param_list*, const byte*,
 
700
static int get_param_string(gs_param_list*, const byte*,
701
701
    gs_param_string*, const stringParamDescription*, int, bool, int);
702
702
 
703
703
/* Open the printer and set up the margins. */
704
 
private int
 
704
static int
705
705
dj500c_open(gx_device *pdev)
706
706
{ return hp_colour_open(pdev, DJ500C);
707
707
}
708
708
 
709
 
private int
 
709
static int
710
710
dj550c_open(gx_device *pdev)
711
711
{  return hp_colour_open(pdev, DJ550C);
712
712
}
713
713
 
714
 
private int
 
714
static int
715
715
dj505j_open(gx_device *pdev)
716
716
{ return hp_colour_open(pdev, DJ505J);
717
717
}
718
718
 
719
 
private int
 
719
static int
720
720
dnj650c_open(gx_device *pdev)
721
721
{ return hp_colour_open(pdev, DNJ650C);
722
722
}
723
723
 
724
 
private int
 
724
static int
725
725
lj4dith_open(gx_device *pdev)
726
726
{ return hp_colour_open(pdev, LJ4DITH);
727
727
}
728
728
 
729
 
private int
 
729
static int
730
730
pjxl300_open(gx_device *pdev)
731
731
{ return hp_colour_open(pdev, PJXL300);
732
732
}
733
733
 
734
 
private int
 
734
static int
735
735
pj_open(gx_device *pdev)
736
736
{ return hp_colour_open(pdev, PJ180);
737
737
}
738
738
 
739
 
private int
 
739
static int
740
740
pjxl_open(gx_device *pdev)
741
741
{ return hp_colour_open(pdev, PJXL180);
742
742
}
743
743
 
744
 
private int
 
744
static int
745
745
escp_open(gx_device *pdev)
746
746
{ return hp_colour_open(pdev, ESC_P);
747
747
}
748
748
 
749
 
private int
 
749
static int
750
750
bjc_open(gx_device *pdev)
751
751
{  return hp_colour_open(pdev, bjc->ptype);
752
752
}
753
753
 
754
 
private int
 
754
static int
755
755
hp_colour_open(gx_device *pdev, int ptype)
756
756
{       /* Change the margins if necessary. */
757
757
  static const float dj_a4[4] = { DESKJET_MARGINS_A4 };
870
870
/* Get parameters.  In addition to the standard and printer 
871
871
 * parameters, we supply shingling and depletion parameters,
872
872
 * and control over the bits-per-pixel used in output rendering */
873
 
private int
 
873
static int
874
874
cdj_get_params(gx_device *pdev, gs_param_list *plist)
875
875
{       int code = gdev_prn_get_params(pdev, plist);
876
876
        if ( code < 0 ||
884
884
}
885
885
 
886
886
/* Put parameters. */
887
 
private int
 
887
static int
888
888
cdj_put_params(gx_device *pdev, gs_param_list *plist)
889
889
{       int correction = cdj->correction;
890
890
        int shingling = cdj->shingling;
914
914
/* Get parameters.  In addition to the standard and printer
915
915
 * parameters, we supply print_quality and render_type 
916
916
 * parameters, together with bpp control. */
917
 
private int
 
917
static int
918
918
pjxl_get_params(gx_device *pdev, gs_param_list *plist)
919
919
{       int code = gdev_prn_get_params(pdev, plist);
920
920
        if ( code < 0 ||
927
927
}
928
928
 
929
929
/* Put parameters. */
930
 
private int
 
930
static int
931
931
pjxl_put_params(gx_device *pdev, gs_param_list *plist)
932
932
{       int printqual = pjxl->printqual;
933
933
        int rendertype = pjxl->rendertype;
960
960
 
961
961
/* Put parameters.  In addition to the standard and printer */
962
962
/* parameters, we allow control of the bits-per-pixel */
963
 
private int
 
963
static int
964
964
pj_put_params(gx_device *pdev, gs_param_list *plist)
965
965
{       int bpp = 0;
966
966
        int code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, 0);
970
970
        return cdj_put_param_bpp(pdev, plist, bpp, bpp, 0);
971
971
}
972
972
 
973
 
private stringParamDescription bjc_processColorsStrings[] = {
 
973
static stringParamDescription bjc_processColorsStrings[] = {
974
974
    { "DeviceGray",             1 },
975
975
    { "DeviceRGB",              3 },
976
976
    { "DeviceCMYK",             4 },
977
977
    { 0 }
978
978
};
979
979
 
980
 
private stringParamDescription bjc_mediaTypeStrings[] = {
 
980
static stringParamDescription bjc_mediaTypeStrings[] = {
981
981
    { "PlainPaper",             BJC_MEDIA_PLAINPAPER },
982
982
    { "CoatedPaper",            BJC_MEDIA_COATEDPAPER },
983
983
    { "TransparencyFilm",       BJC_MEDIA_TRANSPARENCYFILM },
987
987
    { 0 }
988
988
};
989
989
 
990
 
private stringParamDescription bjc600_printQualityStrings[] = {
 
990
static stringParamDescription bjc600_printQualityStrings[] = {
991
991
    { "Normal", 0 },
992
992
    { "High",   1 },
993
993
    { "Draft",  2 },
994
994
    { 0 }
995
995
};
996
996
 
997
 
private stringParamDescription bjc800_printQualityStrings[] = {
 
997
static stringParamDescription bjc800_printQualityStrings[] = {
998
998
    { "Normal",         0 },
999
999
    { "High",           1 },
1000
1000
    { "Low",            3 },
1002
1002
    { 0 },
1003
1003
};
1004
1004
 
1005
 
private stringParamDescription bjc_ditheringTypeStrings[] = {
 
1005
static stringParamDescription bjc_ditheringTypeStrings[] = {
1006
1006
    { "None",                   BJC_DITHER_NONE },
1007
1007
    { "Floyd-Steinberg",        BJC_DITHER_FS },
1008
1008
    { 0 }
1009
1009
};
1010
1010
 
1011
 
private int
 
1011
static int
1012
1012
bjc_get_params(gx_device *pdev, gs_param_list *plist)
1013
1013
{
1014
1014
    int code = gdev_prn_get_params(pdev, plist);
1087
1087
 
1088
1088
/* Put properties for the bjc drivers. */
1089
1089
 
1090
 
private int
 
1090
static int
1091
1091
bjc_put_params(gx_device *pdev, gs_param_list *plist)
1092
1092
{
1093
1093
    int bpp = 0, ccomps = 0;
1259
1259
/* ------ Internal routines ------ */
1260
1260
 
1261
1261
/* The DeskJet500C can compress (mode 9) */
1262
 
private int
 
1262
static int
1263
1263
dj500c_print_page(gx_device_printer * pdev, FILE * prn_stream)
1264
1264
{
1265
1265
  return hp_colour_print_page(pdev, prn_stream, DJ500C);
1266
1266
}
1267
1267
 
1268
1268
/* The DeskJet550C can compress (mode 9) */
1269
 
private int
 
1269
static int
1270
1270
dj550c_print_page(gx_device_printer * pdev, FILE * prn_stream)
1271
1271
{
1272
1272
  return hp_colour_print_page(pdev, prn_stream, DJ550C);
1274
1274
 
1275
1275
/* The Picty180C can compress (mode 9) */
1276
1276
/* This printer need switching mode using PJL */
1277
 
private int
 
1277
static int
1278
1278
picty180_print_page(gx_device_printer * pdev, FILE * prn_stream)
1279
1279
{  int ret_code;
1280
1280
  /* Ensure we're operating in PCL mode */
1286
1286
}
1287
1287
 
1288
1288
/* The DeskJet505J can compress  */
1289
 
private int
 
1289
static int
1290
1290
dj505j_print_page(gx_device_printer * pdev, FILE * prn_stream)
1291
1291
{
1292
1292
  return hp_colour_print_page(pdev, prn_stream, DJ505J);
1293
1293
}
1294
1294
 
1295
1295
/* The DesignJet650C can compress (mode 1) */
1296
 
private int
 
1296
static int
1297
1297
dnj650c_print_page(gx_device_printer * pdev, FILE * prn_stream)
1298
1298
{
1299
1299
  return hp_colour_print_page(pdev, prn_stream, DNJ650C);
1300
1300
}
1301
1301
 
1302
 
private int
 
1302
static int
1303
1303
lj4dith_print_page(gx_device_printer * pdev, FILE * prn_stream)
1304
1304
{
1305
1305
  return hp_colour_print_page(pdev, prn_stream, LJ4DITH);
1306
1306
}
1307
1307
 
1308
 
private int
 
1308
static int
1309
1309
lj4dithp_print_page(gx_device_printer * pdev, FILE * prn_stream)
1310
1310
{ int ret_code;
1311
1311
  /* Ensure we're operating in PCL mode */
1317
1317
}
1318
1318
 
1319
1319
/* The PJXL300 can compress (modes 2 & 3) */
1320
 
private int
 
1320
static int
1321
1321
pjxl300_print_page(gx_device_printer * pdev, FILE * prn_stream)
1322
1322
{ int ret_code;
1323
1323
  /* Ensure we're operating in PCL mode */
1329
1329
}
1330
1330
 
1331
1331
/* The PaintJet XL can compress (modes 2 & 3) */
1332
 
private int
 
1332
static int
1333
1333
pjxl_print_page(gx_device_printer * pdev, FILE * prn_stream)
1334
1334
{
1335
1335
  return hp_colour_print_page(pdev, prn_stream, PJXL180);
1336
1336
}
1337
1337
 
1338
1338
/* The PaintJet can compress (mode 1) */
1339
 
private int
 
1339
static int
1340
1340
pj_print_page(gx_device_printer * pdev, FILE * prn_stream)
1341
1341
{
1342
1342
  return hp_colour_print_page(pdev, prn_stream, PJ180);
1343
1343
}
1344
1344
 
1345
1345
/* The LJ250 can compress (mode 1) */
1346
 
private int
 
1346
static int
1347
1347
declj250_print_page(gx_device_printer * pdev, FILE * prn_stream)
1348
1348
{ int ret_code;
1349
1349
  fputs("\033%8", prn_stream);  /* Enter PCL emulation mode */
1353
1353
}
1354
1354
 
1355
1355
/* The BJC-600 cannot compress w/o raster image commands. */
1356
 
private int
 
1356
static int
1357
1357
escp_print_page(gx_device_printer * pdev, FILE * prn_stream)
1358
1358
{
1359
1359
  return hp_colour_print_page(pdev, prn_stream, ESC_P);
1360
1360
}
1361
1361
 
1362
1362
/* The BJC-600 can compress w/ raster image commands. */
1363
 
private int
 
1363
static int
1364
1364
bjc_print_page(gx_device_printer * pdev, FILE * prn_stream)
1365
1365
{
1366
1366
  return hp_colour_print_page(pdev, prn_stream, bjc->ptype);
1600
1600
 */
1601
1601
#define fputshort(n, f) fputc((n)%256,f);fputc((n)/256,f)
1602
1602
 
1603
 
private int
 
1603
static int
1604
1604
bjc_cmd(byte cmd, int argsize, byte* arg, gx_device_printer* pdev,
1605
1605
    FILE* f)
1606
1606
{
1613
1613
}
1614
1614
 
1615
1615
 
1616
 
private int
 
1616
static int
1617
1617
bjc_raster_cmd_sub(char c, int rastsize, byte* data, FILE* f)
1618
1618
{
1619
1619
  fputs("\033(A", f);
1625
1625
  return 0;
1626
1626
}
1627
1627
 
1628
 
private int
 
1628
static int
1629
1629
bjc_raster_cmd(int c_id, int rastsize, byte* data, gx_device_printer* pdev,
1630
1630
    FILE* f)
1631
1631
{
1643
1643
                bjc_raster_cmd_sub('C', rastsize, data, f);
1644
1644
        }
1645
1645
    }else {                     /* Color decomposition */
1646
 
        private byte ymckCodes[] = {
 
1646
        static byte ymckCodes[] = {
1647
1647
            BJC_COLOR_YELLOW,
1648
1648
            BJC_COLOR_MAGENTA,
1649
1649
            BJC_COLOR_CYAN,
1658
1658
    return 0;
1659
1659
}
1660
1660
 
1661
 
private int
 
1661
static int
1662
1662
bjc_init_page(gx_device_printer* pdev, FILE* f)
1663
1663
{
1664
1664
    byte pagemargins[3], resolution[4], paperloading[2];
1761
1761
    return 0;
1762
1762
}
1763
1763
 
1764
 
private int
 
1764
static int
1765
1765
bjc_v_skip(int n, gx_device_printer* pdev, FILE* f)
1766
1766
{
1767
1767
    if (n) {
1775
1775
    return 0;
1776
1776
}
1777
1777
 
1778
 
private int
 
1778
static int
1779
1779
bjc_finish_page(gx_device_printer* pdev, FILE* f)
1780
1780
{
1781
1781
    bjc_cmd('a', 1, (byte*) "\000", pdev, f);
1789
1789
/* 1D runlength compression for BJC-600
1790
1790
 * this code is borrowed from gdevpcl.c:gdev_pcl_mode2compress.
1791
1791
 */
1792
 
private int
 
1792
static int
1793
1793
bjc_compress(const byte *row, const byte *end_row, byte *compressed)
1794
1794
{
1795
1795
  register const byte *exam = row;
1874
1874
 * For the ESC/P mode, resolution is fixed as 360dpi and we must transform
1875
1875
 * image data to serialized data.
1876
1876
 */
1877
 
private word *ep_storage;
1878
 
private uint ep_storage_size_words;
1879
 
private byte *ep_raster_buf[4][BJC_HEAD_ROWS], *ep_print_buf;
1880
 
private int ep_num_comps, ep_plane_size, img_rows=BJC_HEAD_ROWS;
 
1877
static word *ep_storage;
 
1878
static uint ep_storage_size_words;
 
1879
static byte *ep_raster_buf[4][BJC_HEAD_ROWS], *ep_print_buf;
 
1880
static int ep_num_comps, ep_plane_size, img_rows=BJC_HEAD_ROWS;
1881
1881
 
1882
1882
 
1883
1883
#define row_bytes (img_rows / 8)
1885
1885
#define min_rows (32)           /* for optimization of text image printing */
1886
1886
 
1887
1887
 
1888
 
private int
 
1888
static int
1889
1889
ep_print_image(FILE *prn_stream, char cmd, byte *data, int size)
1890
1890
{
1891
1891
  static int ln_idx=0, vskip1=0, vskip2=0, real_rows;
2034
2034
 
2035
2035
 
2036
2036
/* Send the page to the printer.  Compress each scan line. */
2037
 
private int
 
2037
static int
2038
2038
hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
2039
2039
{
2040
2040
  uint raster_width = gdev_prn_rasterwidth(pdev, 1);
2788
2788
 * We complement the bytes at the same time, because
2789
2789
 * we accumulated the image in complemented form.
2790
2790
 */
2791
 
private int
 
2791
static int
2792
2792
gdev_pcl_mode1compress(const byte *row, const byte *end_row, byte *compressed)
2793
2793
{       register const byte *in = row;
2794
2794
        register byte *out = compressed;
2834
2834
    (m) = gx_bits_to_color_value(((v) >> (b)) & ((1 << (b)) - 1), (b)), \
2835
2835
    (y) = gx_bits_to_color_value((v) & ((1 << (b)) - 1), (b))
2836
2836
 
2837
 
private gx_color_index
 
2837
static gx_color_index
2838
2838
gdev_cmyk_map_cmyk_color(gx_device* pdev, const gx_color_value cv[])
2839
2839
{
2840
2840
    gx_color_value cyan, magenta, yellow, black;
2859
2859
 
2860
2860
/* Mapping of RGB colors to gray values. */
2861
2861
 
2862
 
private gx_color_index
 
2862
static gx_color_index
2863
2863
gdev_cmyk_map_rgb_color(gx_device *pdev, const gx_color_value cv[])
2864
2864
{
2865
2865
    gx_color_value r, g, b;
2893
2893
 
2894
2894
/* Mapping of CMYK colors. */
2895
2895
 
2896
 
private int
 
2896
static int
2897
2897
gdev_cmyk_map_color_cmyk(gx_device *pdev, gx_color_index color, gx_color_value prgb[3])
2898
2898
{
2899
2899
    switch (pdev->color_info.depth) {
2947
2947
        y = yv - kv; m = mv - kv; c = cv -kv; k = kv; \
2948
2948
   } while (0)
2949
2949
 
2950
 
private gx_color_index
 
2950
static gx_color_index
2951
2951
gdev_pcl_map_rgb_color(gx_device *pdev, const gx_color_value cv[])
2952
2952
{
2953
2953
  gx_color_value r, g, b;
3018
3018
}
3019
3019
    
3020
3020
/* Map a color index to a r-g-b color. */
3021
 
private int
 
3021
static int
3022
3022
gdev_pcl_map_color_rgb(gx_device *pdev, gx_color_index color,
3023
3023
                            gx_color_value prgb[3])
3024
3024
{
3088
3088
 *
3089
3089
 */
3090
3090
 
3091
 
private void
 
3091
static void
3092
3092
cdj_expand_line(word *line, int linesize, short cmyk, int bpp, int ebpp)
3093
3093
{
3094
3094
  int endline = linesize;
3193
3193
  }
3194
3194
}
3195
3195
 
3196
 
private int
 
3196
static int
3197
3197
cdj_put_param_int(gs_param_list *plist, gs_param_name pname, int *pvalue,
3198
3198
  int minval, int maxval, int ecode)
3199
3199
{       int code, value;
3211
3211
        }
3212
3212
}       
3213
3213
 
3214
 
private int
 
3214
static int
3215
3215
cdj_set_bpp(gx_device *pdev, int bpp, int ccomps)
3216
3216
{ gx_device_color_info *ci = &pdev->color_info;
3217
3217
 
3404
3404
   If new_bpp != 0, it must be the value of the BitsPerPixel element of
3405
3405
     the plist; real_bpp may differ from new_bpp.
3406
3406
*/
3407
 
private int
 
3407
static int
3408
3408
cdj_put_param_bpp(gx_device *pdev, gs_param_list *plist, int new_bpp,
3409
3409
  int real_bpp, int ccomps)
3410
3410
{
3445
3445
 
3446
3446
/* This returns either the number of pixels in a scan line, or the number
3447
3447
 * of bytes required to store the line, both clipped to the page margins */
3448
 
private uint
 
3448
static uint
3449
3449
gdev_prn_rasterwidth(const gx_device_printer *pdev, int pixelcount)
3450
3450
{
3451
3451
  ulong raster_width = (ulong)(pdev->width - 
3457
3457
 
3458
3458
/* Functions for manipulation params strings */
3459
3459
 
3460
 
private const byte*
 
3460
static const byte*
3461
3461
paramValueToString(const stringParamDescription* params, int value)
3462
3462
{
3463
3463
 
3470
3470
    return (const byte*) 0;
3471
3471
}
3472
3472
 
3473
 
private int
 
3473
static int
3474
3474
paramStringValue(const stringParamDescription* params,
3475
3475
    const byte* name, int namelen, int* value)
3476
3476
{
3486
3486
    return 0;
3487
3487
}
3488
3488
 
3489
 
private int
 
3489
static int
3490
3490
put_param_string(gs_param_list* plist,
3491
3491
    const byte* pname, gs_param_string* pstring,
3492
3492
    const stringParamDescription* params, int *pvalue, int code)
3512
3512
    return code;
3513
3513
}
3514
3514
 
3515
 
private int
 
3515
static int
3516
3516
get_param_string(gs_param_list* plist,
3517
3517
    const byte* pname, gs_param_string* pstring,
3518
3518
    const stringParamDescription* params, int pvalue, bool persist, int code)
3541
3541
 *
3542
3542
 */
3543
3543
 
3544
 
private int
 
3544
static int
3545
3545
cdj_param_check_bytes(gs_param_list *plist, gs_param_name pname,
3546
3546
                      const byte *str, uint size, bool is_defined)
3547
3547
{       int code;
3568
3568
 
3569
3569
/* This is original code. */
3570
3570
 
3571
 
private int
 
3571
static int
3572
3572
cdj_param_check_float(gs_param_list *plist, gs_param_name pname, floatp fval,
3573
3573
                      bool is_defined)
3574
3574
{       int code;
3665
3665
#define ODX_Y        0
3666
3666
#define ODX_K        3
3667
3667
 
3668
 
private int
 
3668
static int
3669
3669
bjc_fscmyk(byte** inplanes, byte* outplanes[4][4], int** errplanes,
3670
3670
    int plane_size, int scan) {
3671
3671