diff -rc print/README /tmp/print/README *** print/README Thu Dec 16 14:44:01 1999 --- /tmp/print/README Thu Jan 13 18:41:34 2000 *************** *** 1,4 **** ! Print plugin for the Gimp. Version 3.0 by Robert Krawitz <rlk@xxxxxxxxxxxx> based on version 2.0 by Michael Sweet <mike@xxxxxxxxxx>. --- 1,4 ---- ! Print plugin for the Gimp. Version 3.0.5 by Robert Krawitz <rlk@xxxxxxxxxxxx> based on version 2.0 by Michael Sweet <mike@xxxxxxxxxx>. *************** *** 69,81 **** * One group of settings you might want to start with is: ! Brightness 110 ! Gamma 1.3 ! Contrast 80 ! Green 94 ! Blue 89 ! Saturation 1.15 ! Density 1.6 Makefile.standalone enables you to build this plugin as a standalone --- 69,79 ---- * One group of settings you might want to start with is: ! Brightness 45 ! Gamma 1.5 ! Contrast 105 ! Saturation 1.4 ! Density 0.8 Makefile.standalone enables you to build this plugin as a standalone *************** *** 84,87 **** Enjoy! ! -Robert Krawitz, November 14, 1999 --- 82,85 ---- Enjoy! ! -Robert Krawitz, January 13, 2000 diff -rc print/print-escp2.c /tmp/print/print-escp2.c *** print/print-escp2.c Thu Dec 16 14:44:01 1999 --- /tmp/print/print-escp2.c Wed Jan 12 22:32:34 2000 *************** *** 1,9 **** /* ! * "$Id: print-escp2.c,v 1.12 1999/12/16 19:44:01 olofk Exp $" * * Print plug-in EPSON ESC/P2 driver for the GIMP. * ! * Copyright 1997-1999 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it --- 1,9 ---- /* ! * "$Id: print-escp2.c,v 1.39.2.1 2000/01/13 03:32:34 rlk Exp $" * * Print plug-in EPSON ESC/P2 driver for the GIMP. * ! * Copyright 1997-2000 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it *************** *** 31,76 **** * Revision History: * * $Log: print-escp2.c,v $ ! * Revision 1.12 1999/12/16 19:44:01 olofk ! * Thu Dec 16 20:15:25 CET 1999 Olof S Kylande <olof@xxxxxxxx> * ! * Fix of KDE/Kwm selection add/sub/inter problem ! * NOTE: This is a workaround, not a real fix. ! * Many Thanks to Matthias Ettrich ! * ! * * app/disp_callbacks.c ! * ! * Updated unsharp-mask to version 0.10 ! * ! * * plug-ins/unsharp/dialog_f.c ! * * plug-ins/unsharp/dialog_f.h ! * * plug-ins/unsharp/dialog_i.c ! * * plug-ins/unsharp/dialog_i.h ! * * plug-ins/unsharp/unsharp.c ! * ! * Updated print plug-in to version 3.0.1 ! * ! * * plug-ins/print/README (new file) ! * * plug-ins/print/print-escp2.c ! * * plug-ins/print/print-pcl.c ! * * plug-ins/print/print-ps.c ! * * plug-ins/print/print-util.c ! * * plug-ins/print/print.c ! * * plug-ins/print/print.h ! * ! * Updated all files in the help/C/dialogs dir. This is ! * a first alpha glimpse of the help system. Please give ! * me feedback of the content. However since it's in alpha ! * stage it means that there is spell, grammatical, etc errors. ! * There is may also be pure errors which I hope "you" will ! * report to either olof@xxxxxxxx or karin@xxxxxxxxx Please ! * don't report spell, grammatical, etc error at this stage in dev. * ! * If you have any plans to commit to the help system please write ! * to olof@xxxxxxxxx (This is mandatory not a please ;-). * ! * * help/C/welcome.html ! * * help/C/dialogs/about.html .............. * * Revision 1.31 1999/12/05 22:10:53 rlk * minor, prep for release --- 31,62 ---- * Revision History: * * $Log: print-escp2.c,v $ ! * Revision 1.39.2.1 2000/01/13 03:32:34 rlk ! * silliness * ! * Revision 1.39 2000/01/13 03:25:31 rlk ! * bug fix from mainline * ! * Revision 1.38 2000/01/08 23:27:54 rlk ! * Rearrange setup code; more printers to support softweave * ! * Revision 1.37 1999/12/19 14:36:18 rlk ! * Make 'em big enough ! * ! * Revision 1.36 1999/12/18 23:08:28 rlk ! * comments, mostly ! * ! * Revision 1.35 1999/12/11 15:26:27 rlk ! * hopefully get borders right ! * ! * Revision 1.34 1999/12/11 04:52:35 rlk ! * bug fixes ! * ! * Revision 1.33 1999/12/11 04:25:23 rlk ! * various other print modes ! * ! * Revision 1.32 1999/12/11 01:46:13 rlk ! * Better weaving code -- not absolutely complete yet * * Revision 1.31 1999/12/05 22:10:53 rlk * minor, prep for release *************** *** 330,336 **** static void escp2_write(FILE *, unsigned char *, int, int, int, int, int, int, int); ! static void initialize_weave(int jets, int separation, int horizontal); static void escp2_flush(int model, int width, int hoffset, int ydpi, int xdpi, FILE *prn); static void --- 316,323 ---- static void escp2_write(FILE *, unsigned char *, int, int, int, int, int, int, int); ! static void initialize_weave(int jets, int separation, ! int oversample, int horizontal); static void escp2_flush(int model, int width, int hoffset, int ydpi, int xdpi, FILE *prn); static void *************** *** 349,391 **** * Various classes of printer capabilities are represented by bitmasks. */ ! typedef unsigned int model_cap_t; typedef model_cap_t model_featureset_t; typedef model_cap_t model_class_t; ! #define MODEL_PAPER_SIZE_MASK 0x3 ! #define MODEL_PAPER_SMALL 0x0 ! #define MODEL_PAPER_LARGE 0x1 ! #define MODEL_PAPER_1200 0x2 ! ! #define MODEL_IMAGEABLE_MASK 0xc ! #define MODEL_IMAGEABLE_DEFAULT 0x0 ! #define MODEL_IMAGEABLE_PHOTO 0x4 ! #define MODEL_IMAGEABLE_600 0x8 ! ! #define MODEL_INIT_MASK 0xf0 ! #define MODEL_INIT_COLOR 0x00 ! #define MODEL_INIT_PRO 0x10 ! #define MODEL_INIT_1500 0x20 ! #define MODEL_INIT_600 0x30 ! #define MODEL_INIT_PHOTO 0x40 ! ! #define MODEL_HASBLACK_MASK 0x100 ! #define MODEL_HASBLACK_YES 0x000 ! #define MODEL_HASBLACK_NO 0x100 ! ! #define MODEL_6COLOR_MASK 0x200 ! #define MODEL_6COLOR_NO 0x000 ! #define MODEL_6COLOR_YES 0x200 ! ! #define MODEL_720DPI_MODE_MASK 0xc00 ! #define MODEL_720DPI_DEFAULT 0x000 ! #define MODEL_720DPI_600 0x400 ! #define MODEL_720DPI_PHOTO 0x400 /* 0x800 for experimental stuff */ ! ! #define MODEL_1440DPI_MASK 0x1000 ! #define MODEL_1440DPI_NO 0x0000 ! #define MODEL_1440DPI_YES 0x1000 /* * SUGGESTED SETTINGS FOR STYLUS PHOTO EX: --- 336,385 ---- * Various classes of printer capabilities are represented by bitmasks. */ ! typedef unsigned long long model_cap_t; typedef model_cap_t model_featureset_t; typedef model_cap_t model_class_t; ! #define MODEL_PAPER_SIZE_MASK 0x300 ! #define MODEL_PAPER_SMALL 0x000 ! #define MODEL_PAPER_LARGE 0x100 ! #define MODEL_PAPER_1200 0x200 ! ! #define MODEL_IMAGEABLE_MASK 0xc00 ! #define MODEL_IMAGEABLE_DEFAULT 0x000 ! #define MODEL_IMAGEABLE_PHOTO 0x400 ! #define MODEL_IMAGEABLE_600 0x800 ! ! #define MODEL_INIT_MASK 0xf000 ! #define MODEL_INIT_COLOR 0x0000 ! #define MODEL_INIT_PRO 0x1000 ! #define MODEL_INIT_1500 0x2000 ! #define MODEL_INIT_600 0x3000 ! #define MODEL_INIT_PHOTO 0x4000 ! ! #define MODEL_HASBLACK_MASK 0x10000 ! #define MODEL_HASBLACK_YES 0x00000 ! #define MODEL_HASBLACK_NO 0x10000 ! ! #define MODEL_6COLOR_MASK 0x20000 ! #define MODEL_6COLOR_NO 0x00000 ! #define MODEL_6COLOR_YES 0x20000 ! ! #define MODEL_720DPI_MODE_MASK 0xc0000 ! #define MODEL_720DPI_DEFAULT 0x00000 ! #define MODEL_720DPI_600 0x40000 ! #define MODEL_720DPI_PHOTO 0x40000 /* 0x80000 for experimental stuff */ ! ! #define MODEL_1440DPI_MASK 0x100000 ! #define MODEL_1440DPI_NO 0x000000 ! #define MODEL_1440DPI_YES 0x100000 ! ! #define MODEL_NOZZLES_MASK 0xff000000 ! #define MODEL_MAKE_NOZZLES(x) ((long long) ((x)) << 24) ! #define MODEL_GET_NOZZLES(x) (((x) & MODEL_NOZZLES_MASK) >> 24) ! #define MODEL_SEPARATION_MASK 0xf00000000ll ! #define MODEL_MAKE_SEPARATION(x) (((long long) (x)) << 32) ! #define MODEL_GET_SEPARATION(x) (((x) & MODEL_SEPARATION_MASK) >> 32) /* * SUGGESTED SETTINGS FOR STYLUS PHOTO EX: *************** *** 413,456 **** * The green and blue will vary somewhat with different inks */ model_cap_t model_capabilities[] = { /* Stylus Color */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_DEFAULT | MODEL_INIT_COLOR | MODEL_HASBLACK_YES | MODEL_6COLOR_NO | MODEL_720DPI_DEFAULT ! | MODEL_1440DPI_NO), /* Stylus Color Pro/Pro XL/400/500 */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_DEFAULT | MODEL_INIT_PRO | MODEL_HASBLACK_YES | MODEL_6COLOR_NO | MODEL_720DPI_DEFAULT ! | MODEL_1440DPI_NO), /* Stylus Color 1500 */ (MODEL_PAPER_LARGE | MODEL_IMAGEABLE_DEFAULT | MODEL_INIT_1500 | MODEL_HASBLACK_NO | MODEL_6COLOR_NO | MODEL_720DPI_DEFAULT ! | MODEL_1440DPI_NO), /* Stylus Color 600 */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_600 | MODEL_INIT_600 | MODEL_HASBLACK_YES | MODEL_6COLOR_NO | MODEL_720DPI_600 ! | MODEL_1440DPI_NO), /* Stylus Color 800 */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_600 | MODEL_INIT_600 | MODEL_HASBLACK_YES | MODEL_6COLOR_NO | MODEL_720DPI_DEFAULT ! | MODEL_1440DPI_NO), /* Stylus Color 1520/3000 */ (MODEL_PAPER_LARGE | MODEL_IMAGEABLE_600 | MODEL_INIT_600 | MODEL_HASBLACK_YES | MODEL_6COLOR_NO | MODEL_720DPI_DEFAULT ! | MODEL_1440DPI_NO), /* Stylus Photo 700 */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_PHOTO | MODEL_INIT_PHOTO | MODEL_HASBLACK_YES | MODEL_6COLOR_YES | MODEL_720DPI_PHOTO ! | MODEL_1440DPI_YES), /* Stylus Photo EX */ (MODEL_PAPER_LARGE | MODEL_IMAGEABLE_PHOTO | MODEL_INIT_PHOTO | MODEL_HASBLACK_YES | MODEL_6COLOR_YES | MODEL_720DPI_PHOTO ! | MODEL_1440DPI_YES), /* Stylus Photo */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_PHOTO | MODEL_INIT_PHOTO | MODEL_HASBLACK_YES | MODEL_6COLOR_YES | MODEL_720DPI_PHOTO ! | MODEL_1440DPI_NO), }; static int --- 407,474 ---- * The green and blue will vary somewhat with different inks */ + model_cap_t model_capabilities[] = { /* Stylus Color */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_DEFAULT | MODEL_INIT_COLOR | MODEL_HASBLACK_YES | MODEL_6COLOR_NO | MODEL_720DPI_DEFAULT ! | MODEL_1440DPI_NO | MODEL_MAKE_NOZZLES(1) | MODEL_MAKE_SEPARATION(1)), /* Stylus Color Pro/Pro XL/400/500 */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_DEFAULT | MODEL_INIT_PRO | MODEL_HASBLACK_YES | MODEL_6COLOR_NO | MODEL_720DPI_DEFAULT ! | MODEL_1440DPI_NO | MODEL_MAKE_NOZZLES(1) | MODEL_MAKE_SEPARATION(1)), /* Stylus Color 1500 */ (MODEL_PAPER_LARGE | MODEL_IMAGEABLE_DEFAULT | MODEL_INIT_1500 | MODEL_HASBLACK_NO | MODEL_6COLOR_NO | MODEL_720DPI_DEFAULT ! | MODEL_1440DPI_NO | MODEL_MAKE_NOZZLES(1) | MODEL_MAKE_SEPARATION(1)), /* Stylus Color 600 */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_600 | MODEL_INIT_600 | MODEL_HASBLACK_YES | MODEL_6COLOR_NO | MODEL_720DPI_600 ! | MODEL_1440DPI_NO | MODEL_MAKE_NOZZLES(1) | MODEL_MAKE_SEPARATION(1)), /* Stylus Color 800 */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_600 | MODEL_INIT_600 | MODEL_HASBLACK_YES | MODEL_6COLOR_NO | MODEL_720DPI_DEFAULT ! | MODEL_1440DPI_NO | MODEL_MAKE_NOZZLES(64) | MODEL_MAKE_SEPARATION(8)), /* Stylus Color 1520/3000 */ (MODEL_PAPER_LARGE | MODEL_IMAGEABLE_600 | MODEL_INIT_600 | MODEL_HASBLACK_YES | MODEL_6COLOR_NO | MODEL_720DPI_DEFAULT ! | MODEL_1440DPI_NO | MODEL_MAKE_NOZZLES(64) | MODEL_MAKE_SEPARATION(8)), /* Stylus Photo 700 */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_PHOTO | MODEL_INIT_PHOTO | MODEL_HASBLACK_YES | MODEL_6COLOR_YES | MODEL_720DPI_PHOTO ! | MODEL_1440DPI_YES | MODEL_MAKE_NOZZLES(32) | MODEL_MAKE_SEPARATION(8)), /* Stylus Photo EX */ (MODEL_PAPER_LARGE | MODEL_IMAGEABLE_PHOTO | MODEL_INIT_PHOTO | MODEL_HASBLACK_YES | MODEL_6COLOR_YES | MODEL_720DPI_PHOTO ! | MODEL_1440DPI_YES | MODEL_MAKE_NOZZLES(32) | MODEL_MAKE_SEPARATION(8)), /* Stylus Photo */ (MODEL_PAPER_SMALL | MODEL_IMAGEABLE_PHOTO | MODEL_INIT_PHOTO | MODEL_HASBLACK_YES | MODEL_6COLOR_YES | MODEL_720DPI_PHOTO ! | MODEL_1440DPI_NO | MODEL_MAKE_NOZZLES(32) | MODEL_MAKE_SEPARATION(8)), ! }; ! ! typedef struct { ! const char name[65]; ! int hres; ! int vres; ! int softweave; ! int horizontal_passes; ! int vertical_passes; ! } res_t; ! ! res_t reslist[] = { ! { "360 DPI", 360, 360, 0, 1, 1 }, ! { "720 DPI Microweave", 720, 720, 0, 1, 1 }, ! { "720 DPI Softweave", 720, 720, 1, 1, 1 }, ! { "720 DPI High Quality", 720, 720, 1, 1, 2 }, ! { "720 DPI Highest Quality", 720, 720, 1, 1, 4 }, ! { "1440 x 720 DPI Microweave", 1440, 720, 0, 1, 1 }, ! { "1440 x 720 DPI Softweave", 1440, 720, 1, 2, 2 }, ! { "1440 x 720 DPI Highest Quality", 1440, 720, 1, 2, 4 }, ! { "1440 x 720 DPI Two-pass", 2880, 720, 1, 2, 4 }, ! { "1440 x 720 DPI Two-pass Microweave", 2880, 720, 0, 1, 1 }, ! { "", 0, 0, 0, 0, 0 } }; static int *************** *** 465,470 **** --- 483,500 ---- return (model_capabilities[model] & featureset); } + static int + escp2_nozzles(int model) + { + return MODEL_GET_NOZZLES(model_capabilities[model]); + } + + static int + escp2_nozzle_separation(int model) + { + return MODEL_GET_SEPARATION(model_capabilities[model]); + } + /* * 'escp2_parameters()' - Return the parameter values for the given parameter. */ *************** *** 476,483 **** int *count) /* O - Number of values */ { int i; ! char **p, ! **valptrs; static char *media_sizes[] = { ("Letter"), --- 506,512 ---- int *count) /* O - Number of values */ { int i; ! char **valptrs; static char *media_sizes[] = { ("Letter"), *************** *** 487,503 **** ("A3"), ("12x18") }; - static char *resolutions[] = - { - ("360 DPI"), - ("720 DPI Microweave"), - ("720 DPI Softweave"), - ("1440 x 720 DPI"), - ("1440 x 720 DPI Microweave"), - ("1440 x 720 DPI Two-pass"), - ("1440 x 720 DPI Two-pass Microweave") - }; - if (count == NULL) return (NULL); --- 516,521 ---- *************** *** 514,541 **** else *count = 3; ! p = media_sizes; } else if (strcmp(name, "Resolution") == 0) { ! if (escp2_has_cap(model, MODEL_1440DPI_MASK, MODEL_1440DPI_YES)) ! *count = 7; ! else ! *count = 3; ! p = resolutions; } else return (NULL); - valptrs = malloc(*count * sizeof(char *)); - for (i = 0; i < *count; i ++) - { - /* strdup doesn't appear to be POSIX... */ - valptrs[i] = malloc(strlen(p[i]) + 1); - strcpy(valptrs[i], p[i]); - } - - return (valptrs); } --- 532,574 ---- else *count = 3; ! valptrs = malloc(*count * sizeof(char *)); ! for (i = 0; i < *count; i ++) ! { ! /* strdup doesn't appear to be POSIX... */ ! valptrs[i] = malloc(strlen(media_sizes[i]) + 1); ! strcpy(valptrs[i], media_sizes[i]); ! } ! return (valptrs); } else if (strcmp(name, "Resolution") == 0) { ! res_t *res = &(reslist[0]); ! valptrs = malloc(sizeof(char *) * sizeof(reslist) / sizeof(res_t)); ! *count = 0; ! while(res->hres) ! { ! if (escp2_has_cap(model, MODEL_1440DPI_MASK, MODEL_1440DPI_YES) || ! (res->hres <= 720 && res->vres <= 720)) ! { ! int nozzles = escp2_nozzles(model); ! int separation = escp2_nozzle_separation(model); ! int max_weave = nozzles / separation; ! if (! res->softweave || ! (nozzles > 1 && res->vertical_passes <= max_weave)) ! { ! valptrs[*count] = malloc(strlen(res->name) + 1); ! strcpy(valptrs[*count], res->name); ! (*count)++; ! } ! } ! res++; ! } ! return (valptrs); } else return (NULL); } *************** *** 563,569 **** *left = 9; *right = width - 9; *top = length; ! *bottom = 49; break; case MODEL_IMAGEABLE_600: --- 596,602 ---- *left = 9; *right = width - 9; *top = length; ! *bottom = 80; break; case MODEL_IMAGEABLE_600: *************** *** 642,647 **** --- 675,682 ---- int nozzles = 1; int nozzle_separation = 1; int horizontal_passes = 1; + int vertical_passes = 1; + res_t *res; /* * Setup a read-only pixel region for the entire image... *************** *** 683,743 **** /* * Figure out the output resolution... */ ! ! xdpi = ydpi = atoi(resolution); ! if (escp2_has_cap(model, MODEL_1440DPI_MASK, MODEL_1440DPI_YES)) { ! if (xdpi == 1440) { ! use_softweave = 1; ! ydpi = 720; ! if (!strcmp(resolution, "1440 x 720 DPI Two-pass") || ! !strcmp(resolution, "1440 x 720 DPI Two-pass Microweave")) ! { ! xdpi = 2880; ! horizontal_passes = 4; ! if (!strcmp(resolution, "1440 x 720 DPI Two-pass")) ! { ! nozzles = 32; ! nozzle_separation = 8; ! } ! else ! { ! nozzles = 1; ! nozzle_separation = 1; ! } ! } ! else ! { ! horizontal_passes = 2; ! if (!strcmp(resolution, "1440 x 720 DPI")) ! { ! nozzles = 32; ! nozzle_separation = 8; ! } ! else ! { ! nozzles = 1; ! nozzle_separation = 1; ! } ! } } ! } ! else if (ydpi == 1440) ! { ! ydpi = 720; ! xdpi = 720; ! } ! if (escp2_has_cap(model, MODEL_6COLOR_MASK, MODEL_6COLOR_YES)) ! { ! if (!strcmp(resolution, "720 DPI Softweave") || xdpi > 720) { ! if (!strcmp(resolution, "720 DPI Softweave")) ! { ! nozzles = 32; ! nozzle_separation = 8; ! } ! use_softweave = 1; } } --- 718,739 ---- /* * Figure out the output resolution... */ ! for (res = &reslist[0];;res++) { ! if (!strcmp(resolution, res->name)) { ! use_softweave = res->softweave; ! horizontal_passes = res->horizontal_passes; ! vertical_passes = res->vertical_passes; ! xdpi = res->hres; ! ydpi = res->vres; ! nozzles = escp2_nozzles(model); ! nozzle_separation = escp2_nozzle_separation(model); ! break; } ! else if (!strcmp(resolution, "")) { ! return; } } *************** *** 897,920 **** break; } switch (escp2_cap(model, MODEL_INIT_MASK)) /* Printer specific initialization */ { case MODEL_INIT_COLOR : /* ESC */ ! if (output_type == OUTPUT_COLOR && ydpi > 360) fwrite("\033(i\001\000\001", 6, 1, prn); /* Microweave mode on */ break; case MODEL_INIT_PRO : /* ESC Pro, Pro XL, 400, 500 */ fwrite("\033(e\002\000\000\001", 7, 1, prn); /* Small dots */ ! if (ydpi > 360) fwrite("\033(i\001\000\001", 6, 1, prn); /* Microweave mode on */ break; case MODEL_INIT_1500 : /* ESC 1500 */ fwrite("\033(e\002\000\000\001", 7, 1, prn); /* Small dots */ ! if (ydpi > 360) fwrite("\033(i\001\000\001", 6, 1, prn); /* Microweave mode on */ break; --- 893,919 ---- break; } + if (use_softweave) + initialize_weave(nozzles, nozzle_separation, horizontal_passes, + vertical_passes); switch (escp2_cap(model, MODEL_INIT_MASK)) /* Printer specific initialization */ { case MODEL_INIT_COLOR : /* ESC */ ! if (output_type == OUTPUT_COLOR && ydpi > 360 && !use_softweave) fwrite("\033(i\001\000\001", 6, 1, prn); /* Microweave mode on */ break; case MODEL_INIT_PRO : /* ESC Pro, Pro XL, 400, 500 */ fwrite("\033(e\002\000\000\001", 7, 1, prn); /* Small dots */ ! if (ydpi > 360 && !use_softweave) fwrite("\033(i\001\000\001", 6, 1, prn); /* Microweave mode on */ break; case MODEL_INIT_1500 : /* ESC 1500 */ fwrite("\033(e\002\000\000\001", 7, 1, prn); /* Small dots */ ! if (ydpi > 360 && !use_softweave) fwrite("\033(i\001\000\001", 6, 1, prn); /* Microweave mode on */ break; *************** *** 926,968 **** fwrite("\033(e\002\000\000\002", 7, 1, prn); /* Small dots */ ! if (ydpi > 360) fwrite("\033(i\001\000\001", 6, 1, prn); /* Microweave mode on */ break; case MODEL_INIT_PHOTO: if (ydpi > 360) { ! if (use_softweave) ! { ! if (horizontal_passes > 1) ! fwrite("\033U\000", 3, 1, prn); /* Unidirectional */ ! else ! fwrite("\033U\000", 3, 1, prn); /* Unidirectional */ ! fwrite("\033(i\001\000\000", 6, 1, prn); /* Microweave off! */ ! initialize_weave(nozzles, nozzle_separation, horizontal_passes); ! fwrite("\033(e\002\000\000\004", 7, 1, prn); /* Microdots */ ! } ! else ! { ! fwrite("\033U\000", 3, 1, prn); /* Unidirectional */ ! fwrite("\033(i\001\000\001", 6, 1, prn); /* Microweave on */ ! fwrite("\033(e\002\000\000\004", 7, 1, prn); /* Microdots */ ! } ! #if 0 ! fwrite("\033\0311", 3, 1, prn); /* ??? */ ! #endif } else fwrite("\033(e\002\000\000\003", 7, 1, prn); /* Whatever dots */ break; - - #if 0 - if (output_type == OUTPUT_GRAY) - fwrite("\033(K\002\000\000\001", 7, 1, prn); /* Fast black printing */ - else - fwrite("\033(K\002\000\000\002", 7, 1, prn); /* Color printing */ - #endif } fwrite("\033(C\002\000", 5, 1, prn); /* Page length */ --- 925,949 ---- fwrite("\033(e\002\000\000\002", 7, 1, prn); /* Small dots */ ! if (ydpi > 360 && !use_softweave) fwrite("\033(i\001\000\001", 6, 1, prn); /* Microweave mode on */ break; case MODEL_INIT_PHOTO: + if (output_type == OUTPUT_GRAY) + fwrite("\033(K\002\000\000\001", 7, 1, prn); /* Fast black printing */ + else + fwrite("\033(K\002\000\000\002", 7, 1, prn); /* Color printing */ if (ydpi > 360) { ! fwrite("\033U\000", 3, 1, prn); /* Unidirectional */ ! if (!use_softweave) ! fwrite("\033(i\001\000\001", 6, 1, prn); /* Microweave on */ ! fwrite("\033(e\002\000\000\004", 7, 1, prn); /* Microdots */ } else fwrite("\033(e\002\000\000\003", 7, 1, prn); /* Whatever dots */ break; } fwrite("\033(C\002\000", 5, 1, prn); /* Page length */ *************** *** 975,980 **** --- 956,963 ---- putc(n & 255, prn); putc(n >> 8, prn); n = ydpi * (page_length - page_bottom) / 72; + if (use_softweave) + n += 320 * ydpi / 720; putc(n & 255, prn); putc(n >> 8, prn); *************** *** 1043,1052 **** for (x = 0; x < out_height; x ++) { - #if 0 - printf("escp2_print: x = %d, line = %d, val = %d, mod = %d, height = %d\n", - x, errline, errval, errmod, out_height); - #endif if ((x & 255) == 0) Image_note_progress(image, x, out_height); --- 1026,1031 ---- *************** *** 1091,1102 **** { dither_cmyk(out, x, image_height, out_width, cyan, 0, magenta, 0, yellow, 0, black, horizontal_passes); ! ! escp2_write(prn, cyan, length, 0, 2, ydpi, model, out_width, left); ! escp2_write(prn, magenta, length, 0, 1, ydpi, model, out_width, left); ! escp2_write(prn, yellow, length, 0, 4, ydpi, model, out_width, left); ! if (black != NULL) ! escp2_write(prn, black, length, 0, 0, ydpi, model, out_width, left); } if (!use_softweave) --- 1070,1090 ---- { dither_cmyk(out, x, image_height, out_width, cyan, 0, magenta, 0, yellow, 0, black, horizontal_passes); ! if (use_softweave) ! escp2_write_weave(prn, length, ydpi, model, out_width, left, xdpi, ! cyan, magenta, yellow, black, NULL, NULL); ! else ! { ! escp2_write(prn, cyan, length, 0, 2, ydpi, model, out_width, ! left); ! escp2_write(prn, magenta, length, 0, 1, ydpi, model, out_width, ! left); ! escp2_write(prn, yellow, length, 0, 4, ydpi, model, out_width, ! left); ! if (black != NULL) ! escp2_write(prn, black, length, 0, 0, ydpi, model, out_width, ! left); ! } } if (!use_softweave) *************** *** 1126,1136 **** for (y = 0; y < out_height; y ++) { - #if 0 - printf("escp2_print: y = %d, line = %d, val = %d, mod = %d, height = %d, length = %d\n", - y, errline, errval, errmod, out_height, length); - #endif - if ((y & 255) == 0) Image_note_progress(image, y, out_height); --- 1114,1119 ---- *************** *** 1174,1185 **** { dither_cmyk(out, y, image_width, out_width, cyan, 0, magenta, 0, yellow, 0, black, horizontal_passes); ! ! escp2_write(prn, cyan, length, 0, 2, ydpi, model, out_width, left); ! escp2_write(prn, magenta, length, 0, 1, ydpi, model, out_width, left); ! escp2_write(prn, yellow, length, 0, 4, ydpi, model, out_width, left); ! if (black != NULL) ! escp2_write(prn, black, length, 0, 0, ydpi, model, out_width, left); } if (!use_softweave) --- 1157,1177 ---- { dither_cmyk(out, y, image_width, out_width, cyan, 0, magenta, 0, yellow, 0, black, horizontal_passes); ! if (use_softweave) ! escp2_write_weave(prn, length, ydpi, model, out_width, left, xdpi, ! cyan, magenta, yellow, black, NULL, NULL); ! else ! { ! escp2_write(prn, cyan, length, 0, 2, ydpi, model, out_width, ! left); ! escp2_write(prn, magenta, length, 0, 1, ydpi, model, out_width, ! left); ! escp2_write(prn, yellow, length, 0, 4, ydpi, model, out_width, ! left); ! if (black != NULL) ! escp2_write(prn, black, length, 0, 0, ydpi, model, out_width, ! left); ! } } if (!use_softweave) *************** *** 1324,1330 **** int width, /* I - Printed width */ int offset) /* I - Offset from left side */ { ! unsigned char comp_buf[1536], /* Compression buffer */ *comp_ptr; static int last_density = 0; /* Last density printed */ static int last_plane = 0; /* Last color plane printed */ --- 1316,1322 ---- int width, /* I - Printed width */ int offset) /* I - Offset from left side */ { ! unsigned char comp_buf[3072], /* Compression buffer */ *comp_ptr; static int last_density = 0; /* Last density printed */ static int last_plane = 0; /* Last color plane printed */ *************** *** 1358,1364 **** fprintf(prn, "\033r%c", plane); } ! if (escp2_has_cap(model, MODEL_6COLOR_MASK, MODEL_6COLOR_YES)) fprintf(prn, "\033(\\%c%c%c%c%c%c", 4, 0, 160, 5, (offset * 1440 / ydpi) & 255, (offset * 1440 / ydpi) >> 8); else --- 1350,1356 ---- fprintf(prn, "\033r%c", plane); } ! if (escp2_has_cap(model, MODEL_1440DPI_MASK, MODEL_1440DPI_YES)) fprintf(prn, "\033(\\%c%c%c%c%c%c", 4, 0, 160, 5, (offset * 1440 / ydpi) & 255, (offset * 1440 / ydpi) >> 8); else *************** *** 1465,1470 **** --- 1457,1475 ---- * lets me use all of the nozzles, except near the top and bottom of the * page. * + * This still produces some banding, though. Even better quality can be + * achieved by using multiple nozzles on the same line. How do we do this? + * In 1440x720 mode, we're printing two output lines at the same vertical + * position. However, if we want four passes, we have to effectively print + * each line twice. Actually doing this would increase the density, so + * what we do is print half the dots on each pass. This produces near-perfect + * output, and it's far faster than using "MicroWeave". + * + * The current algorithm is not completely general. The number of passes + * is limited to (nozzles / gap). On the Photo EX class printers, that limits + * it to 4 -- 32 nozzles, an inter-nozzle gap of 8 lines. Furthermore, there + * are a number of routines that are only coded up to 4 passes. + * * The routine initialize_weave calculates the basic parameters, given * the number of jets and separation between jets, in rows. * *************** *** 1555,1560 **** --- 1560,1569 ---- static int horizontal_weave; /* Number of horizontal passes required */ /* This is > 1 for some of the ultra-high */ /* resolution modes */ + static int vertical_subpasses; /* Number of passes per line (for better */ + /* quality) */ + static int vmod; /* Number of banks of passes */ + static int oversample; /* Excess precision per row */ /* * Mapping between color and linear index. The colors are *************** *** 1580,1586 **** * Initialize the weave parameters */ static void ! initialize_weave(int jets, int sep, int horizontal_passes) { int i; int k; --- 1589,1595 ---- * Initialize the weave parameters */ static void ! initialize_weave(int jets, int sep, int osample, int v_subpasses) { int i; int k; *************** *** 1592,1602 **** else separation = sep; njets = jets; ! if (horizontal_passes <= 0) ! horizontal_passes = 1; ! horizontal_weave = horizontal_passes; ! weavefactor = jets / separation; jetsused = ((weavefactor) * separation); initialoffset = (jetsused - weavefactor - 1) * separation; jetsleftover = njets - jetsused + 1; --- 1601,1615 ---- else separation = sep; njets = jets; ! if (v_subpasses <= 0) ! v_subpasses = 1; ! oversample = osample; ! vertical_subpasses = v_subpasses; ! njets /= vertical_subpasses; ! vmod = separation * vertical_subpasses; ! horizontal_weave = 1; ! weavefactor = njets / separation; jetsused = ((weavefactor) * separation); initialoffset = (jetsused - weavefactor - 1) * separation; jetsleftover = njets - jetsused + 1; *************** *** 1605,1619 **** last_pass_offset = 0; last_pass = -1; ! linebufs = malloc(6 * 1536 * separation * jetsused * horizontal_passes); ! lineoffsets = malloc(separation * sizeof(lineoff_t) * horizontal_passes); ! linebases = malloc(separation * sizeof(linebufs_t) * horizontal_passes); ! passes = malloc(separation * sizeof(pass_t)); ! linecounts = malloc(separation * sizeof(int)); bufbase = linebufs; ! for (i = 0; i < separation; i++) { int j; passes[i].pass = -1; --- 1618,1632 ---- last_pass_offset = 0; last_pass = -1; ! linebufs = malloc(6 * 3072 * vmod * jets * horizontal_weave); ! lineoffsets = malloc(vmod * sizeof(lineoff_t) * horizontal_weave); ! linebases = malloc(vmod * sizeof(linebufs_t) * horizontal_weave); ! passes = malloc(vmod * sizeof(pass_t)); ! linecounts = malloc(vmod * sizeof(int)); bufbase = linebufs; ! for (i = 0; i < vmod; i++) { int j; passes[i].pass = -1; *************** *** 1621,1691 **** { for (j = 0; j < 6; j++) { ! linebases[i * horizontal_weave + k].v[j] = bufbase; ! bufbase += 1536 * jetsused; } } } } static lineoff_t * ! get_lineoffsets(int row) { ! return &(lineoffsets[horizontal_weave * (row % separation)]); } static int * ! get_linecount(int row) { ! return &(linecounts[row % separation]); } static const linebufs_t * ! get_linebases(int row) { ! return &(linebases[horizontal_weave * (row % separation)]); } static pass_t * ! get_pass(int row_or_pass) { ! return &(passes[row_or_pass % separation]); } ! /* ! * Compute the weave parameters for the given row. This computation is ! * rather complex, and I need to go back and write down very carefully ! * what's going on here. ! */ ! static void ! weave_parameters_by_row(int row, weave_t *w) { ! int passblockstart = (row + initialoffset) / jetsused; ! int internaljetsused = jetsused; ! int internallogicalpassstart; ! w->row = row; ! w->pass = (passblockstart - (separation - 1)) + ! (separation + row - passblockstart - 1) % separation; ! internallogicalpassstart = (w->pass * jetsused) - initialoffset + ! (w->pass % separation); ! if (internallogicalpassstart < 0) ! { ! internaljetsused -= ! (((separation - 1) - internallogicalpassstart) / separation); ! internallogicalpassstart += separation * ! (((separation - 1) - internallogicalpassstart) / separation); ! } ! w->logicalpassstart = internallogicalpassstart; ! w->jet = ((row - w->logicalpassstart) / separation); ! if (internallogicalpassstart >= 0) ! w->physpassstart = internallogicalpassstart; ! else ! w->physpassstart = internallogicalpassstart + ! (separation * ((separation - internallogicalpassstart) / separation)); ! w->physpassend = (internaljetsused - 1) * separation + ! internallogicalpassstart; ! w->missingstartrows = (w->physpassstart - w->logicalpassstart) / separation; } /* --- 1634,1743 ---- { for (j = 0; j < 6; j++) { ! linebases[k * vmod + i].v[j] = bufbase; ! bufbase += 3072 * jets; } } } } + /* + * Compute the weave parameters for the given row. This computation is + * rather complex, and I need to go back and write down very carefully + * what's going on here. + */ + + static void + weave_parameters_by_row(int row, int vertical_subpass, weave_t *w) + { + int passblockstart = (row + initialoffset) / jetsused; + int internaljetsused = jetsused * vertical_subpasses; + int subpass_adjustment; + + w->row = row; + w->pass = (passblockstart - (separation - 1)) + + (separation + row - passblockstart - 1) % separation; + subpass_adjustment = ((w->pass + 1) / separation) % vertical_subpasses; + subpass_adjustment = vertical_subpasses - subpass_adjustment - 1; + vertical_subpass = (vertical_subpass + subpass_adjustment) % vertical_subpasses; + w->pass += separation * vertical_subpass; + w->logicalpassstart = (w->pass * jetsused) - initialoffset + + (w->pass % separation); + w->jet = ((row - w->logicalpassstart) / separation); + w->jet += jetsused * (vertical_subpasses - 1); + w->logicalpassstart = w->row - (w->jet * separation); + if (w->logicalpassstart >= 0) + w->physpassstart = w->logicalpassstart; + else + w->physpassstart = w->logicalpassstart + + (separation * ((separation - 1 - w->logicalpassstart) / separation)); + w->physpassend = (internaljetsused - 1) * separation + + w->logicalpassstart; + w->missingstartrows = (w->physpassstart - w->logicalpassstart) / separation; + if (w->pass < 0) + { + w->logicalpassstart -= w->pass * separation; + w->physpassend -= w->pass * separation; + w->jet += w->pass; + w->missingstartrows += w->pass; + } + w->pass++; + } + static lineoff_t * ! get_lineoffsets(int row, int subpass) { ! weave_t w; ! weave_parameters_by_row(row, subpass, &w); ! return &(lineoffsets[w.pass % vmod]); } static int * ! get_linecount(int row, int subpass) { ! weave_t w; ! weave_parameters_by_row(row, subpass, &w); ! return &(linecounts[w.pass % vmod]); } static const linebufs_t * ! get_linebases(int row, int subpass) { ! weave_t w; ! weave_parameters_by_row(row, subpass, &w); ! return &(linebases[w.pass % vmod]); } static pass_t * ! get_pass_by_row(int row, int subpass) { ! weave_t w; ! weave_parameters_by_row(row, subpass, &w); ! return &(passes[w.pass % vmod]); } ! static lineoff_t * ! get_lineoffsets_by_pass(int pass) ! { ! return &(lineoffsets[pass % vmod]); ! } ! static int * ! get_linecount_by_pass(int pass) { ! return &(linecounts[pass % vmod]); ! } ! ! static const linebufs_t * ! get_linebases_by_pass(int pass) ! { ! return &(linebases[pass % vmod]); ! } ! ! static pass_t * ! get_pass_by_pass(int pass) ! { ! return &(passes[pass % vmod]); } /* *************** *** 1699,1712 **** */ static void ! fillin_start_rows(int row, int width, int missingstartrows) { ! lineoff_t *offsets = get_lineoffsets(row); ! const linebufs_t *bufs = get_linebases(row); int i = 0; int k = 0; int j; int m; for (k = 0; k < missingstartrows; k++) { int bytes_to_fill = width; --- 1751,1765 ---- */ static void ! fillin_start_rows(int row, int subpass, int width, int missingstartrows) { ! lineoff_t *offsets = get_lineoffsets(row, subpass); ! const linebufs_t *bufs = get_linebases(row, subpass); int i = 0; int k = 0; int j; int m; + width = (width + (oversample - 1)) / oversample; for (k = 0; k < missingstartrows; k++) { int bytes_to_fill = width; *************** *** 1761,1784 **** initialize_row(int row, int width) { weave_t w; ! weave_parameters_by_row(row, &w); ! if (w.physpassstart == row) { ! lineoff_t *lineoffs = get_lineoffsets(row); ! int *linecount = get_linecount(row); ! int j, k; ! pass_t *pass = get_pass(row); ! pass->pass = w.pass; ! pass->missingstartrows = w.missingstartrows; ! pass->logicalpassstart = w.logicalpassstart; ! pass->physpassstart = w.physpassstart; ! pass->physpassend = w.physpassend; ! for (k = 0; k < horizontal_weave; k++) ! for (j = 0; j < 6; j++) ! lineoffs[k].v[j] = 0; ! *linecount = 0; ! if (w.missingstartrows > 0) ! fillin_start_rows(row, width, w.missingstartrows); } } --- 1814,1841 ---- initialize_row(int row, int width) { weave_t w; ! int i; ! for (i = 0; i < vertical_subpasses; i++) { ! weave_parameters_by_row(row, i, &w); ! if (w.physpassstart == row) ! { ! lineoff_t *lineoffs = get_lineoffsets(row, i); ! int *linecount = get_linecount(row, i); ! int j, k; ! pass_t *pass = get_pass_by_row(row, i); ! pass->pass = w.pass; ! pass->missingstartrows = w.missingstartrows; ! pass->logicalpassstart = w.logicalpassstart; ! pass->physpassstart = w.physpassstart; ! pass->physpassend = w.physpassend; ! for (k = 0; k < horizontal_weave; k++) ! for (j = 0; j < 6; j++) ! lineoffs[k].v[j] = 0; ! *linecount = 0; ! if (w.missingstartrows > 0) ! fillin_start_rows(row, i, width, w.missingstartrows); ! } } } *************** *** 1793,1814 **** { int j; int k; ! lineoff_t *lineoffs = get_lineoffsets(passno); ! const linebufs_t *bufs = get_linebases(passno); ! pass_t *pass = get_pass(passno); ! int *linecount = get_linecount(passno); ! int lwidth = (width + (horizontal_weave - 1)) / horizontal_weave; ! #if 0 ! fprintf(stderr, "Flushing pass %d start %d last %d\n", passno, pass->physpassstart, last_pass_offset); ! #endif if (pass->physpassstart > last_pass_offset) { int advance = pass->logicalpassstart - last_pass_offset; int alo = advance % 256; int ahi = advance / 256; - #if 0 - fprintf(stderr, " advancing %d lines\n", advance); - #endif fprintf(prn, "\033(v\002%c%c%c", 0, alo, ahi); last_pass_offset = pass->logicalpassstart; } --- 1850,1865 ---- { int j; int k; ! lineoff_t *lineoffs = get_lineoffsets_by_pass(passno); ! const linebufs_t *bufs = get_linebases_by_pass(passno); ! pass_t *pass = get_pass_by_pass(passno); ! int *linecount = get_linecount_by_pass(passno); ! int lwidth = (width + (oversample - 1)) / oversample; if (pass->physpassstart > last_pass_offset) { int advance = pass->logicalpassstart - last_pass_offset; int alo = advance % 256; int ahi = advance / 256; fprintf(prn, "\033(v\002%c%c%c", 0, alo, ahi); last_pass_offset = pass->logicalpassstart; } *************** *** 1818,1839 **** { if (lineoffs[k].v[j] == 0) continue; if (escp2_has_cap(model, MODEL_1440DPI_MASK, MODEL_1440DPI_YES)) { - fprintf(prn, "\033(r\002%c%c%c", 0, densities[j], colors[j]); /* FIXME need a more general way of specifying column */ /* separation */ fprintf(prn, "\033(\\%c%c%c%c%c%c", 4, 0, 160, 5, ! ((hoffset * 1440 / ydpi) + ! (k & (horizontal_weave >> 1))) & 255, ! ((hoffset * 1440 / ydpi) + ! (k & (horizontal_weave >> 1))) >> 8); } - else if (densities[j] > 0) - continue; else { - fprintf(prn, "\033r%c", colors[j]); fprintf(prn, "\033\\%c%c", hoffset & 255, hoffset >> 8); } switch (ydpi) /* Raster graphics header */ --- 1869,1890 ---- { if (lineoffs[k].v[j] == 0) continue; + if (escp2_has_cap(model, MODEL_6COLOR_MASK, MODEL_6COLOR_YES)) + fprintf(prn, "\033(r\002%c%c%c", 0, densities[j], colors[j]); + else if (densities[j] > 0) + continue; + else + fprintf(prn, "\033r%c", colors[j]); if (escp2_has_cap(model, MODEL_1440DPI_MASK, MODEL_1440DPI_YES)) { /* FIXME need a more general way of specifying column */ /* separation */ fprintf(prn, "\033(\\%c%c%c%c%c%c", 4, 0, 160, 5, ! ((hoffset * 1440 / ydpi) + (k & oversample)) & 255, ! ((hoffset * 1440 / ydpi) + (k & oversample)) >> 8); } else { fprintf(prn, "\033\\%c%c", hoffset & 255, hoffset >> 8); } switch (ydpi) /* Raster graphics header */ *************** *** 1859,1869 **** putc(lwidth & 255, prn); /* Width of raster line in pixels */ putc(lwidth >> 8, prn); fwrite(bufs[k].v[j], lineoffs[k].v[j], 1, prn); - #if 0 - fprintf(stderr, "Sending %d bytes, plane %d, density %d, lines %d, x %d\n", - lineoffs[k].v[j], colors[j], densities[j], - *linecount + pass->missingstartrows, k); - #endif putc('\r', prn); } fwrite("\033\006", 2, 1, prn); --- 1910,1915 ---- *************** *** 1874,1903 **** static void add_to_row(int row, unsigned char *buf, size_t nbytes, int plane, int density, ! int horizontal) { weave_t w; int color = get_color_by_params(plane, density); ! lineoff_t *lineoffs = get_lineoffsets(row); ! const linebufs_t *bufs = get_linebases(row); ! weave_parameters_by_row(row, &w); ! memcpy(bufs[horizontal].v[color] + lineoffs[horizontal].v[color], ! buf, nbytes); ! lineoffs[horizontal].v[color] += nbytes; } static void finalize_row(int row, int model, int width, int hoffset, int ydpi, int xdpi, FILE *prn) { ! weave_t w; ! int *lines = get_linecount(row); ! weave_parameters_by_row(row, &w); ! (*lines)++; ! if (w.physpassend == row) { ! pass_t *pass = get_pass(row); ! flush_pass(pass->pass, model, width, hoffset, ydpi, xdpi, prn); } } --- 1920,1952 ---- static void add_to_row(int row, unsigned char *buf, size_t nbytes, int plane, int density, ! int subpass) { weave_t w; int color = get_color_by_params(plane, density); ! lineoff_t *lineoffs = get_lineoffsets(row, subpass); ! const linebufs_t *bufs = get_linebases(row, subpass); ! weave_parameters_by_row(row, subpass, &w); ! memcpy(bufs[0].v[color] + lineoffs[0].v[color], buf, nbytes); ! lineoffs[0].v[color] += nbytes; } static void finalize_row(int row, int model, int width, int hoffset, int ydpi, int xdpi, FILE *prn) { ! int i; ! for (i = 0; i < vertical_subpasses; i++) { ! weave_t w; ! int *lines = get_linecount(row, i); ! weave_parameters_by_row(row, i, &w); ! (*lines)++; ! if (w.physpassend == row) ! { ! pass_t *pass = get_pass_by_row(row, i); ! flush_pass(pass->pass, model, width, hoffset, ydpi, xdpi, prn); ! } } } *************** *** 1906,1912 **** { while (1) { ! pass_t *pass = get_pass(last_pass + 1); if (pass->pass < 0) return; flush_pass(pass->pass, model, width, hoffset, ydpi, xdpi, prn); --- 1955,1961 ---- { while (1) { ! pass_t *pass = get_pass_by_pass(last_pass + 1); if (pass->pass < 0) return; flush_pass(pass->pass, model, width, hoffset, ydpi, xdpi, prn); *************** *** 1914,1919 **** --- 1963,2003 ---- } static void + escp2_split_2(int length, + const unsigned char *in, + unsigned char *outlo, + unsigned char *outhi) + { + int i; + for (i = 0; i < length; i++) + { + unsigned char inbyte = in[i]; + outlo[i] = inbyte & 0x55; + outhi[i] = inbyte & 0xaa; + } + } + + static void + escp2_split_4(int length, + const unsigned char *in, + unsigned char *out0, + unsigned char *out1, + unsigned char *out2, + unsigned char *out3) + { + int i; + for (i = 0; i < length; i++) + { + unsigned char inbyte = in[i]; + out0[i] = inbyte & 0x11; + out1[i] = inbyte & 0x22; + out2[i] = inbyte & 0x44; + out3[i] = inbyte & 0x88; + } + } + + + static void escp2_unpack_2(int length, const unsigned char *in, unsigned char *outlo, *************** *** 2050,2205 **** unsigned char *M) { static int lineno = 0; ! static unsigned char s[4][1536]; ! static unsigned char comp_buf[1536]; unsigned char *comp_ptr; ! int i; initialize_row(lineno, width); ! if (c) ! { ! if (horizontal_weave > 1) ! { ! if (horizontal_weave == 2) ! escp2_unpack_2(length, c, s[0], s[1]); ! else ! escp2_unpack_4(length, c, s[0], s[1], s[2], s[3]); ! for (i = 0; i < horizontal_weave; i++) ! { ! escp2_pack(s[i], ! (length + horizontal_weave - 1) / horizontal_weave, ! comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 2, 0, i); ! } ! } ! else ! { ! escp2_pack(c, length, comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 2, 0, 0); ! } ! } ! ! if (m) ! { ! if (horizontal_weave > 1) ! { ! if (horizontal_weave == 2) ! escp2_unpack_2(length, m, s[0], s[1]); ! else ! escp2_unpack_4(length, m, s[0], s[1], s[2], s[3]); ! for (i = 0; i < horizontal_weave; i++) ! { ! escp2_pack(s[i], ! (length + horizontal_weave - 1) / horizontal_weave, ! comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 1, 0, i); ! } ! } ! else ! { ! escp2_pack(m, length, comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 1, 0, 0); ! } ! } ! ! if (y) ! { ! if (horizontal_weave > 1) ! { ! if (horizontal_weave == 2) ! escp2_unpack_2(length, y, s[0], s[1]); ! else ! escp2_unpack_4(length, y, s[0], s[1], s[2], s[3]); ! for (i = 0; i < horizontal_weave; i++) ! { ! escp2_pack(s[i], ! (length + horizontal_weave - 1) / horizontal_weave, ! comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 4, 0, i); ! } ! } ! else ! { ! escp2_pack(y, length, comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 4, 0, 0); ! } ! } ! ! if (k) ! { ! if (horizontal_weave > 1) ! { ! if (horizontal_weave == 2) ! escp2_unpack_2(length, k, s[0], s[1]); ! else ! escp2_unpack_4(length, k, s[0], s[1], s[2], s[3]); ! for (i = 0; i < horizontal_weave; i++) ! { ! escp2_pack(s[i], ! (length + horizontal_weave - 1) / horizontal_weave, ! comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 0, 0, i); ! } ! } ! else ! { ! escp2_pack(k, length, comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 0, 0, 0); ! } ! } ! ! if (C) { ! if (horizontal_weave > 1) { ! if (horizontal_weave == 2) ! escp2_unpack_2(length, C, s[0], s[1]); ! else ! escp2_unpack_4(length, C, s[0], s[1], s[2], s[3]); ! for (i = 0; i < horizontal_weave; i++) { ! escp2_pack(s[i], ! (length + horizontal_weave - 1) / horizontal_weave, ! comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 2, 1, i); } - } - else - { - escp2_pack(C, length, comp_buf, &comp_ptr); - add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 2, 1, 0); - } - } - - if (M) - { - if (horizontal_weave > 1) - { - if (horizontal_weave == 2) - escp2_unpack_2(length, M, s[0], s[1]); else - escp2_unpack_4(length, M, s[0], s[1], s[2], s[3]); - for (i = 0; i < horizontal_weave; i++) { ! escp2_pack(s[i], ! (length + horizontal_weave - 1) / horizontal_weave, ! comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 1, 1, i); } } - else - { - escp2_pack(M, length, comp_buf, &comp_ptr); - add_to_row(lineno, comp_buf, comp_ptr - comp_buf, 1, 1, 0); - } } - finalize_row(lineno, model, width, offset, ydpi, xdpi, prn); lineno++; - } /* ! * End of "$Id: print-escp2.c,v 1.12 1999/12/16 19:44:01 olofk Exp $". */ --- 2134,2205 ---- unsigned char *M) { static int lineno = 0; ! static unsigned char s[4][3072]; ! static unsigned char comp_buf[3072]; unsigned char *comp_ptr; ! int i, j; ! unsigned char *cols[6]; ! cols[0] = k; ! cols[1] = m; ! cols[2] = c; ! cols[3] = y; ! cols[4] = M; ! cols[5] = C; initialize_row(lineno, width); ! for (j = 0; j < 6; j++) { ! if (cols[j]) { ! if (vertical_subpasses > 1) { ! switch (oversample) ! { ! case 2: ! escp2_unpack_2(length, cols[j], s[0], s[1]); ! break; ! case 4: ! escp2_unpack_4(length, cols[j], s[0], s[1], s[2], s[3]); ! break; ! } ! switch (vertical_subpasses / oversample) ! { ! case 4: ! escp2_split_4(length, cols[j], s[0], s[1], s[2], s[3]); ! break; ! case 2: ! if (oversample == 1) ! { ! escp2_split_2(length, cols[j], s[0], s[1]); ! } ! else ! { ! escp2_split_2(length, s[1], s[1], s[3]); ! escp2_split_2(length, s[0], s[0], s[2]); ! } ! break; ! } ! for (i = 0; i < vertical_subpasses; i++) ! { ! escp2_pack(s[i], ((length + oversample - 1) / oversample), ! comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, ! colors[j], densities[j], i); ! } } else { ! escp2_pack(cols[j], length, comp_buf, &comp_ptr); ! add_to_row(lineno, comp_buf, comp_ptr - comp_buf, ! colors[j], densities[j], 0); } } } finalize_row(lineno, model, width, offset, ydpi, xdpi, prn); lineno++; } /* ! * End of "$Id: print-escp2.c,v 1.39.2.1 2000/01/13 03:32:34 rlk Exp $". */ diff -rc print/print-pcl.c /tmp/print/print-pcl.c *** print/print-pcl.c Thu Dec 16 14:44:01 1999 --- /tmp/print/print-pcl.c Sat Jan 8 18:30:56 2000 *************** *** 1,9 **** /* ! * "$Id: print-pcl.c,v 1.12 1999/12/16 19:44:01 olofk Exp $" * * Print plug-in HP PCL driver for the GIMP. * ! * Copyright 1997-1999 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it --- 1,9 ---- /* ! * "$Id: print-pcl.c,v 1.14 2000/01/08 23:30:56 rlk Exp $" * * Print plug-in HP PCL driver for the GIMP. * ! * Copyright 1997-2000 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it *************** *** 32,77 **** * Revision History: * * $Log: print-pcl.c,v $ ! * Revision 1.12 1999/12/16 19:44:01 olofk ! * Thu Dec 16 20:15:25 CET 1999 Olof S Kylande <olof@xxxxxxxx> ! * ! * Fix of KDE/Kwm selection add/sub/inter problem ! * NOTE: This is a workaround, not a real fix. ! * Many Thanks to Matthias Ettrich ! * ! * * app/disp_callbacks.c ! * ! * Updated unsharp-mask to version 0.10 ! * ! * * plug-ins/unsharp/dialog_f.c ! * * plug-ins/unsharp/dialog_f.h ! * * plug-ins/unsharp/dialog_i.c ! * * plug-ins/unsharp/dialog_i.h ! * * plug-ins/unsharp/unsharp.c ! * ! * Updated print plug-in to version 3.0.1 ! * ! * * plug-ins/print/README (new file) ! * * plug-ins/print/print-escp2.c ! * * plug-ins/print/print-pcl.c ! * * plug-ins/print/print-ps.c ! * * plug-ins/print/print-util.c ! * * plug-ins/print/print.c ! * * plug-ins/print/print.h ! * ! * Updated all files in the help/C/dialogs dir. This is ! * a first alpha glimpse of the help system. Please give ! * me feedback of the content. However since it's in alpha ! * stage it means that there is spell, grammatical, etc errors. ! * There is may also be pure errors which I hope "you" will ! * report to either olof@xxxxxxxx or karin@xxxxxxxxx Please ! * don't report spell, grammatical, etc error at this stage in dev. ! * ! * If you have any plans to commit to the help system please write ! * to olof@xxxxxxxxx (This is mandatory not a please ;-). ! * ! * * help/C/welcome.html ! * * help/C/dialogs/about.html .............. * * Revision 1.13 1999/11/23 02:11:37 rlk * Rationalize variables, pass 3 --- 32,39 ---- * Revision History: * * $Log: print-pcl.c,v $ ! * Revision 1.14 2000/01/08 23:30:56 rlk ! * Y2K copyright * * Revision 1.13 1999/11/23 02:11:37 rlk * Rationalize variables, pass 3 *************** *** 1227,1231 **** /* ! * End of "$Id: print-pcl.c,v 1.12 1999/12/16 19:44:01 olofk Exp $". */ --- 1189,1193 ---- /* ! * End of "$Id: print-pcl.c,v 1.14 2000/01/08 23:30:56 rlk Exp $". */ diff -rc print/print-ps.c /tmp/print/print-ps.c *** print/print-ps.c Wed Jan 12 21:51:31 2000 --- /tmp/print/print-ps.c Sat Jan 8 18:30:56 2000 *************** *** 1,9 **** /* ! * "$Id: print-ps.c,v 1.16 1999/12/19 20:28:15 asbjoer Exp $" * * Print plug-in Adobe PostScript driver for the GIMP. * ! * Copyright 1997-1999 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it --- 1,9 ---- /* ! * "$Id: print-ps.c,v 1.12 2000/01/08 23:30:56 rlk Exp $" * * Print plug-in Adobe PostScript driver for the GIMP. * ! * Copyright 1997-2000 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it *************** *** 33,81 **** * Revision History: * * $Log: print-ps.c,v $ ! * Revision 1.16 1999/12/19 20:28:15 asbjoer ! * use g_strcasecmp() * ! * Revision 1.15 1999/12/16 19:44:01 olofk ! * Thu Dec 16 20:15:25 CET 1999 Olof S Kylande <olof@xxxxxxxx> ! * ! * Fix of KDE/Kwm selection add/sub/inter problem ! * NOTE: This is a workaround, not a real fix. ! * Many Thanks to Matthias Ettrich ! * ! * * app/disp_callbacks.c ! * ! * Updated unsharp-mask to version 0.10 ! * ! * * plug-ins/unsharp/dialog_f.c ! * * plug-ins/unsharp/dialog_f.h ! * * plug-ins/unsharp/dialog_i.c ! * * plug-ins/unsharp/dialog_i.h ! * * plug-ins/unsharp/unsharp.c ! * ! * Updated print plug-in to version 3.0.1 ! * ! * * plug-ins/print/README (new file) ! * * plug-ins/print/print-escp2.c ! * * plug-ins/print/print-pcl.c ! * * plug-ins/print/print-ps.c ! * * plug-ins/print/print-util.c ! * * plug-ins/print/print.c ! * * plug-ins/print/print.h ! * ! * Updated all files in the help/C/dialogs dir. This is ! * a first alpha glimpse of the help system. Please give ! * me feedback of the content. However since it's in alpha ! * stage it means that there is spell, grammatical, etc errors. ! * There is may also be pure errors which I hope "you" will ! * report to either olof@xxxxxxxx or karin@xxxxxxxxx Please ! * don't report spell, grammatical, etc error at this stage in dev. ! * ! * If you have any plans to commit to the help system please write ! * to olof@xxxxxxxxx (This is mandatory not a please ;-). ! * ! * * help/C/welcome.html ! * * help/C/dialogs/about.html .............. * * Revision 1.10 1999/11/23 02:11:37 rlk * Rationalize variables, pass 3 --- 33,43 ---- * Revision History: * * $Log: print-ps.c,v $ ! * Revision 1.12 2000/01/08 23:30:56 rlk ! * Y2K copyright * ! * Revision 1.11 2000/01/03 13:25:13 rlk ! * Fix from Salvador Pinto Abreu <spa@xxxxxxxxxxxxxxxxxxxxxxxxxx> * * Revision 1.10 1999/11/23 02:11:37 rlk * Rationalize variables, pass 3 *************** *** 477,486 **** if (sscanf(line, "*%s %[^/:]", lname, loption) != 2) continue; ! if (g_strcasecmp(lname, name) == 0) { ! valptrs[(*count)] = malloc(strlen(media_sizes[*count]) + 1); ! strcpy(valptrs[(*count)], media_sizes[*count]); (*count) ++; } } --- 439,448 ---- if (sscanf(line, "*%s %[^/:]", lname, loption) != 2) continue; ! if (strcasecmp(lname, name) == 0) { ! valptrs[(*count)] = malloc(strlen(loption) + 1); ! strcpy(valptrs[(*count)], loption); (*count) ++; } } *************** *** 1156,1162 **** if (line[0] != '*') continue; ! if (g_strncasecmp(line, "*OrderDependency:", 17) == 0 && order != NULL) { sscanf(line, "%*s%d", order); continue; --- 1118,1124 ---- if (line[0] != '*') continue; ! if (strncasecmp(line, "*OrderDependency:", 17) == 0 && order != NULL) { sscanf(line, "%*s%d", order); continue; *************** *** 1164,1171 **** else if (sscanf(line, "*%s %[^/:]", lname, loption) != 2) continue; ! if (g_strcasecmp(lname, name) == 0 && ! g_strcasecmp(loption, option) == 0) { opt = strchr(line, ':') + 1; while (*opt == ' ' || *opt == '\t') --- 1126,1133 ---- else if (sscanf(line, "*%s %[^/:]", lname, loption) != 2) continue; ! if (strcasecmp(lname, name) == 0 && ! strcasecmp(loption, option) == 0) { opt = strchr(line, ':') + 1; while (*opt == ' ' || *opt == '\t') *************** *** 1198,1202 **** /* ! * End of "$Id: print-ps.c,v 1.16 1999/12/19 20:28:15 asbjoer Exp $". */ --- 1160,1164 ---- /* ! * End of "$Id: print-ps.c,v 1.12 2000/01/08 23:30:56 rlk Exp $". */ diff -rc print/print-util.c /tmp/print/print-util.c *** print/print-util.c Thu Dec 16 14:44:01 1999 --- /tmp/print/print-util.c Thu Jan 13 18:41:29 2000 *************** *** 1,9 **** /* ! * "$Id: print-util.c,v 1.11 1999/12/16 19:44:01 olofk Exp $" * * Print plug-in driver utility functions for the GIMP. * ! * Copyright 1997-1999 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it --- 1,9 ---- /* ! * "$Id: print-util.c,v 1.49.2.1 2000/01/13 23:41:29 rlk Exp $" * * Print plug-in driver utility functions for the GIMP. * ! * Copyright 1997-2000 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it *************** *** 38,83 **** * Revision History: * * $Log: print-util.c,v $ ! * Revision 1.11 1999/12/16 19:44:01 olofk ! * Thu Dec 16 20:15:25 CET 1999 Olof S Kylande <olof@xxxxxxxx> * ! * Fix of KDE/Kwm selection add/sub/inter problem ! * NOTE: This is a workaround, not a real fix. ! * Many Thanks to Matthias Ettrich ! * ! * * app/disp_callbacks.c ! * ! * Updated unsharp-mask to version 0.10 ! * ! * * plug-ins/unsharp/dialog_f.c ! * * plug-ins/unsharp/dialog_f.h ! * * plug-ins/unsharp/dialog_i.c ! * * plug-ins/unsharp/dialog_i.h ! * * plug-ins/unsharp/unsharp.c ! * ! * Updated print plug-in to version 3.0.1 ! * ! * * plug-ins/print/README (new file) ! * * plug-ins/print/print-escp2.c ! * * plug-ins/print/print-pcl.c ! * * plug-ins/print/print-ps.c ! * * plug-ins/print/print-util.c ! * * plug-ins/print/print.c ! * * plug-ins/print/print.h ! * ! * Updated all files in the help/C/dialogs dir. This is ! * a first alpha glimpse of the help system. Please give ! * me feedback of the content. However since it's in alpha ! * stage it means that there is spell, grammatical, etc errors. ! * There is may also be pure errors which I hope "you" will ! * report to either olof@xxxxxxxx or karin@xxxxxxxxx Please ! * don't report spell, grammatical, etc error at this stage in dev. * ! * If you have any plans to commit to the help system please write ! * to olof@xxxxxxxxx (This is mandatory not a please ;-). * ! * * help/C/welcome.html ! * * help/C/dialogs/about.html .............. * * Revision 1.37 1999/12/05 23:24:08 rlk * don't want PRINT_LUT in release --- 38,83 ---- * Revision History: * * $Log: print-util.c,v $ ! * Revision 1.49.2.1 2000/01/13 23:41:29 rlk ! * Deal with null black pointer * ! * Revision 1.49 2000/01/08 23:30:37 rlk ! * Some tweaking * ! * Revision 1.48 1999/12/30 23:58:07 rlk ! * Silly little bug... * ! * Revision 1.47 1999/12/26 19:02:46 rlk ! * Performance stuff ! * ! * Revision 1.46 1999/12/25 17:47:17 rlk ! * Cleanup ! * ! * Revision 1.45 1999/12/25 00:41:01 rlk ! * some minor improvement ! * ! * Revision 1.44 1999/12/24 12:57:38 rlk ! * Reduce grain; improve red ! * ! * Revision 1.43 1999/12/22 03:24:34 rlk ! * round length up, not down ! * ! * Revision 1.42 1999/12/22 03:12:17 rlk ! * More constant fiddling ! * ! * Revision 1.41 1999/12/22 01:34:28 rlk ! * Reverse direction each pass ! * ! * Revision 1.40 1999/12/18 23:45:07 rlk ! * typo ! * ! * Revision 1.39 1999/12/12 20:49:01 rlk ! * Various changes ! * ! * Revision 1.38 1999/12/11 23:12:06 rlk ! * Better matching between cmy/k ! * ! * Smoother dither! * * Revision 1.37 1999/12/05 23:24:08 rlk * don't want PRINT_LUT in release *************** *** 335,341 **** xstep = src_width / dst_width; xmod = src_width % dst_width; ! length = (dst_width) / 8; kerror0 = error[row & 1][3]; kerror1 = error[1 - (row & 1)][3]; --- 335,341 ---- xstep = src_width / dst_width; xmod = src_width % dst_width; ! length = (dst_width + 7) / 8; kerror0 = error[row & 1][3]; kerror1 = error[1 - (row & 1)][3]; *************** *** 411,437 **** */ #define NU_C 1 ! #define DE_C 3 #define NU_M 1 ! #define DE_M 3 #define NU_Y 1 ! #define DE_Y 3 #define I_RATIO_C NU_C / DE_C #define I_RATIO_C1 NU_C / (DE_C + NU_C) #define RATIO_C DE_C / NU_C #define RATIO_C1 (DE_C + NU_C) / NU_C #define I_RATIO_M NU_M / DE_M #define I_RATIO_M1 NU_M / (DE_M + NU_M) #define RATIO_M DE_M / NU_M #define RATIO_M1 (DE_M + NU_M) / NU_M #define I_RATIO_Y NU_Y / DE_Y #define I_RATIO_Y1 NU_Y / (DE_Y + NU_Y) #define RATIO_Y DE_Y / NU_Y #define RATIO_Y1 (DE_Y + NU_Y) / NU_Y /* * Lower and upper bounds for mixing CMY with K to produce gray scale. * Reducing KDARKNESS_LOWER results in more black being used with relatively --- 411,446 ---- */ #define NU_C 1 ! #define DE_C 1 #define NU_M 1 ! #define DE_M 1 #define NU_Y 1 ! #define DE_Y 1 #define I_RATIO_C NU_C / DE_C #define I_RATIO_C1 NU_C / (DE_C + NU_C) #define RATIO_C DE_C / NU_C #define RATIO_C1 (DE_C + NU_C) / NU_C + const static int C_CONST_0 = 65536 * I_RATIO_C1; + const static int C_CONST_1 = 65536 * I_RATIO_C1; + #define I_RATIO_M NU_M / DE_M #define I_RATIO_M1 NU_M / (DE_M + NU_M) #define RATIO_M DE_M / NU_M #define RATIO_M1 (DE_M + NU_M) / NU_M + const static int M_CONST_0 = 65536 * I_RATIO_M1; + const static int M_CONST_1 = 65536 * I_RATIO_M1; + #define I_RATIO_Y NU_Y / DE_Y #define I_RATIO_Y1 NU_Y / (DE_Y + NU_Y) #define RATIO_Y DE_Y / NU_Y #define RATIO_Y1 (DE_Y + NU_Y) / NU_Y + const static int Y_CONST_0 = 65536 * I_RATIO_Y1; + const static int Y_CONST_1 = 65536 * I_RATIO_Y1; + /* * Lower and upper bounds for mixing CMY with K to produce gray scale. * Reducing KDARKNESS_LOWER results in more black being used with relatively *************** *** 439,446 **** * in more CMY being used in dark tones, which results in less pure black. * Decreasing the gap too much results in sharp crossover and stairstepping. */ ! #define KDARKNESS_LOWER (32 * 256) ! #define KDARKNESS_UPPER (96 * 256) /* * Randomizing values for deciding when to output a bit. Normally with the --- 448,455 ---- * in more CMY being used in dark tones, which results in less pure black. * Decreasing the gap too much results in sharp crossover and stairstepping. */ ! #define KDARKNESS_LOWER (12 * 256) ! #define KDARKNESS_UPPER (128 * 256) /* * Randomizing values for deciding when to output a bit. Normally with the *************** *** 450,459 **** * result in greater randomizing. We use less randomness for black output * to avoid production of black speckles in light regions. */ ! #define C_RANDOMIZER 2 ! #define M_RANDOMIZER 2 ! #define Y_RANDOMIZER 2 ! #define K_RANDOMIZER 8 #ifdef PRINT_DEBUG #define UPDATE_COLOR_DBG(r) \ --- 459,468 ---- * result in greater randomizing. We use less randomness for black output * to avoid production of black speckles in light regions. */ ! #define C_RANDOMIZER 0 ! #define M_RANDOMIZER 0 ! #define Y_RANDOMIZER 0 ! #define K_RANDOMIZER 4 #ifdef PRINT_DEBUG #define UPDATE_COLOR_DBG(r) \ *************** *** 482,503 **** I_RATIO_##R##1); \ } while (0) ! #define PRINT_D3(r, R, d1, d2) \ do { \ ! fprintf(dbg, "Case 2: o" #r " %lld " #r \ " %lld ditherbit" #d1 " %d ditherbit" #d2 " %d " \ ! "num %lld den %lld test1 %lld test2 %lld\n", \ ! o##r, r, ditherbit##d1, ditherbit##d2, \ ! o##r, 65536ll, \ ! ((32767 + (((long long) ditherbit##d2 / 1) - 32768)) * o##r / \ ! 65536), cutoff); \ ! } while (0) ! ! #define PRINT_D4(r, R, d1, d2) \ ! do { \ ! fprintf(dbg, "Case 3: o" #r " %lld " #r \ ! " %lld ditherbit" #d1 " %d ditherbit" #d2 " %d " \ ! "num %lld den %lld test1 %lld test2 %lld\n", \ o##r, r, ditherbit##d1, ditherbit##d2, \ o##r, 65536ll, \ ((32767 + (((long long) ditherbit##d2 / 1) - 32768)) * o##r / \ --- 491,501 ---- I_RATIO_##R##1); \ } while (0) ! #define PRINT_D3(n, r, R, d1, d2) \ do { \ ! fprintf(dbg, "Case %d: o" #r " %lld " #r \ " %lld ditherbit" #d1 " %d ditherbit" #d2 " %d " \ ! "num %lld den %lld test1 %lld test2 %lld\n", n, \ o##r, r, ditherbit##d1, ditherbit##d2, \ o##r, 65536ll, \ ((32767 + (((long long) ditherbit##d2 / 1) - 32768)) * o##r / \ *************** *** 509,516 **** #define UPDATE_COLOR_DBG(r) do {} while (0) #define PRINT_D1(r, R, d1, d2) do {} while (0) #define PRINT_D2(r, R, d1, d2) do {} while (0) ! #define PRINT_D3(r, R, d1, d2) do {} while (0) ! #define PRINT_D4(r, R, d1, d2) do {} while (0) #endif --- 507,513 ---- #define UPDATE_COLOR_DBG(r) do {} while (0) #define PRINT_D1(r, R, d1, d2) do {} while (0) #define PRINT_D2(r, R, d1, d2) do {} while (0) ! #define PRINT_D3(n, r, R, d1, d2) do {} while (0) #endif *************** *** 521,623 **** UPDATE_COLOR_DBG(r); \ } while (0) ! #define PRINT_COLOR(color, r, R, d1, d2) \ ! do { \ ! if (!l##color) \ ! { \ ! if (r > (32767 + (((long long) ditherbit##d2 / R##_RANDOMIZER) - \ ! (32768 / R##_RANDOMIZER)))) \ ! { \ ! PRINT_D1(r, R, d1, d2); \ ! if (r##bits++ % horizontal_overdensity == 0) \ ! if (! (*kptr & bit)) \ ! *r##ptr |= bit; \ ! r -= 65535; \ ! } \ ! } \ ! else \ ! { \ ! if (r <= (65536 * I_RATIO_##R##1 * 2 / 3)) \ ! { \ ! if (r > (32767 + (((long long) ditherbit##d2 / R##_RANDOMIZER) - \ ! (32768 / R##_RANDOMIZER))) * I_RATIO_##R##1) \ ! { \ ! PRINT_D2(r, R, d1, d2); \ ! if (l##r##bits++ % horizontal_overdensity == 0) \ ! if (! (*kptr & bit)) \ ! *l##r##ptr |= bit; \ ! r -= 65535 * I_RATIO_##R##1; \ ! } \ ! } \ ! else if (r > (32767 + (((long long) ditherbit##d2 / R##_RANDOMIZER) - \ ! (32768 / R##_RANDOMIZER))) * I_RATIO_##R##1) \ ! { \ ! int cutoff = ((density - (65536 * I_RATIO_##R##1 * 2 / 3)) * \ ! 65536 / (65536 - (65536 * I_RATIO_##R##1 * 2 / 3))); \ ! long long sub = (65535ll * I_RATIO_##R##1) + \ ! ((65535ll - (65535ll * I_RATIO_##R##1)) * cutoff / 65536); \ ! if (ditherbit##d1 > cutoff) \ ! { \ ! PRINT_D3(r, R, d1, d2); \ ! if (l##r##bits++ % horizontal_overdensity == 0) \ ! if (! (*kptr & bit)) \ ! *l##r##ptr |= bit; \ ! } \ ! else \ ! { \ ! PRINT_D4(r, R, d1, d2); \ ! if (r##bits++ % horizontal_overdensity == 0) \ ! if (! (*kptr & bit)) \ ! *r##ptr |= bit; \ ! } \ ! if (sub < (65535 * I_RATIO_##R##1)) \ ! r -= (65535 * I_RATIO_##R##1); \ ! else if (sub > 65535) \ ! r -= 65535; \ ! else \ ! r -= sub; \ ! } \ ! } \ ! } while (0) ! ! #if 1 ! #define UPDATE_DITHER(r, d2, x, width) \ do { \ ! if (ditherbit##d2 & bit) \ { \ ! if (x > 0) \ ! r##error1[-1] += r; \ ! else \ ! r##error1[0] = r; \ ! r##error1[0] += 3 * r; \ ! r##error1[1] = r; \ ! dither##r = r##error0[1] + 3 * r; \ } \ ! else \ ! { \ ! if (x > 0) \ ! r##error1[-1] += r * 3 / 4; \ ! else \ ! r##error1[0] = r * 3 / 4; \ ! r##error1[0] += r * 3 / 2; \ ! r##error1[1] = r * 3 / 4; \ ! dither##r = r##error0[1] + 5 * r; \ ! } \ ! } while (0) #else ! #define UPDATE_DITHER(r, d2, x, width) \ ! do { \ ! if (ditherbit##d2 & bit) \ ! { \ ! r##error1[0] = 5 * r; \ ! dither##r = r##error0[1] + 3 * r; \ ! } \ ! else \ ! { \ ! r##error1[0] = 3 * r; \ ! dither##r = r##error0[1] + 5 * r; \ ! } \ ! } while (0) #endif void --- 518,624 ---- UPDATE_COLOR_DBG(r); \ } while (0) ! #define DO_PRINT_COLOR(color) \ do { \ ! if (color##bits++ == horizontal_overdensity) \ { \ ! *color##ptr |= bit; \ ! color##bits = 1; \ } \ ! } while(0) ! ! #define PRINT_COLOR(color, r, R, d1, d2) \ ! do { \ ! int comp0 = (32767 + ((ditherbit##d2 >> R##_RANDOMIZER) - \ ! (32768 >> R##_RANDOMIZER))); \ ! if (!l##color) \ ! { \ ! if (r > comp0) \ ! { \ ! PRINT_D1(r, R, d1, d2); \ ! DO_PRINT_COLOR(r); \ ! r -= 65535; \ ! } \ ! } \ ! else \ ! { \ ! int compare = comp0 * I_RATIO_##R##1; \ ! if (r <= (R##_CONST_1)) \ ! { \ ! if (r > compare) \ ! { \ ! PRINT_D2(r, R, d1, d2); \ ! DO_PRINT_COLOR(l##r); \ ! r -= R##_CONST_0; \ ! } \ ! } \ ! else if (r > compare) \ ! { \ ! int cutoff = ((density - R##_CONST_1) * 65536 / \ ! (65536 - R##_CONST_1)); \ ! long long sub; \ ! if (cutoff >= 0) \ ! sub = R##_CONST_0 + (((65535ll - R##_CONST_0) * cutoff) >> 16); \ ! else \ ! sub = R##_CONST_0 + ((65535ll - R##_CONST_0) * cutoff / 65536); \ ! if (ditherbit##d1 > cutoff) \ ! { \ ! PRINT_D3(3, r, R, d1, d2); \ ! DO_PRINT_COLOR(l##r); \ ! } \ ! else \ ! { \ ! PRINT_D3(4, r, R, d1, d2); \ ! DO_PRINT_COLOR(r); \ ! } \ ! if (sub < R##_CONST_0) \ ! r -= R##_CONST_0; \ ! else if (sub > 65535) \ ! r -= 65535; \ ! else \ ! r -= sub; \ ! } \ ! } \ ! } while (0) ! ! #if 1 ! #define UPDATE_DITHER(r, d2, x, width) \ ! do { \ ! int offset = (15 - (((o##r & 0xf000) >> 12)) * horizontal_overdensity) \ ! >> 1; \ ! if (x < offset) \ ! offset = x; \ ! else if (x > dst_width - offset - 1) \ ! offset = dst_width - x - 1; \ ! if (ditherbit##d2 & bit) \ ! { \ ! r##error1[-offset] += r; \ ! r##error1[0] += 3 * r; \ ! r##error1[offset] += r; \ ! dither##r = r##error0[direction] + 3 * r; \ ! } \ ! else \ ! { \ ! r##error1[-offset] += r; \ ! r##error1[0] += r; \ ! r##error1[offset] += r; \ ! dither##r = r##error0[direction] + 5 * r; \ ! } \ ! } while (0) #else ! #define UPDATE_DITHER(r, d2, x, width) \ ! do { \ ! if (ditherbit##d2 & bit) \ ! { \ ! r##error1[0] = 5 * r; \ ! dither##r = r##error0[direction] + 3 * r; \ ! } \ ! else \ ! { \ ! r##error1[0] = 3 * r; \ ! dither##r = r##error0[direction] + 5 * r; \ ! } \ ! } while (0) #endif void *************** *** 678,696 **** * at zero each line to avoid having a line of bits near the edge of the * image. */ ! static int cbits = 0; ! static int mbits = 0; ! static int ybits = 0; ! static int kbits = 0; ! static int lcbits = 0; ! static int lmbits = 0; ! static int lybits = 0; #ifdef PRINT_DEBUG long long odk, odc, odm, ody, dk, dc, dm, dy, xk, xc, xm, xy, yc, ym, yy; FILE *dbg; #endif xstep = 3 * (src_width / dst_width); xmod = src_width % dst_width; length = (dst_width + 7) / 8; --- 679,722 ---- * at zero each line to avoid having a line of bits near the edge of the * image. */ ! static int cbits = 1; ! static int mbits = 1; ! static int ybits = 1; ! static int kbits = 1; ! static int lcbits = 1; ! static int lmbits = 1; ! static int lybits = 1; ! int overdensity_bits = 0; #ifdef PRINT_DEBUG long long odk, odc, odm, ody, dk, dc, dm, dy, xk, xc, xm, xy, yc, ym, yy; FILE *dbg; #endif + int terminate; + int direction = row & 1 ? 1 : -1; + + switch (horizontal_overdensity) + { + case 0: + case 1: + overdensity_bits = 0; + break; + case 2: + overdensity_bits = 1; + break; + case 4: + overdensity_bits = 2; + break; + case 8: + overdensity_bits = 3; + break; + } + + bit = (direction == 1) ? 128 : 1 << (7 - ((dst_width - 1) & 7)); + x = (direction == 1) ? 0 : dst_width - 1; + terminate = (direction == 1) ? dst_width : -1; + xstep = 3 * (src_width / dst_width); xmod = src_width % dst_width; length = (dst_width + 7) / 8; *************** *** 706,711 **** --- 732,775 ---- kerror0 = error[row & 1][3]; kerror1 = error[1 - (row & 1)][3]; + memset(kerror1, 0, dst_width * sizeof(int)); + memset(cerror1, 0, dst_width * sizeof(int)); + memset(merror1, 0, dst_width * sizeof(int)); + memset(yerror1, 0, dst_width * sizeof(int)); + cptr = cyan; + mptr = magenta; + yptr = yellow; + lcptr = lcyan; + lmptr = lmagenta; + lyptr = lyellow; + kptr = black; + xerror = 0; + if (direction == -1) + { + cerror0 += dst_width - 1; + cerror1 += dst_width - 1; + merror0 += dst_width - 1; + merror1 += dst_width - 1; + yerror0 += dst_width - 1; + yerror1 += dst_width - 1; + kerror0 += dst_width - 1; + kerror1 += dst_width - 1; + cptr = cyan + length - 1; + if (lcptr) + lcptr = lcyan + length - 1; + mptr = magenta + length - 1; + if (lmptr) + lmptr = lmagenta + length - 1; + yptr = yellow + length - 1; + if (lyptr) + lyptr = lyellow + length - 1; + if (kptr) + kptr = black + length - 1; + xstep = -xstep; + rgb += 3 * (src_width - 1); + xerror = ((dst_width - 1) * xmod) % dst_width; + xmod = -xmod; + } memset(cyan, 0, length); if (lcyan) *************** *** 726,735 **** /* * Main loop starts here! */ ! for (x = 0, bit = 128, ! cptr = cyan, mptr = magenta, yptr = yellow, lcptr = lcyan, ! lmptr = lmagenta, lyptr = lyellow, kptr = black, xerror = 0, ! ditherbit = rand(), ditherc = cerror0[0], ditherm = merror0[0], dithery = yerror0[0], ditherk = kerror0[0], ditherbit0 = ditherbit & 0xffff, --- 790,796 ---- /* * Main loop starts here! */ ! for (ditherbit = rand(), ditherc = cerror0[0], ditherm = merror0[0], dithery = yerror0[0], ditherk = kerror0[0], ditherbit0 = ditherbit & 0xffff, *************** *** 738,746 **** ((ditherbit & 0x100) << 7)), ditherbit3 = (((ditherbit >> 24) & 0x7f) + ((ditherbit & 1) << 7) + ((ditherbit >> 8) & 0xff00)); ! x < dst_width; ! x ++, cerror0 ++, cerror1 ++, merror0 ++, merror1 ++, yerror0 ++, ! yerror1 ++, kerror0 ++, kerror1 ++) { /* --- 799,814 ---- ((ditherbit & 0x100) << 7)), ditherbit3 = (((ditherbit >> 24) & 0x7f) + ((ditherbit & 1) << 7) + ((ditherbit >> 8) & 0xff00)); ! x != terminate; ! x += direction, ! cerror0 += direction, ! cerror1 += direction, ! merror0 += direction, ! merror1 += direction, ! yerror0 += direction, ! yerror1 += direction, ! kerror0 += direction, ! kerror1 += direction) { /* *************** *** 775,788 **** * Since we're printing black, adjust the black level based upon * the amount of color in the pixel (colorful pixels get less black)... */ ! long long xdiff = (abs(c - m) + abs(c - y) + abs(m - y)) / 3; diff = 65536 - xdiff; ! diff = diff * diff * diff / (65536ll * 65536ll); /* diff = diff^3 */ diff--; if (diff < 0) diff = 0; ! k = diff * k / 65535ll; ak = k; divk = 65535 - k; if (divk == 0) --- 843,856 ---- * Since we're printing black, adjust the black level based upon * the amount of color in the pixel (colorful pixels get less black)... */ ! int xdiff = (abs(c - m) + abs(c - y) + abs(m - y)) / 3; diff = 65536 - xdiff; ! diff = (diff * diff * diff) >> 32; /* diff = diff^3 */ diff--; if (diff < 0) diff = 0; ! k = (diff * k) >> 16; ak = k; divk = 65535 - k; if (divk == 0) *************** *** 794,802 **** * CMY as necessary to give better blues, greens, and reds... :) */ ! c = (65535 - (unsigned) rgb[1] / 4) * (c - k) / divk; ! m = (65535 - (unsigned) rgb[2] / 4) * (m - k) / divk; ! y = (65535 - (unsigned) rgb[0] / 4) * (y - k) / divk; } #ifdef PRINT_DEBUG yc = c; --- 862,870 ---- * CMY as necessary to give better blues, greens, and reds... :) */ ! c = (65535 - ((rgb[2] + rgb[1]) >> 3)) * (c - k) / divk; ! m = (65535 - ((rgb[1] + rgb[0]) >> 3)) * (m - k) / divk; ! y = (65535 - ((rgb[0] + rgb[2]) >> 3)) * (y - k) / divk; } #ifdef PRINT_DEBUG yc = c; *************** *** 811,827 **** */ ok = k; nk = k + (ditherk) / 8; ! kdarkness = MAX((c + c / 3 + m + 2 * y / 3) / 4, ak); ! /* ! kdarkness = ak; ! */ if (kdarkness < KDARKNESS_UPPER) { int rb; - /* - ub = KDARKNESS_UPPER - kdarkness; - lb = ub * KDARKNESS_LOWER / KDARKNESS_UPPER; - */ ub = KDARKNESS_UPPER; lb = KDARKNESS_LOWER; rb = ub - lb; --- 879,889 ---- */ ok = k; nk = k + (ditherk) / 8; ! kdarkness = MAX((c + ((c + c + c) >> 3) + m + ! ((y + y + y + y + y) >> 3)) >> 2, ak); if (kdarkness < KDARKNESS_UPPER) { int rb; ub = KDARKNESS_UPPER; lb = KDARKNESS_LOWER; rb = ub - lb; *************** *** 866,874 **** */ if (lmagenta) { ! c += ck * 10 / 8; ! m += ck * 19 / 16; ! y += ck * 3 / 2; } else { --- 928,937 ---- */ if (lmagenta) { ! int addon = 2 * ck; ! c += addon; ! m += addon; ! y += addon; } else { *************** *** 890,925 **** odk = ditherk; dk = k; #endif ! if (k > (32767 + ((ditherbit0 / K_RANDOMIZER) - (32768 / K_RANDOMIZER)))) { ! if (kbits++ % horizontal_overdensity == 0) ! *kptr |= bit; k -= 65535; } UPDATE_DITHER(k, 1, x, src_width); - #if 0 - if (ditherbit0 & bit) - { - if (x > 0) - kerror1[-1] += k; - else - kerror1[0] = k; - kerror1[0] += 2 * k; - kerror1[1] = k; - ditherk = kerror0[1] + 3 * k; - } - else - { - if (x > 0) - kerror1[-1] += k / 2; - else - kerror1[0] = k / 2; - kerror1[0] += k; - kerror1[1] = k / 2; - ditherk = kerror0[1] + 5 * k; - } - #endif } else { --- 953,966 ---- odk = ditherk; dk = k; #endif ! if (k > (32767 + ((ditherbit0 >> K_RANDOMIZER) - ! (32768 >> K_RANDOMIZER)))) { ! DO_PRINT_COLOR(k); k -= 65535; } UPDATE_DITHER(k, 1, x, src_width); } else { *************** *** 934,964 **** y = (65535 - rgb[0] / 4) * (y - k) / 65535 + k; } ! UPDATE_COLOR(c); UPDATE_COLOR(m); UPDATE_COLOR(y); ! density = (c + m + y) / horizontal_overdensity; ! /***************************************************************** ! * Cyan ! *****************************************************************/ ! if (! (*kptr & bit)) ! PRINT_COLOR(cyan, c, C, 1, 2); ! UPDATE_DITHER(c, 2, x, dst_width); ! /***************************************************************** ! * Magenta ! *****************************************************************/ ! if (! (*kptr & bit)) ! PRINT_COLOR(magenta, m, M, 2, 3); UPDATE_DITHER(m, 3, x, dst_width); - - /***************************************************************** - * Yellow - *****************************************************************/ - if (! (*kptr & bit)) - PRINT_COLOR(yellow, y, Y, 3, 0); UPDATE_DITHER(y, 0, x, dst_width); /***************************************************************** --- 975,996 ---- y = (65535 - rgb[0] / 4) * (y - k) / 65535 + k; } ! density = (c + m + y) >> overdensity_bits; UPDATE_COLOR(c); UPDATE_COLOR(m); UPDATE_COLOR(y); ! density += (c + m + y) >> overdensity_bits; ! /* density >>= 1; */ ! if (!kptr || !(*kptr & bit)) ! { ! PRINT_COLOR(cyan, c, C, 1, 2); ! PRINT_COLOR(magenta, m, M, 2, 3); ! PRINT_COLOR(yellow, y, Y, 3, 0); ! } ! UPDATE_DITHER(c, 2, x, dst_width); UPDATE_DITHER(m, 3, x, dst_width); UPDATE_DITHER(y, 0, x, dst_width); /***************************************************************** *************** *** 984,1040 **** (black && (*kptr & bit)) ? 'k' : ' ', odk, odc, odm, ody, kdarkness, ck, bk, nk, ub, lb); #endif ! ! if (bit == 1) { ! cptr ++; ! if (lcptr) ! lcptr ++; ! mptr ++; ! if (lmptr) ! lmptr ++; ! yptr ++; ! if (lyptr) ! lyptr ++; ! if (kptr) ! kptr ++; ! ditherbit = rand(); ! ditherbit0 = ditherbit & 0xffff; ! ditherbit1 = ((ditherbit >> 8) & 0xffff); ! ditherbit2 = ((ditherbit >> 16) & 0x7fff) + ((ditherbit & 0x100) << 7); ! ditherbit3 = ((ditherbit >> 24) & 0x7f) + ((ditherbit & 1) << 7) + ! ((ditherbit >> 8) & 0xff00); ! bit = 128; } else { ! ditherbit = rand(); ! ditherbit0 = ditherbit & 0xffff; ! ditherbit1 = ((ditherbit >> 8) & 0xffff); ! ditherbit2 = ((ditherbit >> 16) & 0x7fff) + ((ditherbit & 0x100) << 7); ! ditherbit3 = ((ditherbit >> 24) & 0x7f) + ((ditherbit & 1) << 7) + ! ((ditherbit >> 8) & 0xff00); ! #if 0 ! int dithertmp0 = (ditherbit1 >> 14) ^ ((ditherbit3 &0x3fff) << 2); ! int dithertmp1 = (ditherbit2 >> 14) ^ ((ditherbit2 &0x3fff) << 2); ! int dithertmp2 = (ditherbit3 >> 14) ^ ((ditherbit1 &0x3fff) << 2); ! int dithertmp3 = (ditherbit0 >> 14) ^ ((ditherbit0 &0x3fff) << 2); ! ditherbit0 = dithertmp0; ! ditherbit1 = dithertmp1; ! ditherbit2 = dithertmp2; ! ditherbit3 = dithertmp3; ! #endif ! bit >>= 1; } rgb += xstep; xerror += xmod; if (xerror >= dst_width) ! { ! xerror -= dst_width; ! rgb += 3; ! } } /* * Main loop ends here! --- 1016,1085 ---- (black && (*kptr & bit)) ? 'k' : ' ', odk, odc, odm, ody, kdarkness, ck, bk, nk, ub, lb); + fprintf(dbg, "x %d dir %d c %x %x m %x %x y %x %x k %x %x rgb %x bit %x\n", + x, direction, cptr, cyan, mptr, magenta, yptr, yellow, kptr, black, + rgb, bit); #endif ! ! ditherbit = rand(); ! ditherbit0 = ditherbit & 0xffff; ! ditherbit1 = ((ditherbit >> 8) & 0xffff); ! ditherbit2 = ((ditherbit >> 16) & 0x7fff) + ((ditherbit & 0x100) << 7); ! ditherbit3 = ((ditherbit >> 24) & 0x7f) + ((ditherbit & 1) << 7) + ! ((ditherbit >> 8) & 0xff00); ! if (direction == 1) { ! if (bit == 1) ! { ! cptr ++; ! if (lcptr) ! lcptr ++; ! mptr ++; ! if (lmptr) ! lmptr ++; ! yptr ++; ! if (lyptr) ! lyptr ++; ! if (kptr) ! kptr ++; ! bit = 128; ! } ! else ! bit >>= 1; } else { ! if (bit == 128) ! { ! cptr --; ! if (lcptr) ! lcptr --; ! mptr --; ! if (lmptr) ! lmptr --; ! yptr --; ! if (lyptr) ! lyptr --; ! if (kptr) ! kptr --; ! bit = 1; ! } ! else ! bit <<= 1; } rgb += xstep; xerror += xmod; if (xerror >= dst_width) ! { ! xerror -= dst_width; ! rgb += 3 * direction; ! } ! else if (xerror < 0) ! { ! xerror += dst_width; ! rgb += 3 * direction; ! } } /* * Main loop ends here! *************** *** 1990,2061 **** pow(green_pixel, print_gamma)); blue_pixel = 256.0 * (256.0 - 256.0 * pow(blue_pixel, print_gamma)); - #if 0 - if (red > 1.0) - red_pixel = 65536.0 + ((pixel - 65536.0) / red); - else - red_pixel = pixel * red; - if (green > 1.0) - green_pixel = 65536.0 + ((pixel - 65536.0) / green); - else - green_pixel = pixel * green; - if (blue > 1.0) - blue_pixel = 65536.0 + ((pixel - 65536.0) / blue); - else - blue_pixel = pixel * blue; - #endif if (pixel <= 0.0) ! { ! lut->composite[i] = 0; ! } else if (pixel >= 65535.0) ! { ! lut->composite[i] = 65535; ! } else ! { ! lut->composite[i] = (unsigned)(pixel + 0.5); ! } if (red_pixel <= 0.0) ! { ! lut->red[i] = 0; ! } else if (red_pixel >= 65535.0) ! { ! lut->red[i] = 65535; ! } else ! { ! lut->red[i] = (unsigned)(red_pixel + 0.5); ! } if (green_pixel <= 0.0) ! { ! lut->green[i] = 0; ! } else if (green_pixel >= 65535.0) ! { ! lut->green[i] = 65535; ! } else ! { ! lut->green[i] = (unsigned)(green_pixel + 0.5); ! } if (blue_pixel <= 0.0) ! { ! lut->blue[i] = 0; ! } else if (blue_pixel >= 65535.0) ! { ! lut->blue[i] = 65535; ! } else ! { ! lut->blue[i] = (unsigned)(blue_pixel + 0.5); ! } } #ifdef PRINT_LUT fprintf(ltfile, "%3i %5d %5d %5d %5d %f %f %f %f %f %f %f %f\n", --- 2035,2068 ---- pow(green_pixel, print_gamma)); blue_pixel = 256.0 * (256.0 - 256.0 * pow(blue_pixel, print_gamma)); if (pixel <= 0.0) ! lut->composite[i] = 0; else if (pixel >= 65535.0) ! lut->composite[i] = 65535; else ! lut->composite[i] = (unsigned)(pixel); if (red_pixel <= 0.0) ! lut->red[i] = 0; else if (red_pixel >= 65535.0) ! lut->red[i] = 65535; else ! lut->red[i] = (unsigned)(red_pixel); if (green_pixel <= 0.0) ! lut->green[i] = 0; else if (green_pixel >= 65535.0) ! lut->green[i] = 65535; else ! lut->green[i] = (unsigned)(green_pixel); if (blue_pixel <= 0.0) ! lut->blue[i] = 0; else if (blue_pixel >= 65535.0) ! lut->blue[i] = 65535; else ! lut->blue[i] = (unsigned)(blue_pixel); } #ifdef PRINT_LUT fprintf(ltfile, "%3i %5d %5d %5d %5d %f %f %f %f %f %f %f %f\n", *************** *** 2546,2550 **** #endif /* ! * End of "$Id: print-util.c,v 1.11 1999/12/16 19:44:01 olofk Exp $". */ --- 2553,2557 ---- #endif /* ! * End of "$Id: print-util.c,v 1.49.2.1 2000/01/13 23:41:29 rlk Exp $". */ diff -rc print/print.c /tmp/print/print.c *** print/print.c Wed Jan 12 21:51:31 2000 --- /tmp/print/print.c Thu Jan 13 18:40:41 2000 *************** *** 1,9 **** /* ! * "$Id: print.c,v 1.25 1999/12/30 18:54:16 neo Exp $" * * Print plug-in for the GIMP. * ! * Copyright 1997-1999 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it --- 1,9 ---- /* ! * "$Id: print.c,v 1.38.2.2 2000/01/13 23:40:41 rlk Exp $" * * Print plug-in for the GIMP. * ! * Copyright 1997-2000 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it *************** *** 47,52 **** --- 47,56 ---- /* * All Gimp-specific code is in this file. */ + #include <gtk/gtk.h> + #include <libgimp/gimp.h> + #define PLUG_IN_VERSION "3.0.5 - 13 Jan 2000" + #define PLUG_IN_NAME "Print" #include <math.h> #include <signal.h> *************** *** 56,63 **** #include <os2.h> #endif ! #include "libgimp/gimpui.h" ! #include "libgimp/stdplugins-intl.h" /* * Constants for GUI... --- 60,97 ---- #include <os2.h> #endif ! #include <libgimp/gimpui.h> ! #if 0 ! #include <libgimp/stdplugins-intl.h> ! #else ! #include <libgimp/gimpintl.h> ! #include <locale.h> ! ! #ifndef LOCALEDIR ! #define LOCALEDIR g_strconcat (gimp_data_directory (), \ ! G_DIR_SEPARATOR_S, \ ! "locale", \ ! NULL) ! #endif ! #ifdef HAVE_LC_MESSAGES ! #define INIT_I18N() \ ! setlocale(LC_MESSAGES, ""); \ ! bindtextdomain("gimp-std-plugins", LOCALEDIR); \ ! textdomain("gimp-std-plugins") ! #define INIT_I18N_UI() \ ! gtk_set_locale(); \ ! setlocale (LC_NUMERIC, "C"); \ ! INIT_I18N(); ! #else ! #define INIT_I18N() \ ! bindtextdomain("gimp-std-plugins", LOCALEDIR); \ ! textdomain("gimp-std-plugins") ! #define INIT_I18N_UI() \ ! gtk_set_locale(); \ ! setlocale (LC_NUMERIC, "C"); \ ! INIT_I18N(); ! #endif ! #endif /* * Constants for GUI... *************** *** 236,242 **** escp2_parameters, default_media_size, escp2_imageable_area, escp2_print }, { N_("EPSON Stylus Photo EX"), "escp2-ex", 1, 7, 0.585, 0.646, escp2_parameters, default_media_size, escp2_imageable_area, escp2_print }, ! { N_("EPSON Stylus Photo EX"), "escp2-photo", 1, 8, 0.585, 0.646, escp2_parameters, default_media_size, escp2_imageable_area, escp2_print }, }; --- 270,276 ---- escp2_parameters, default_media_size, escp2_imageable_area, escp2_print }, { N_("EPSON Stylus Photo EX"), "escp2-ex", 1, 7, 0.585, 0.646, escp2_parameters, default_media_size, escp2_imageable_area, escp2_print }, ! { N_("EPSON Stylus Photo"), "escp2-photo", 1, 8, 0.585, 0.646, escp2_parameters, default_media_size, escp2_imageable_area, escp2_print }, }; *************** *** 797,803 **** * Top-level table for dialog... */ ! table = gtk_table_new(9, 4, FALSE); gtk_container_border_width(GTK_CONTAINER(table), 6); gtk_table_set_col_spacings(GTK_TABLE(table), 4); gtk_table_set_row_spacings(GTK_TABLE(table), 8); --- 831,837 ---- * Top-level table for dialog... */ ! table = gtk_table_new(17, 4, FALSE); gtk_container_border_width(GTK_CONTAINER(table), 6); gtk_table_set_col_spacings(GTK_TABLE(table), 4); gtk_table_set_row_spacings(GTK_TABLE(table), 8); *************** *** 956,961 **** --- 990,1004 ---- gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); gtk_widget_show(button); + label = gtk_label_new(_("Density:")); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_table_attach(GTK_TABLE(table), label, 2, 3, 7, 8, GTK_FILL, GTK_FILL, 0, 0); + gtk_widget_show(label); + + box = gtk_hbox_new(FALSE, 8); + gtk_table_attach(GTK_TABLE(table), box, 3, 4, 7, 8, GTK_FILL, GTK_FILL, 0, 0); + gtk_widget_show(box); + linear_off = button = gtk_radio_button_new_with_label(NULL, _("Normal scale")); linear_group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); if (vars.linear == 0) *************** *** 966,972 **** gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); gtk_widget_show(button); ! linear_on = button = gtk_radio_button_new_with_label(linear_group, _("Linear scale")); if (vars.linear == 1) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_signal_connect(GTK_OBJECT(button), "toggled", --- 1009,1015 ---- gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); gtk_widget_show(button); ! linear_on = button = gtk_radio_button_new_with_label(linear_group, _("Experimental linear scale")); if (vars.linear == 1) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_signal_connect(GTK_OBJECT(button), "toggled", *************** *** 981,991 **** label = gtk_label_new(_("Scaling:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 7, 8, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 7, 8, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); if (vars.scaling < 0.0) --- 1024,1034 ---- label = gtk_label_new(_("Scaling:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 8, 9, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 8, 9, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); if (vars.scaling < 0.0) *************** *** 1037,1047 **** label = gtk_label_new(_("Brightness:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 8, 9, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 8, 9, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); brightness_adjustment = scale_data = --- 1080,1090 ---- label = gtk_label_new(_("Brightness:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 9, 10, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 9, 10, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); brightness_adjustment = scale_data = *************** *** 1072,1082 **** label = gtk_label_new(_("Gamma:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 9, 10, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 9, 10, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); gamma_adjustment = scale_data = --- 1115,1125 ---- label = gtk_label_new(_("Gamma:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 10, 11, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 10, 11, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); gamma_adjustment = scale_data = *************** *** 1115,1124 **** label = gtk_label_new(_("Contrast:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 10, 11, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 10, 11, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); contrast_adjustment = scale_data = --- 1158,1167 ---- label = gtk_label_new(_("Contrast:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 11, 12, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 11, 12, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); contrast_adjustment = scale_data = *************** *** 1149,1159 **** label = gtk_label_new(_("Red:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 11, 12, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 11, 12, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); red_adjustment = scale_data = --- 1192,1202 ---- label = gtk_label_new(_("Red:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 12, 13, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 12, 13, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); red_adjustment = scale_data = *************** *** 1184,1194 **** label = gtk_label_new(_("Green:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 12, 13, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 12, 13, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); green_adjustment = scale_data = --- 1227,1237 ---- label = gtk_label_new(_("Green:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 13, 14, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 13, 14, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); green_adjustment = scale_data = *************** *** 1219,1229 **** label = gtk_label_new(_("Blue:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 13, 14, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 13, 14, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); blue_adjustment = scale_data = --- 1262,1272 ---- label = gtk_label_new(_("Blue:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 14, 15, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 14, 15, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); blue_adjustment = scale_data = *************** *** 1254,1264 **** label = gtk_label_new(_("Saturation:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 14, 15, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 14, 15, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); saturation_adjustment = scale_data = --- 1297,1307 ---- label = gtk_label_new(_("Saturation:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 15, 16, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 15, 16, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); saturation_adjustment = scale_data = *************** *** 1289,1299 **** label = gtk_label_new(_("Density:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 15, 16, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 15, 16, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); density_adjustment = scale_data = --- 1332,1342 ---- label = gtk_label_new(_("Density:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); ! gtk_table_attach(GTK_TABLE(table), label, 0, 1, 16, 17, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(label); box = gtk_hbox_new(FALSE, 8); ! gtk_table_attach(GTK_TABLE(table), box, 1, 4, 16, 17, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(box); density_adjustment = scale_data = *************** *** 1367,1379 **** * Print, cancel buttons... */ - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 2); gtk_box_set_homogeneous(GTK_BOX(GTK_DIALOG(dialog)->action_area), FALSE); ! ! hbbox = gtk_hbutton_box_new (); ! gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4); ! gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->action_area), hbbox, FALSE,FALSE, 0); ! gtk_widget_show (hbbox); button = gtk_button_new_with_label (_("Print")); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); --- 1410,1417 ---- * Print, cancel buttons... */ gtk_box_set_homogeneous(GTK_BOX(GTK_DIALOG(dialog)->action_area), FALSE); ! gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->action_area), 0); button = gtk_button_new_with_label (_("Print")); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); *************** *** 3166,3173 **** for (i = 1; i <= pnum; i++) { sprintf(plist[plist_count].name, "LPT%d:", i); ! sprintf(plist[plist_count].v.output_to, "PRINT /D:LPT%d /B ", i); ! strcpy(plist[plist_count].v.driver, "ps2"); initialize_printer(&plist[plist_count]); plist_count ++; } --- 3204,3211 ---- for (i = 1; i <= pnum; i++) { sprintf(plist[plist_count].name, "LPT%d:", i); ! sprintf(plist[plist_count].output_to, "PRINT /D:LPT%d /B ", i); ! strcpy(plist[plist_count].driver, "ps2"); initialize_printer(&plist[plist_count]); plist_count ++; } *************** *** 3259,3263 **** } /* ! * End of "$Id: print.c,v 1.25 1999/12/30 18:54:16 neo Exp $". */ --- 3297,3301 ---- } /* ! * End of "$Id: print.c,v 1.38.2.2 2000/01/13 23:40:41 rlk Exp $". */ diff -rc print/print.h /tmp/print/print.h *** print/print.h Wed Jan 12 21:51:32 2000 --- /tmp/print/print.h Wed Jan 12 22:17:11 2000 *************** *** 1,8 **** /* * * Print plug-in header file for the GIMP. * ! * Copyright 1997-1999 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it --- 1,9 ---- /* + * "$Id: print.h,v 1.22 2000/01/13 03:17:11 rlk Exp $" * * Print plug-in header file for the GIMP. * ! * Copyright 1997-2000 Michael Sweet (mike@xxxxxxxxxx) and * Robert Krawitz (rlk@xxxxxxxxxxxx) * * This program is free software; you can redistribute it and/or modify it *************** *** 25,33 **** */ /* * Include necessary header files... */ ! #include "config.h" #include <stdio.h> #include <stdlib.h> --- 26,47 ---- */ /* + * + * This file must not include any gimp, glib, gtk, etc. headers. + * + * Eventually I intend to port this to GhostScript and/or CUPS. The only + * file that should have GIMP-specific code is print.c. The rest of this + * program should be completely generic. + * + * rlk 20000112 + */ + + /* * Include necessary header files... */ ! #ifndef HAVE_UNISTD_H ! #define HAVE_UNISTD_H ! #endif #include <stdio.h> #include <stdlib.h> *************** *** 39,55 **** #include <unistd.h> #endif - #include <gtk/gtk.h> - #include <libgimp/gimp.h> - - /* * Constants... */ - - #define PLUG_IN_VERSION "3.0.1 - 05 Dec 1999" - #define PLUG_IN_NAME "Print" #define OUTPUT_GRAY 0 /* Grayscale output */ #define OUTPUT_COLOR 1 /* Color output */ --- 53,62 ---- *************** *** 229,231 **** --- 236,241 ---- lut_t *, unsigned char *, float); #endif + /* + * End of "$Id: print.h,v 1.22 2000/01/13 03:17:11 rlk Exp $". + */