diff options
author | Didier Raboud <odyx@debian.org> | 2016-11-01 18:45:10 +0100 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2016-11-01 18:45:10 +0100 |
commit | 54a135b87201e48d4da4894a61b81a8c6fe46d26 (patch) | |
tree | 74b42137b1e3eb634c01cb593469dddc727cd124 /src/main | |
parent | d69d392d8c45cdcc93e58f0e1bdbb2b66d6b9566 (diff) |
New upstream version 5.2.12~pre4
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/canon-printers.h | 28 | ||||
-rw-r--r-- | src/main/color.c | 3 | ||||
-rw-r--r-- | src/main/path.c | 40 | ||||
-rw-r--r-- | src/main/print-canon.c | 10 | ||||
-rw-r--r-- | src/main/print-olympus.c | 2266 |
5 files changed, 1556 insertions, 791 deletions
diff --git a/src/main/canon-printers.h b/src/main/canon-printers.h index 91bfaac..59c847c 100644 --- a/src/main/canon-printers.h +++ b/src/main/canon-printers.h @@ -51,7 +51,7 @@ typedef struct canon_caps { int ESC_l_len; /* length of ESC (l command, in bytes */ int ESC_P_len; /* length of ESC (P command, in bytes */ int CassetteTray_Opts; /* upper/lower cassette tray option */ - const char** control_cmdlist; + const char* const* control_cmdlist; const canon_modelist_t* modelist; const canon_paperlist_t* paperlist; const canon_modeuselist_t* modeuselist; @@ -196,12 +196,12 @@ static const char MP450_hue_adjustment[] = "</curve>\n" "</gutenprint>\n"; -static const char* control_cmd_ackshort[] = { +static const char* const control_cmd_ackshort[] = { "AckTime=Short", NULL }; -static const char* control_cmd_PIXMA_iP4000[] = { +static const char* const control_cmd_PIXMA_iP4000[] = { /*"SetTime=20060722092503", */ /*what is this for?*/ "SetSilent=OFF", "PEdgeDetection=ON", @@ -209,44 +209,44 @@ static const char* control_cmd_PIXMA_iP4000[] = { NULL }; -static const char* control_cmd_BJC_i550[] = { +static const char* const control_cmd_BJC_i550[] = { /*"SetTime=20060722092503", */ /*what is this for?*/ "SetSilent=OFF", "SelectParallel=ECP", NULL }; -static const char* control_cmd_BJC_i6100[] = { +static const char* const control_cmd_BJC_i6100[] = { /*"SetTime=20060722092503", */ /*what is this for?*/ "SelectParallel=ECP", NULL }; -static const char* control_cmd_PIXMA_iP4200[] = { +static const char* const control_cmd_PIXMA_iP4200[] = { /*"SetTime=20060722092503", */ /*original driver sends current time, is it needed?*/ "SetSilent=OFF", "PEdgeDetection=ON", NULL }; -static const char* control_cmd_PIXMA_iP2700[] = { +static const char* const control_cmd_PIXMA_iP2700[] = { /*"SetTime=20060722092503", */ /*what is this for?*/ "SetSilent=OFF", NULL }; -static const char* control_cmd_PIXMA_MG5300[] = { +static const char* const control_cmd_PIXMA_MG5300[] = { /*"SetTime=20060722092503", */ /*what is this for?*/ NULL }; -static const char* control_cmd_PIXMA_MG3500[] = { +static const char* const control_cmd_PIXMA_MG3500[] = { /*"SetTime=20060722092503", */ /*what is this for?*/ "ForcePWDetection=OFF", NULL }; -static const char* control_cmd_PIXMA_MG5600[] = { +static const char* const control_cmd_PIXMA_MG5600[] = { /*"SetTime=20060722092503", */ /*what is this for?*/ "ForcePMDetection=OFF", NULL @@ -638,7 +638,7 @@ static const canon_cap_t canon_model_capabilities[] = 10, 10, 9, 20, /* for A4 from user manual */ &canon_default_slotlist, CANON_CAP_STD0 | CANON_CAP_a | CANON_CAP_cart,0, - 2,0, + 3,0, 0, /* Upper/Lower Cassette option */ NULL,/* only SetTime */ &canon_BJC_2100_modelist, @@ -3767,7 +3767,7 @@ static const canon_cap_t canon_model_capabilities[] = INCH(17/2), 1917, /* max paper width and height assumed */ 10, 10, 9, 15, /*border_left, border_right, border_top, border_bottom */ &canon_MAXIFY_iB4000_slotlist, - CANON_CAP_STD0|CANON_CAP_px|CANON_CAP_P|CANON_CAP_I|CANON_CAP_v|CANON_CAP_XML,0, + CANON_CAP_STD0|CANON_CAP_px|CANON_CAP_P|CANON_CAP_I|CANON_CAP_v|CANON_CAP_XML|CANON_CAP_DUPLEX,0, 3,9, /* ESC (l and (P command lengths */ 0, /* Upper/Lower Cassette option */ control_cmd_PIXMA_MG5300, /*features*/ @@ -3786,7 +3786,7 @@ static const canon_cap_t canon_model_capabilities[] = INCH(17/2), 1917, /* max paper width and height assumed */ 10, 10, 9, 15, /*border_left, border_right, border_top, border_bottom */ &canon_MULTIPASS_MX7600_slotlist, - CANON_CAP_STD0|CANON_CAP_px|CANON_CAP_P|CANON_CAP_I|CANON_CAP_v|CANON_CAP_XML,0, + CANON_CAP_STD0|CANON_CAP_px|CANON_CAP_P|CANON_CAP_I|CANON_CAP_v|CANON_CAP_XML|CANON_CAP_DUPLEX,0, 3,9, /* ESC (l and (P command lengths */ 0, /* Upper/Lower Cassette option */ control_cmd_PIXMA_MG5300, /*features*/ @@ -3805,7 +3805,7 @@ static const canon_cap_t canon_model_capabilities[] = INCH(17/2), 1917, /* max paper width and height assumed */ 10, 10, 9, 15, /*border_left, border_right, border_top, border_bottom */ &canon_MAXIFY_iB4000_slotlist, - CANON_CAP_STD0|CANON_CAP_px|CANON_CAP_P|CANON_CAP_I|CANON_CAP_v|CANON_CAP_XML,0, + CANON_CAP_STD0|CANON_CAP_px|CANON_CAP_P|CANON_CAP_I|CANON_CAP_v|CANON_CAP_XML|CANON_CAP_DUPLEX,0, 3,9, /* ESC (l and (P command lengths */ 0, /* Upper/Lower Cassette option */ control_cmd_PIXMA_MG5300, /*features*/ diff --git a/src/main/color.c b/src/main/color.c index e6f16c3..fc614b1 100644 --- a/src/main/color.c +++ b/src/main/color.c @@ -43,8 +43,7 @@ static stp_list_t *color_list = NULL; static int stpi_init_color_list(void) { - if(color_list) - stp_list_destroy(color_list); + STPI_ASSERT(color_list == NULL, NULL); color_list = stp_list_create(); stp_list_set_namefunc(color_list, stpi_color_namefunc); stp_list_set_long_namefunc(color_list, stpi_color_long_namefunc); diff --git a/src/main/path.c b/src/main/path.c index 2f06a1b..ecd193a 100644 --- a/src/main/path.c +++ b/src/main/path.c @@ -31,17 +31,17 @@ #include <sys/stat.h> #include <unistd.h> -static int stpi_path_check(const struct dirent *module); +static int stpi_path_check(const struct dirent *module, + const char *path, + const char *suffix); static int stpi_scandir (const char *dir, struct dirent ***namelist, - int (*sel) (const struct dirent *), + const char *path, + const char *suffix, + int (*sel) (const struct dirent *, const char *, + const char *), int (*cmp) (const void *, const void *)); -/* WARNING: This is not thread safe! -- rlk 20030721 */ -static const char *path_check_path; /* Path for stpi_scandir() callback */ -static const char *path_check_suffix; /* Suffix for stpi_scandir() callback */ - - static int dirent_sort(const void *a, const void *b) @@ -67,8 +67,6 @@ stp_path_search(stp_list_t *dirlist, /* List of directories to search */ if (!dirlist) return NULL; - path_check_suffix = suffix; - findlist = stp_list_create(); if (!findlist) return NULL; @@ -77,11 +75,12 @@ stp_path_search(stp_list_t *dirlist, /* List of directories to search */ diritem = stp_list_get_start(dirlist); while (diritem) { - path_check_path = (const char *) stp_list_item_get_data(diritem); + const char *check_path = (const char *) stp_list_item_get_data(diritem); stp_deprintf(STP_DBG_PATH, "stp-path: directory: %s\n", (const char *) stp_list_item_get_data(diritem)); n = stpi_scandir ((const char *) stp_list_item_get_data(diritem), - &module_dir, stpi_path_check, dirent_sort); + &module_dir, check_path, suffix, + stpi_path_check, dirent_sort); if (n >= 0) { int idx; @@ -105,7 +104,9 @@ stp_path_search(stp_list_t *dirlist, /* List of directories to search */ * correct mode bits and suffix. */ static int -stpi_path_check(const struct dirent *module) /* File to check */ +stpi_path_check(const struct dirent *module, /* File to check */ + const char *check_path, /* Path to search */ + const char *check_suffix) /* Suffix */ { int namelen; /* Filename length */ int status = 0; /* Error status */ @@ -116,21 +117,20 @@ stpi_path_check(const struct dirent *module) /* File to check */ savederr = errno; /* since we are a callback, preserve stpi_scandir() state */ - filename = stpi_path_merge(path_check_path, module->d_name); + filename = stpi_path_merge(check_path, module->d_name); namelen = strlen(filename); /* make sure we can take off suffix (e.g. .la) and still have a sane filename */ - if (namelen >= strlen(path_check_suffix) + 1) + if (namelen >= strlen(check_suffix) + 1) { if (!stat (filename, &modstat)) { /* check file exists, and is a regular file */ if (S_ISREG(modstat.st_mode)) status = 1; - if (strncmp(filename + (namelen - strlen(path_check_suffix)), - path_check_suffix, - strlen(path_check_suffix))) + if (strncmp(filename + (namelen - strlen(check_suffix)), + check_suffix, strlen(check_suffix))) { status = 0; } @@ -267,7 +267,9 @@ stp_path_split(stp_list_t *list, /* List to add directories to */ static int stpi_scandir (const char *dir, struct dirent ***namelist, - int (*sel) (const struct dirent *), + const char *path, + const char *suffix, + int (*sel) (const struct dirent *, const char *path, const char *suffix), int (*cmp) (const void *, const void *)) { DIR *dp = opendir (dir); @@ -284,7 +286,7 @@ stpi_scandir (const char *dir, i = 0; while ((d = readdir (dp)) != NULL) - if (sel == NULL || (*sel) (d)) + if (sel == NULL || (*sel) (d, path, suffix)) { struct dirent *vnew; size_t dsize; diff --git a/src/main/print-canon.c b/src/main/print-canon.c index 3a76c01..89c7fff 100644 --- a/src/main/print-canon.c +++ b/src/main/print-canon.c @@ -4608,11 +4608,19 @@ canon_init_setESC_P(const stp_vars_t *v, const canon_privdata_t *init) if ( init->caps->ESC_P_len == 9 ) /* support for new devices from October 2012. */ {/* the 4th of the 6 bytes is the media type. 2nd byte is media size. Both read from canon-media array. */ - + + if ( !(strcmp(init->caps->name,"PIXMA MG7700")) ) { + /* output with 3 extra 0s at the end */ + canon_cmd( v,ESC28,0x50,12,0x00,arg_ESCP_1,0x00,arg_ESCP_2,0x01,0x00,0x01,0x00,arg_ESCP_9,0x00,0x00,0x00); + } + else { + /* arg_ESCP_1 = 0x03; */ /* A4 size */ /* arg_ESCP_2 = 0x00; */ /* plain media */ /* size media tray */ canon_cmd( v,ESC28,0x50,9,0x00,arg_ESCP_1,0x00,arg_ESCP_2,0x01,0x00,0x01,0x00,arg_ESCP_9); + + } } else if ( init->caps->ESC_P_len == 8 ) /* support for new devices from 2012. */ {/* the 4th of the 6 bytes is the media type. 2nd byte is media size. Both read from canon-media array. */ diff --git a/src/main/print-olympus.c b/src/main/print-olympus.c index ad26726..73dfa67 100644 --- a/src/main/print-olympus.c +++ b/src/main/print-olympus.c @@ -59,6 +59,8 @@ #define DYESUB_PORTRAIT 0 #define DYESUB_LANDSCAPE 1 +#define MITSU70X_8BPP + #ifndef MIN # define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif /* !MIN */ @@ -171,8 +173,29 @@ typedef struct { size_t n_items; } dyesub_stringlist_t; -#define NPUTC_BUFSIZE (4096) +/* Private data for some of the major dyesub driver families */ +typedef struct +{ + int multicut; +} dnp_privdata_t; + +typedef struct +{ + int quality; + int finedeep; +} mitsu9550_privdata_t; + +typedef struct +{ + int quality; + int laminate_offset; +#ifdef MITSU70X_8BPP + int use_lut; +#endif + int sharpen; +} mitsu70x_privdata_t; +/* Private data for dyesub driver as a whole */ typedef struct { int w_dpi, h_dpi; @@ -188,11 +211,13 @@ typedef struct int bpp; const char* duplex_mode; int page_number; - char nputc_buf[NPUTC_BUFSIZE]; + union { + dnp_privdata_t dnp; + mitsu9550_privdata_t m9550; + mitsu70x_privdata_t m70x; + } privdata; } dyesub_privdata_t; -static dyesub_privdata_t privdata; - typedef struct { int out_channels; int ink_channels; @@ -227,9 +252,7 @@ typedef struct /* printer specific parameters */ void (*plane_end_func)(stp_vars_t *); void (*block_init_func)(stp_vars_t *); void (*block_end_func)(stp_vars_t *); - const char *adj_cyan; /* default color adjustment */ - const char *adj_magenta; - const char *adj_yellow; + void (*adjust_curves)(stp_vars_t *); const laminate_list_t *laminate; const dyesub_media_list_t *media; void (*job_start_func)(stp_vars_t *); @@ -237,7 +260,7 @@ typedef struct /* printer specific parameters */ const stp_parameter_t *parameters; int parameter_count; int (*load_parameters)(const stp_vars_t *, const char *name, stp_parameter_t *); - void (*parse_parameters)(stp_vars_t *); + int (*parse_parameters)(stp_vars_t *); } dyesub_cap_t; @@ -245,7 +268,15 @@ static const dyesub_cap_t* dyesub_get_model_capabilities(int model); static const laminate_t* dyesub_get_laminate_pattern(stp_vars_t *v); static const dyesub_media_t* dyesub_get_mediatype(stp_vars_t *v); static void dyesub_nputc(stp_vars_t *v, char byte, int count); +static void dyesub_adjust_curve(stp_vars_t *v, + const char *color_adj, + const char *color_curve); +static dyesub_privdata_t * +get_privdata(stp_vars_t *v) +{ + return (dyesub_privdata_t *) stp_get_component_data(v, "Driver"); +} static const ink_t cmy_inks[] = { @@ -303,8 +334,10 @@ LIST(dyesub_printsize_list_t, p10_printsize_list, dyesub_printsize_t, p10_prints static void p10_printer_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("\033R\033M\033S\2\033N\1\033D\1\033Y", 1, 15, v); - stp_write_raw(&(privdata.laminate->seq), v); /* laminate */ + stp_write_raw(&(pd->laminate->seq), v); /* laminate */ stp_zfwrite("\033Z\0", 1, 3, v); } @@ -315,11 +348,13 @@ static void p10_printer_end_func(stp_vars_t *v) static void p10_block_init_func(stp_vars_t *v) { - stp_zprintf(v, "\033T%c", privdata.plane); - stp_put16_le(privdata.block_min_w, v); - stp_put16_le(privdata.block_min_h, v); - stp_put16_le(privdata.block_max_w + 1, v); - stp_put16_le(privdata.block_max_h + 1, v); + dyesub_privdata_t *pd = get_privdata(v); + + stp_zprintf(v, "\033T%c", pd->plane); + stp_put16_le(pd->block_min_w, v); + stp_put16_le(pd->block_min_h, v); + stp_put16_le(pd->block_max_w + 1, v); + stp_put16_le(pd->block_max_h + 1, v); } static const laminate_t p10_laminate[] = @@ -362,8 +397,10 @@ static void p200_printer_init_func(stp_vars_t *v) static void p200_plane_init_func(stp_vars_t *v) { - stp_zprintf(v, "P0%d9999", 3 - privdata.plane+1 ); - stp_put32_be(privdata.w_size * privdata.h_size, v); + dyesub_privdata_t *pd = get_privdata(v); + + stp_zprintf(v, "P0%d9999", 3 - pd->plane+1 ); + stp_put32_be(pd->w_size * pd->h_size, v); } static void p200_printer_end_func(stp_vars_t *v) @@ -385,6 +422,12 @@ static const char p200_adj_any[] = "</curve>\n" "</gutenprint>\n"; +static void p200_adjust_curves(stp_vars_t *v) +{ + dyesub_adjust_curve(v, p200_adj_any, "CyanCurve"); + dyesub_adjust_curve(v, p200_adj_any, "MagentaCurve"); + dyesub_adjust_curve(v, p200_adj_any, "YellowCurve"); +} /* Olympus P-300 series */ static const dyesub_resolution_t p300_res[] = @@ -415,32 +458,38 @@ LIST(dyesub_printsize_list_t, p300_printsize_list, dyesub_printsize_t, p300_prin static void p300_printer_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("\033\033\033C\033N\1\033F\0\1\033MS\xff\xff\xff" "\033Z", 1, 19, v); - stp_put16_be(privdata.w_dpi, v); - stp_put16_be(privdata.h_dpi, v); + stp_put16_be(pd->w_dpi, v); + stp_put16_be(pd->h_dpi, v); } static void p300_plane_end_func(stp_vars_t *v) { const char *c = "CMY"; - stp_zprintf(v, "\033\033\033P%cS", c[privdata.plane-1]); + dyesub_privdata_t *pd = get_privdata(v); + + stp_zprintf(v, "\033\033\033P%cS", c[pd->plane-1]); stp_deprintf(STP_DBG_DYESUB, "dyesub: p300_plane_end_func: %c\n", - c[privdata.plane-1]); + c[pd->plane-1]); } static void p300_block_init_func(stp_vars_t *v) { const char *c = "CMY"; - stp_zprintf(v, "\033\033\033W%c", c[privdata.plane-1]); - stp_put16_be(privdata.block_min_h, v); - stp_put16_be(privdata.block_min_w, v); - stp_put16_be(privdata.block_max_h, v); - stp_put16_be(privdata.block_max_w, v); + dyesub_privdata_t *pd = get_privdata(v); + + stp_zprintf(v, "\033\033\033W%c", c[pd->plane-1]); + stp_put16_be(pd->block_min_h, v); + stp_put16_be(pd->block_min_w, v); + stp_put16_be(pd->block_max_h, v); + stp_put16_be(pd->block_max_w, v); stp_deprintf(STP_DBG_DYESUB, "dyesub: p300_block_init_func: %d-%dx%d-%d\n", - privdata.block_min_w, privdata.block_max_w, - privdata.block_min_h, privdata.block_max_h); + pd->block_min_w, pd->block_max_w, + pd->block_min_h, pd->block_max_h); } static const char p300_adj_cyan[] = @@ -482,6 +531,12 @@ static const char p300_adj_yellow[] = "</curve>\n" "</gutenprint>\n"; +static void p300_adjust_curves(stp_vars_t *v) +{ + dyesub_adjust_curve(v, p300_adj_cyan, "CyanCurve"); + dyesub_adjust_curve(v, p300_adj_magenta, "MagentaCurve"); + dyesub_adjust_curve(v, p300_adj_yellow, "YellowCurve"); +} /* Olympus P-400 series */ static const dyesub_resolution_t res_314dpi[] = @@ -513,8 +568,9 @@ LIST(dyesub_printsize_list_t, p400_printsize_list, dyesub_printsize_t, p400_prin static void p400_printer_init_func(stp_vars_t *v) { - int wide = (strcmp(privdata.pagesize, "c8x10") == 0 - || strcmp(privdata.pagesize, "C6") == 0); + dyesub_privdata_t *pd = get_privdata(v); + int wide = (strcmp(pd->pagesize, "c8x10") == 0 + || strcmp(pd->pagesize, "C6") == 0); stp_zprintf(v, "\033ZQ"); dyesub_nputc(v, '\0', 61); stp_zprintf(v, "\033FP"); dyesub_nputc(v, '\0', 61); @@ -523,13 +579,13 @@ static void p400_printer_init_func(stp_vars_t *v) stp_zprintf(v, "\033ZS"); if (wide) { - stp_put16_be(privdata.h_size, v); - stp_put16_be(privdata.w_size, v); + stp_put16_be(pd->h_size, v); + stp_put16_be(pd->w_size, v); } else { - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); } dyesub_nputc(v, '\0', 57); stp_zprintf(v, "\033ZP"); dyesub_nputc(v, '\0', 61); @@ -547,23 +603,24 @@ static void p400_plane_end_func(stp_vars_t *v) static void p400_block_init_func(stp_vars_t *v) { - int wide = (strcmp(privdata.pagesize, "c8x10") == 0 - || strcmp(privdata.pagesize, "C6") == 0); + dyesub_privdata_t *pd = get_privdata(v); + int wide = (strcmp(pd->pagesize, "c8x10") == 0 + || strcmp(pd->pagesize, "C6") == 0); - stp_zprintf(v, "\033Z%c", '3' - privdata.plane + 1); + stp_zprintf(v, "\033Z%c", '3' - pd->plane + 1); if (wide) { - stp_put16_be(privdata.h_size - privdata.block_max_h - 1, v); - stp_put16_be(privdata.w_size - privdata.block_max_w - 1, v); - stp_put16_be(privdata.block_max_h - privdata.block_min_h + 1, v); - stp_put16_be(privdata.block_max_w - privdata.block_min_w + 1, v); + stp_put16_be(pd->h_size - pd->block_max_h - 1, v); + stp_put16_be(pd->w_size - pd->block_max_w - 1, v); + stp_put16_be(pd->block_max_h - pd->block_min_h + 1, v); + stp_put16_be(pd->block_max_w - pd->block_min_w + 1, v); } else { - stp_put16_be(privdata.block_min_w, v); - stp_put16_be(privdata.block_min_h, v); - stp_put16_be(privdata.block_max_w - privdata.block_min_w + 1, v); - stp_put16_be(privdata.block_max_h - privdata.block_min_h + 1, v); + stp_put16_be(pd->block_min_w, v); + stp_put16_be(pd->block_min_h, v); + stp_put16_be(pd->block_max_w - pd->block_min_w + 1, v); + stp_put16_be(pd->block_max_h - pd->block_min_h + 1, v); } dyesub_nputc(v, '\0', 53); } @@ -607,6 +664,12 @@ static const char p400_adj_yellow[] = "</curve>\n" "</gutenprint>\n"; +static void p400_adjust_curves(stp_vars_t *v) +{ + dyesub_adjust_curve(v, p400_adj_cyan, "CyanCurve"); + dyesub_adjust_curve(v, p400_adj_magenta, "MagentaCurve"); + dyesub_adjust_curve(v, p400_adj_yellow, "YellowCurve"); +} /* Olympus P-440 series */ static const dyesub_pagesize_t p440_page[] = @@ -633,12 +696,13 @@ LIST(dyesub_printsize_list_t, p440_printsize_list, dyesub_printsize_t, p440_prin static void p440_printer_init_func(stp_vars_t *v) { - int wide = ! (strcmp(privdata.pagesize, "A4") == 0 - || strcmp(privdata.pagesize, "Custom") == 0); + dyesub_privdata_t *pd = get_privdata(v); + int wide = ! (strcmp(pd->pagesize, "A4") == 0 + || strcmp(pd->pagesize, "Custom") == 0); stp_zprintf(v, "\033FP"); dyesub_nputc(v, '\0', 61); stp_zprintf(v, "\033Y"); - stp_write_raw(&(privdata.laminate->seq), v); /* laminate */ + stp_write_raw(&(pd->laminate->seq), v); /* laminate */ dyesub_nputc(v, '\0', 61); stp_zprintf(v, "\033FC"); dyesub_nputc(v, '\0', 61); stp_zprintf(v, "\033ZF"); @@ -647,16 +711,16 @@ static void p440_printer_init_func(stp_vars_t *v) stp_zprintf(v, "\033ZS"); if (wide) { - stp_put16_be(privdata.h_size, v); - stp_put16_be(privdata.w_size, v); + stp_put16_be(pd->h_size, v); + stp_put16_be(pd->w_size, v); } else { - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); } dyesub_nputc(v, '\0', 57); - if (strcmp(privdata.pagesize, "C6") == 0) + if (strcmp(pd->pagesize, "C6") == 0) { stp_zprintf(v, "\033ZC"); dyesub_nputc(v, '\0', 61); } @@ -669,35 +733,37 @@ static void p440_printer_end_func(stp_vars_t *v) static void p440_block_init_func(stp_vars_t *v) { - int wide = ! (strcmp(privdata.pagesize, "A4") == 0 - || strcmp(privdata.pagesize, "Custom") == 0); + dyesub_privdata_t *pd = get_privdata(v); + int wide = ! (strcmp(pd->pagesize, "A4") == 0 + || strcmp(pd->pagesize, "Custom") == 0); stp_zprintf(v, "\033ZT"); if (wide) { - stp_put16_be(privdata.h_size - privdata.block_max_h - 1, v); - stp_put16_be(privdata.w_size - privdata.block_max_w - 1, v); - stp_put16_be(privdata.block_max_h - privdata.block_min_h + 1, v); - stp_put16_be(privdata.block_max_w - privdata.block_min_w + 1, v); + stp_put16_be(pd->h_size - pd->block_max_h - 1, v); + stp_put16_be(pd->w_size - pd->block_max_w - 1, v); + stp_put16_be(pd->block_max_h - pd->block_min_h + 1, v); + stp_put16_be(pd->block_max_w - pd->block_min_w + 1, v); } else { - stp_put16_be(privdata.block_min_w, v); - stp_put16_be(privdata.block_min_h, v); - stp_put16_be(privdata.block_max_w - privdata.block_min_w + 1, v); - stp_put16_be(privdata.block_max_h - privdata.block_min_h + 1, v); + stp_put16_be(pd->block_min_w, v); + stp_put16_be(pd->block_min_h, v); + stp_put16_be(pd->block_max_w - pd->block_min_w + 1, v); + stp_put16_be(pd->block_max_h - pd->block_min_h + 1, v); } dyesub_nputc(v, '\0', 53); } static void p440_block_end_func(stp_vars_t *v) { - int pad = (64 - (((privdata.block_max_w - privdata.block_min_w + 1) - * (privdata.block_max_h - privdata.block_min_h + 1) * 3) % 64)) % 64; + dyesub_privdata_t *pd = get_privdata(v); + int pad = (64 - (((pd->block_max_w - pd->block_min_w + 1) + * (pd->block_max_h - pd->block_min_h + 1) * 3) % 64)) % 64; stp_deprintf(STP_DBG_DYESUB, "dyesub: max_x %d min_x %d max_y %d min_y %d\n", - privdata.block_max_w, privdata.block_min_w, - privdata.block_max_h, privdata.block_min_h); + pd->block_max_w, pd->block_min_w, + pd->block_max_h, pd->block_min_h); stp_deprintf(STP_DBG_DYESUB, "dyesub: olympus-p440 padding=%d\n", pad); dyesub_nputc(v, '\0', pad); } @@ -724,6 +790,8 @@ LIST(dyesub_printsize_list_t, ps100_printsize_list, dyesub_printsize_t, ps100_pr static void ps100_printer_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zprintf(v, "\033U"); dyesub_nputc(v, '\0', 62); /* stp_zprintf(v, "\033ZC"); dyesub_nputc(v, '\0', 61); */ @@ -731,8 +799,8 @@ static void ps100_printer_init_func(stp_vars_t *v) stp_zprintf(v, "\033W"); dyesub_nputc(v, '\0', 62); stp_zfwrite("\x30\x2e\x00\xa2\x00\xa0\x00\xa0", 1, 8, v); - stp_put16_be(privdata.h_size, v); /* paper height (px) */ - stp_put16_be(privdata.w_size, v); /* paper width (px) */ + stp_put16_be(pd->h_size, v); /* paper height (px) */ + stp_put16_be(pd->w_size, v); /* paper width (px) */ dyesub_nputc(v, '\0', 3); stp_putc('\1', v); /* number of copies */ dyesub_nputc(v, '\0', 8); @@ -744,19 +812,20 @@ static void ps100_printer_init_func(stp_vars_t *v) stp_zfwrite("\033ZT\0", 1, 4, v); stp_put16_be(0, v); /* image width offset (px) */ stp_put16_be(0, v); /* image height offset (px) */ - stp_put16_be(privdata.w_size, v); /* image width (px) */ - stp_put16_be(privdata.h_size, v); /* image height (px) */ + stp_put16_be(pd->w_size, v); /* image width (px) */ + stp_put16_be(pd->h_size, v); /* image height (px) */ dyesub_nputc(v, '\0', 52); } static void ps100_printer_end_func(stp_vars_t *v) { - int pad = (64 - (((privdata.block_max_w - privdata.block_min_w + 1) - * (privdata.block_max_h - privdata.block_min_h + 1) * 3) % 64)) % 64; + dyesub_privdata_t *pd = get_privdata(v); + int pad = (64 - (((pd->block_max_w - pd->block_min_w + 1) + * (pd->block_max_h - pd->block_min_h + 1) * 3) % 64)) % 64; stp_deprintf(STP_DBG_DYESUB, "dyesub: max_x %d min_x %d max_y %d min_y %d\n", - privdata.block_max_w, privdata.block_min_w, - privdata.block_max_h, privdata.block_min_h); + pd->block_max_w, pd->block_min_w, + pd->block_max_h, pd->block_min_h); stp_deprintf(STP_DBG_DYESUB, "dyesub: olympus-ps100 padding=%d\n", pad); dyesub_nputc(v, '\0', pad); /* padding to 64B blocks */ @@ -814,12 +883,14 @@ static void cp10_printer_init_func(stp_vars_t *v) static void cpx00_printer_init_func(stp_vars_t *v) { - char pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? '\1' : - (strcmp(privdata.pagesize, "w253h337") == 0 ? '\2' : - (strcmp(privdata.pagesize, "w155h244") == 0 ? + dyesub_privdata_t *pd = get_privdata(v); + + char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? '\1' : + (strcmp(pd->pagesize, "w253h337") == 0 ? '\2' : + (strcmp(pd->pagesize, "w155h244") == 0 ? (strcmp(stp_get_driver(v),"canon-cp10") == 0 ? '\0' : '\3' ) : - (strcmp(privdata.pagesize, "w283h566") == 0 ? '\4' : + (strcmp(pd->pagesize, "w283h566") == 0 ? '\4' : '\1' )))); stp_put16_be(0x4000, v); @@ -830,10 +901,12 @@ static void cpx00_printer_init_func(stp_vars_t *v) static void cpx00_plane_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_put16_be(0x4001, v); - stp_putc(3 - privdata.plane, v); + stp_putc(3 - pd->plane, v); stp_putc('\0', v); - stp_put32_le(privdata.w_size * privdata.h_size, v); + stp_put32_le(pd->w_size * pd->h_size, v); dyesub_nputc(v, '\0', 4); } @@ -876,6 +949,12 @@ static const char cpx00_adj_yellow[] = "</curve>\n" "</gutenprint>\n"; +static void cpx00_adjust_curves(stp_vars_t *v) +{ + dyesub_adjust_curve(v, cpx00_adj_cyan, "CyanCurve"); + dyesub_adjust_curve(v, cpx00_adj_magenta, "MagentaCurve"); + dyesub_adjust_curve(v, cpx00_adj_yellow, "YellowCurve"); +} /* Canon CP-220 series */ static const dyesub_pagesize_t cp220_page[] = @@ -901,25 +980,29 @@ LIST(dyesub_printsize_list_t, cp220_printsize_list, dyesub_printsize_t, cp220_pr /* Canon SELPHY CP790 */ static void cp790_printer_init_func(stp_vars_t *v) { - char pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? '\0' : - (strcmp(privdata.pagesize, "w253h337") == 0 ? '\1' : - (strcmp(privdata.pagesize, "w155h244") == 0 ? '\2' : - (strcmp(privdata.pagesize, "w283h566") == 0 ? '\3' : + dyesub_privdata_t *pd = get_privdata(v); + + char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? '\0' : + (strcmp(pd->pagesize, "w253h337") == 0 ? '\1' : + (strcmp(pd->pagesize, "w155h244") == 0 ? '\2' : + (strcmp(pd->pagesize, "w283h566") == 0 ? '\3' : '\0' )))); stp_put16_be(0x4000, v); stp_putc(pg, v); stp_putc('\0', v); dyesub_nputc(v, '\0', 8); - stp_put32_le(privdata.w_size * privdata.h_size, v); + stp_put32_le(pd->w_size * pd->h_size, v); } /* Canon SELPHY ES series */ static void es1_printer_init_func(stp_vars_t *v) { - char pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0x11 : - (strcmp(privdata.pagesize, "w253h337") == 0 ? 0x12 : - (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x13 : 0x11))); + dyesub_privdata_t *pd = get_privdata(v); + + char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x11 : + (strcmp(pd->pagesize, "w253h337") == 0 ? 0x12 : + (strcmp(pd->pagesize, "w155h244") == 0 ? 0x13 : 0x11))); stp_put16_be(0x4000, v); stp_putc(0x10, v); /* 0x20 for P-BW */ @@ -929,9 +1012,11 @@ static void es1_printer_init_func(stp_vars_t *v) static void es1_plane_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + unsigned char plane = 0; - switch (privdata.plane) { + switch (pd->plane) { case 3: /* Y */ plane = 0x01; break; @@ -946,16 +1031,18 @@ static void es1_plane_init_func(stp_vars_t *v) stp_put16_be(0x4001, v); stp_putc(0x1, v); /* 0x02 for P-BW */ stp_putc(plane, v); - stp_put32_le(privdata.w_size * privdata.h_size, v); + stp_put32_le(pd->w_size * pd->h_size, v); dyesub_nputc(v, '\0', 4); } static void es2_printer_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + char pg2 = 0x0; - char pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0x1: - (strcmp(privdata.pagesize, "w253h337") == 0 ? 0x2 : - (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x3 : 0x1))); + char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x1: + (strcmp(pd->pagesize, "w253h337") == 0 ? 0x2 : + (strcmp(pd->pagesize, "w155h244") == 0 ? 0x3 : 0x1))); if (pg == 0x03) pg2 = 0x01; @@ -970,22 +1057,26 @@ static void es2_printer_init_func(stp_vars_t *v) dyesub_nputc(v, 0x0, 3); stp_putc(pg2, v); - stp_put32_le(privdata.w_size * privdata.h_size, v); + stp_put32_le(pd->w_size * pd->h_size, v); } static void es2_plane_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_put16_be(0x4001, v); - stp_putc(4 - privdata.plane, v); + stp_putc(4 - pd->plane, v); stp_putc(0x0, v); dyesub_nputc(v, '\0', 8); } static void es3_printer_init_func(stp_vars_t *v) { - char pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0x1: - (strcmp(privdata.pagesize, "w253h337") == 0 ? 0x2 : - (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x3 : 0x1))); + dyesub_privdata_t *pd = get_privdata(v); + + char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x1: + (strcmp(pd->pagesize, "w253h337") == 0 ? 0x2 : + (strcmp(pd->pagesize, "w155h244") == 0 ? 0x3 : 0x1))); /* We also have Pg and Ps (Gold/Silver) papers on the ES3/30/40 */ @@ -993,7 +1084,7 @@ static void es3_printer_init_func(stp_vars_t *v) stp_putc(pg, v); stp_putc(0x0, v); /* 0x1 for P-BW */ dyesub_nputc(v, 0x0, 8); - stp_put32_le(privdata.w_size * privdata.h_size, v); + stp_put32_le(pd->w_size * pd->h_size, v); } static void es3_printer_end_func(stp_vars_t *v) @@ -1004,9 +1095,11 @@ static void es3_printer_end_func(stp_vars_t *v) static void es40_printer_init_func(stp_vars_t *v) { - char pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0x0: - (strcmp(privdata.pagesize, "w253h337") == 0 ? 0x1 : - (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x2 : 0x0))); + dyesub_privdata_t *pd = get_privdata(v); + + char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x0: + (strcmp(pd->pagesize, "w253h337") == 0 ? 0x1 : + (strcmp(pd->pagesize, "w155h244") == 0 ? 0x2 : 0x0))); /* We also have Pg and Ps (Gold/Silver) papers on the ES3/30/40 */ @@ -1015,7 +1108,7 @@ static void es40_printer_init_func(stp_vars_t *v) stp_putc(0x0, v); /* 0x1 for P-BW */ dyesub_nputc(v, 0x0, 8); - stp_put32_le(privdata.w_size * privdata.h_size, v); + stp_put32_le(pd->w_size * pd->h_size, v); } /* Canon SELPHY CP900 */ @@ -1045,6 +1138,8 @@ LIST(dyesub_printsize_list_t, cp910_printsize_list, dyesub_printsize_t, cp910_pr static void cp910_printer_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + char pg; stp_zfwrite("\x0f\x00\x00\x40\x00\x00\x00\x00", 1, 8, v); @@ -1052,32 +1147,32 @@ static void cp910_printer_init_func(stp_vars_t *v) stp_putc(0x01, v); stp_putc(0x00, v); - pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0x50 : - (strcmp(privdata.pagesize, "w253h337") == 0 ? 0x4c : - (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x43 : + pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x50 : + (strcmp(pd->pagesize, "w253h337") == 0 ? 0x4c : + (strcmp(pd->pagesize, "w155h244") == 0 ? 0x43 : 0x50 ))); stp_putc(pg, v); dyesub_nputc(v, '\0', 5); - pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0xe0 : - (strcmp(privdata.pagesize, "w253h337") == 0 ? 0x80 : - (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x40 : + pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0xe0 : + (strcmp(pd->pagesize, "w253h337") == 0 ? 0x80 : + (strcmp(pd->pagesize, "w155h244") == 0 ? 0x40 : 0xe0 ))); stp_putc(pg, v); stp_putc(0x04, v); dyesub_nputc(v, '\0', 2); - pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0x50 : - (strcmp(privdata.pagesize, "w253h337") == 0 ? 0xc0 : - (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x9c : + pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x50 : + (strcmp(pd->pagesize, "w253h337") == 0 ? 0xc0 : + (strcmp(pd->pagesize, "w155h244") == 0 ? 0x9c : 0x50 ))); stp_putc(pg, v); - pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0x07 : - (strcmp(privdata.pagesize, "w253h337") == 0 ? 0x05 : - (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x02 : + pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x07 : + (strcmp(pd->pagesize, "w253h337") == 0 ? 0x05 : + (strcmp(pd->pagesize, "w155h244") == 0 ? 0x02 : 0x07 ))); stp_putc(pg, v); @@ -1113,11 +1208,13 @@ LIST(dyesub_printsize_list_t, dppex5_printsize_list, dyesub_printsize_t, dppex5_ static void dppex5_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("DPEX\0\0\0\x80", 1, 8, v); stp_zfwrite("DPEX\0\0\0\x82", 1, 8, v); stp_zfwrite("DPEX\0\0\0\x84", 1, 8, v); - stp_put32_be(privdata.w_size, v); - stp_put32_be(privdata.h_size, v); + stp_put32_be(pd->w_size, v); + stp_put32_be(pd->h_size, v); stp_zfwrite("S\0o\0n\0y\0 \0D\0P\0P\0-\0E\0X\0\x35\0", 1, 24, v); dyesub_nputc(v, '\0', 40); stp_zfwrite("\1\4\0\4\xdc\0\x24\0\3\3\1\0\1\0\x82\0", 1, 16, v); @@ -1131,17 +1228,19 @@ static void dppex5_printer_init(stp_vars_t *v) dyesub_nputc(v, '\0', 19); stp_zprintf(v, "5EPD"); dyesub_nputc(v, '\0', 4); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); /*laminate pattern*/ + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); /*laminate pattern*/ stp_zfwrite("\0d\0d\0d", 1, 6, v); dyesub_nputc(v, '\0', 21); } static void dppex5_block_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("DPEX\0\0\0\x85", 1, 8, v); - stp_put32_be((privdata.block_max_w - privdata.block_min_w + 1) - * (privdata.block_max_h - privdata.block_min_h + 1) * 3, v); + stp_put32_be((pd->block_max_w - pd->block_min_w + 1) + * (pd->block_max_h - pd->block_min_h + 1) * 3, v); } static void dppex5_printer_end(stp_vars_t *v) @@ -1184,33 +1283,35 @@ LIST(dyesub_printsize_list_t, updp10_printsize_list, dyesub_printsize_t, updp10_ static void updp10_printer_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("\x98\xff\xff\xff\xff\xff\xff\xff" "\x09\x00\x00\x00\x1b\xee\x00\x00" "\x00\x02\x00\x00\x01\x12\x00\x00" "\x00\x1b\xe1\x00\x00\x00\x0b\x00" "\x00\x04", 1, 34, v); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); /*laminate pattern*/ + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); /*laminate pattern*/ stp_zfwrite("\x00\x00\x00\x00", 1, 4, v); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); stp_zfwrite("\x14\x00\x00\x00\x1b\x15\x00\x00" "\x00\x0d\x00\x00\x00\x00\x00\x07" "\x00\x00\x00\x00", 1, 20, v); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); - stp_put32_le(privdata.w_size*privdata.h_size*3+11, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); + stp_put32_le(pd->w_size*pd->h_size*3+11, v); stp_zfwrite("\x1b\xea\x00\x00\x00\x00", 1, 6, v); - stp_put32_be(privdata.w_size*privdata.h_size*3, v); + stp_put32_be(pd->w_size*pd->h_size*3, v); stp_zfwrite("\x00", 1, 1, v); } static void updp10_printer_end_func(stp_vars_t *v) { - stp_zfwrite("\xff\xff\xff\xff\x07\x00\x00\x00" - "\x1b\x0a\x00\x00\x00\x00\x00\xfd" - "\xff\xff\xff\xff\xff\xff\xff" - , 1, 23, v); + stp_zfwrite("\xff\xff\xff\xff\x07\x00\x00\x00" + "\x1b\x0a\x00\x00\x00\x00\x00\xfd" + "\xff\xff\xff\xff\xff\xff\xff" + , 1, 23, v); } static const laminate_t updp10_laminate[] = @@ -1264,6 +1365,12 @@ static const char updp10_adj_yellow[] = "</curve>\n" "</gutenprint>\n"; +static void updp10_adjust_curves(stp_vars_t *v) +{ + dyesub_adjust_curve(v, updp10_adj_cyan, "CyanCurve"); + dyesub_adjust_curve(v, updp10_adj_magenta, "MagentaCurve"); + dyesub_adjust_curve(v, updp10_adj_yellow, "YellowCurve"); +} /* Sony UP-DR100 */ static const dyesub_pagesize_t updr100_page[] = @@ -1288,11 +1395,13 @@ LIST(dyesub_printsize_list_t, updr100_printsize_list, dyesub_printsize_t, updr10 static void updr100_printer_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("UPD8D\x00\x00\x00\x10\x03\x00\x00", 1, 12, v); - stp_put32_le(privdata.w_size, v); - stp_put32_le(privdata.h_size, v); + stp_put32_le(pd->w_size, v); + stp_put32_le(pd->h_size, v); stp_zfwrite("\x1e\x00\x03\x00\x01\x00\x4e\x01\x00\x00", 1, 10, v); - stp_write_raw(&(privdata.laminate->seq), v); /* laminate pattern */ + stp_write_raw(&(pd->laminate->seq), v); /* laminate pattern */ dyesub_nputc(v, '\0', 13); stp_zfwrite("\x01\x00\x01\x00\x03", 1, 5, v); dyesub_nputc(v, '\0', 19); @@ -1349,24 +1458,26 @@ LIST(dyesub_printsize_list_t, updr150_printsize_list, dyesub_printsize_t, updr15 static void updr150_200_printer_init_func(stp_vars_t *v, int updr200) { + dyesub_privdata_t *pd = get_privdata(v); + char pg; stp_zfwrite("\x6a\xff\xff\xff" "\xef\xff\xff\xff", 1, 8, v); - if (strcmp(privdata.pagesize,"B7") == 0) + if (strcmp(pd->pagesize,"B7") == 0) pg = '\x01'; - else if (strcmp(privdata.pagesize,"w288h432") == 0) + else if (strcmp(pd->pagesize,"w288h432") == 0) pg = '\x02'; - else if (updr200 && strcmp(privdata.pagesize,"w288h432-div2") == 0) + else if (updr200 && strcmp(pd->pagesize,"w288h432-div2") == 0) pg = '\x02'; - else if (strcmp(privdata.pagesize,"w360h504") == 0) + else if (strcmp(pd->pagesize,"w360h504") == 0) pg = '\x03'; - else if (updr200 && strcmp(privdata.pagesize,"w360h504-div2") == 0) + else if (updr200 && strcmp(pd->pagesize,"w360h504-div2") == 0) pg = '\x03'; - else if (strcmp(privdata.pagesize,"w432h576") == 0) + else if (strcmp(pd->pagesize,"w432h576") == 0) pg = '\x04'; - else if (updr200 && strcmp(privdata.pagesize,"w432h576-div2") == 0) + else if (updr200 && strcmp(pd->pagesize,"w432h576-div2") == 0) pg = '\x04'; else pg = 0; @@ -1381,9 +1492,9 @@ static void updr150_200_printer_init_func(stp_vars_t *v, int updr200) /* Multicut mode */ if (updr200) { - if (!strcmp(privdata.pagesize,"w288h432-div2") || - !strcmp(privdata.pagesize,"w360h504-div2") || - !strcmp(privdata.pagesize,"w432h576-div2")) + if (!strcmp(pd->pagesize,"w288h432-div2") || + !strcmp(pd->pagesize,"w360h504-div2") || + !strcmp(pd->pagesize,"w432h576-div2")) pg = 0x01; else pg = 0x02; @@ -1413,9 +1524,9 @@ static void updr150_200_printer_init_func(stp_vars_t *v, int updr200) /* Multicut mode */ if (updr200) { - if (!strcmp(privdata.pagesize,"w288h432-div2") || - !strcmp(privdata.pagesize,"w360h504-div2") || - !strcmp(privdata.pagesize,"w432h576-div2")) + if (!strcmp(pd->pagesize,"w288h432-div2") || + !strcmp(pd->pagesize,"w360h504-div2") || + !strcmp(pd->pagesize,"w432h576-div2")) stp_putc(0x02, v); else stp_putc(0x00, v); @@ -1428,29 +1539,29 @@ static void updr150_200_printer_init_func(stp_vars_t *v, int updr200) "\x0d\x00\x00\x00" "\x00\x00\x00\x00\x07\x00\x00\x00\x00", 1, 24, v); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); stp_zfwrite("\xf9\xff\xff\xff", 1, 4, v); stp_zfwrite("\x07\x00\x00\x00" "\x1b\xe1\x00\x00\x00\x0b\x00" "\x0b\x00\x00\x00\x00\x80", 1, 17, v); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); /*laminate pattern*/ + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); /*laminate pattern*/ stp_zfwrite("\x00\x00\x00\x00", 1, 4, v); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); stp_zfwrite("\xf8\xff\xff\xff", 1, 4, v); /* Each data block has this header. Can actually have multiple blocks! */ stp_zfwrite("\xec\xff\xff\xff", 1, 4, v); stp_zfwrite("\x0b\x00\x00\x00\x1b\xea" "\x00\x00\x00\x00", 1, 10, v); - stp_put32_be(privdata.w_size*privdata.h_size*3, v); + stp_put32_be(pd->w_size*pd->h_size*3, v); stp_zfwrite("\x00", 1, 1, v); - stp_put32_le(privdata.w_size*privdata.h_size*3, v); + stp_put32_le(pd->w_size*pd->h_size*3, v); } static void updr150_printer_init_func(stp_vars_t *v) @@ -1460,17 +1571,17 @@ static void updr150_printer_init_func(stp_vars_t *v) static void updr150_printer_end_func(stp_vars_t *v) { - stp_zfwrite("\xeb\xff\xff\xff" - "\xfc\xff\xff\xff" - "\xfa\xff\xff\xff", - 1, 12, v); - stp_zfwrite("\x07\x00\x00\x00" - "\x1b\x0a\x00\x00\x00\x00\x00" - "\x07\x00\x00\x00" - "\x1b\x17\x00\x00\x00\x00\x00", - 1, 22, v); - stp_zfwrite("\xf3\xff\xff\xff", - 1, 4, v); + stp_zfwrite("\xeb\xff\xff\xff" + "\xfc\xff\xff\xff" + "\xfa\xff\xff\xff", + 1, 12, v); + stp_zfwrite("\x07\x00\x00\x00" + "\x1b\x0a\x00\x00\x00\x00\x00" + "\x07\x00\x00\x00" + "\x1b\x17\x00\x00\x00\x00\x00", + 1, 22, v); + stp_zfwrite("\xf3\xff\xff\xff", + 1, 4, v); } /* Sony UP-DR200 */ @@ -1536,43 +1647,47 @@ LIST(dyesub_printsize_list_t, upcr10_printsize_list, dyesub_printsize_t, upcr10_ static void upcr10_printer_init_func(stp_vars_t *v) { - stp_zfwrite("\x60\xff\xff\xff" - "\xf8\xff\xff\xff" - "\xfd\xff\xff\xff\x14\x00\x00\x00" - "\x1b\x15\x00\x00\x00\x0d\x00\x00" - "\x00\x00\x00\x07\x00\x00\x00\x00", 1, 32, v); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); - stp_zfwrite("\xfb\xff\xff\xff" - "\xf4\xff\xff\xff\x0b\x00\x00\x00" - "\x1b\xea\x00\x00\x00\x00", 1, 18, v); - stp_put32_be(privdata.w_size * privdata.h_size * 3, v); - stp_putc(0, v); - stp_put32_le(privdata.w_size * privdata.h_size * 3, v); + dyesub_privdata_t *pd = get_privdata(v); + + stp_zfwrite("\x60\xff\xff\xff" + "\xf8\xff\xff\xff" + "\xfd\xff\xff\xff\x14\x00\x00\x00" + "\x1b\x15\x00\x00\x00\x0d\x00\x00" + "\x00\x00\x00\x07\x00\x00\x00\x00", 1, 32, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); + stp_zfwrite("\xfb\xff\xff\xff" + "\xf4\xff\xff\xff\x0b\x00\x00\x00" + "\x1b\xea\x00\x00\x00\x00", 1, 18, v); + stp_put32_be(pd->w_size * pd->h_size * 3, v); + stp_putc(0, v); + stp_put32_le(pd->w_size * pd->h_size * 3, v); } static void upcr10_printer_end_func(stp_vars_t *v) { - stp_zfwrite("\xf3\xff\xff\xff" - "\x0f\x00\x00\x00" - "\x1b\xe5\x00\x00\x00\x08\x00\x00" - "\x00\x00\x00\x00\x00\x0d\x00", 1, 23, v); - stp_zfwrite("\x12\x00\x00\x00\x1b\xe1\x00\x00" - "\x000x0b\x00\x00\x80\x08\x00\x00" - "\x00\x00", 1, 18, v); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); - stp_zfwrite("\xfa\xff\xff\xff" - "\x09\x00\x00\x00" - "\x1b\xee\x00\x00\x00\x02\x00\x00", 1, 16, v); - stp_putc(1, v); /* Copies */ - stp_zfwrite("\x07\x00\x00\x00" - "\x1b\x17\x00\x00\x00\x00\x00", 1, 11, v); - stp_zfwrite("\xf9\xff\xff\xff" - "\xfc\xff\xff\xff" - "\x07\x00\x00\x00" + dyesub_privdata_t *pd = get_privdata(v); + + stp_zfwrite("\xf3\xff\xff\xff" + "\x0f\x00\x00\x00" + "\x1b\xe5\x00\x00\x00\x08\x00\x00" + "\x00\x00\x00\x00\x00\x0d\x00", 1, 23, v); + stp_zfwrite("\x12\x00\x00\x00\x1b\xe1\x00\x00" + "\x000x0b\x00\x00\x80\x08\x00\x00" + "\x00\x00", 1, 18, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); + stp_zfwrite("\xfa\xff\xff\xff" + "\x09\x00\x00\x00" + "\x1b\xee\x00\x00\x00\x02\x00\x00", 1, 16, v); + stp_putc(1, v); /* Copies */ + stp_zfwrite("\x07\x00\x00\x00" + "\x1b\x17\x00\x00\x00\x00\x00", 1, 11, v); + stp_zfwrite("\xf9\xff\xff\xff" + "\xfc\xff\xff\xff" + "\x07\x00\x00\x00" "\x1b\x17\x00\x00\x00\x00\x00", 1, 19, v); - stp_zfwrite("\xf7\xff\xff\xff", 1, 4, v); + stp_zfwrite("\xf7\xff\xff\xff", 1, 4, v); } /* Fujifilm CX-400 */ @@ -1598,6 +1713,8 @@ LIST(dyesub_printsize_list_t, cx400_printsize_list, dyesub_printsize_t, cx400_pr static void cx400_printer_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + char pg = '\0'; const char *pname = "XXXXXX"; @@ -1611,13 +1728,13 @@ static void cx400_printer_init_func(stp_vars_t *v) stp_zfwrite("FUJIFILM", 1, 8, v); stp_zfwrite(pname, 1, 6, v); stp_putc('\0', v); - stp_put16_le(privdata.w_size, v); - stp_put16_le(privdata.h_size, v); - if (strcmp(privdata.pagesize,"w288h504") == 0) + stp_put16_le(pd->w_size, v); + stp_put16_le(pd->h_size, v); + if (strcmp(pd->pagesize,"w288h504") == 0) pg = '\x0d'; - else if (strcmp(privdata.pagesize,"w288h432") == 0) + else if (strcmp(pd->pagesize,"w288h432") == 0) pg = '\x0c'; - else if (strcmp(privdata.pagesize,"w288h387") == 0) + else if (strcmp(pd->pagesize,"w288h387") == 0) pg = '\x0b'; stp_putc(pg, v); stp_zfwrite("\x00\x00\x00\x00\x00\x01\x00\x01\x00\x00\x00\x00" @@ -1654,14 +1771,16 @@ LIST(dyesub_printsize_list_t, nx500_printsize_list, dyesub_printsize_t, nx500_pr static void nx500_printer_init_func(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("INFO-QX-20--MKS\x00\x00\x00M\x00W\00A\x00R\00E", 1, 27, v); dyesub_nputc(v, '\0', 21); stp_zfwrite("\x80\x00\x02", 1, 3, v); dyesub_nputc(v, '\0', 20); stp_zfwrite("\x02\x01\x01", 1, 3, v); dyesub_nputc(v, '\0', 2); - stp_put16_le(privdata.h_size, v); - stp_put16_le(privdata.w_size, v); + stp_put16_le(pd->h_size, v); + stp_put16_le(pd->w_size, v); stp_zfwrite("\x00\x02\x00\x70\x2f", 1, 5, v); dyesub_nputc(v, '\0', 43); } @@ -1694,9 +1813,11 @@ static void kodak_dock_printer_init(stp_vars_t *v) static void kodak_dock_plane_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_put16_be(0x3001, v); - stp_put16_le(3 - privdata.plane, v); - stp_put32_le(privdata.w_size*privdata.h_size, v); + stp_put16_le(3 - pd->plane, v); + stp_put32_le(pd->w_size*pd->h_size, v); dyesub_nputc(v, '\0', 4); } @@ -1751,22 +1872,24 @@ LIST(dyesub_printsize_list_t, kodak_6850_printsize_list, dyesub_printsize_t, kod static void kodak_68xx_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("\x03\x1b\x43\x48\x43\x0a\x00\x01", 1, 8, v); stp_put16_be(0x01, v); /* Number of copies in BCD */ - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); - if (!strcmp(privdata.pagesize,"w288h432")) + if (!strcmp(pd->pagesize,"w288h432")) stp_putc(0x00, v); - else if (!strcmp(privdata.pagesize,"w432h576")) + else if (!strcmp(pd->pagesize,"w432h576")) stp_putc(0x06, v); - else if (!strcmp(privdata.pagesize,"w360h504")) + else if (!strcmp(pd->pagesize,"w360h504")) stp_putc(0x07, v); else stp_putc(0x00, v); /* Just in case */ - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); stp_putc(0x00, v); } @@ -1794,23 +1917,25 @@ LIST(dyesub_printsize_list_t, kodak_605_printsize_list, dyesub_printsize_t, koda static void kodak_605_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("\x01\x40\x0a\x00\x01", 1, 5, v); stp_putc(0x01, v); /* Number of copies */ stp_putc(0x00, v); - stp_put16_le(privdata.w_size, v); - stp_put16_le(privdata.h_size, v); + stp_put16_le(pd->w_size, v); + stp_put16_le(pd->h_size, v); - if (!strcmp(privdata.pagesize,"w288h432")) + if (!strcmp(pd->pagesize,"w288h432")) stp_putc(0x01, v); - else if (!strcmp(privdata.pagesize,"w432h576")) + else if (!strcmp(pd->pagesize,"w432h576")) stp_putc(0x03, v); - else if (!strcmp(privdata.pagesize,"w360h504")) + else if (!strcmp(pd->pagesize,"w360h504")) stp_putc(0x02, v); else stp_putc(0x01, v); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); stp_putc(0x00, v); } @@ -1877,18 +2002,20 @@ LIST(dyesub_printsize_list_t, kodak_1400_printsize_list, dyesub_printsize_t, kod static void kodak_1400_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("PGHD", 1, 4, v); - stp_put16_le(privdata.w_size, v); + stp_put16_le(pd->w_size, v); dyesub_nputc(v, 0x00, 2); - stp_put16_le(privdata.h_size, v); + stp_put16_le(pd->h_size, v); dyesub_nputc(v, 0x00, 2); - stp_put32_le(privdata.h_size*privdata.w_size, v); + stp_put32_le(pd->h_size*pd->w_size, v); dyesub_nputc(v, 0x00, 4); - stp_zfwrite((privdata.media->seq).data, 1, 1, v); /* Matte or Glossy? */ - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); + stp_zfwrite((pd->media->seq).data, 1, 1, v); /* Matte or Glossy? */ + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); stp_putc(0x01, v); - stp_zfwrite((const char*)((privdata.media->seq).data) + 1, 1, 1, v); /* Lamination intensity */ + stp_zfwrite((const char*)((pd->media->seq).data) + 1, 1, 1, v); /* Lamination intensity */ dyesub_nputc(v, 0x00, 12); } @@ -1913,15 +2040,17 @@ LIST(dyesub_printsize_list_t, kodak_805_printsize_list, dyesub_printsize_t, koda static void kodak_805_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("PGHD", 1, 4, v); - stp_put16_le(privdata.w_size, v); + stp_put16_le(pd->w_size, v); dyesub_nputc(v, 0x00, 2); - stp_put16_le(privdata.h_size, v); + stp_put16_le(pd->h_size, v); dyesub_nputc(v, 0x00, 2); - stp_put32_le(privdata.h_size*privdata.w_size, v); + stp_put32_le(pd->h_size*pd->w_size, v); dyesub_nputc(v, 0x00, 5); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); stp_putc(0x01, v); stp_putc(0x3c, v); /* Lamination intensity; fixed on glossy media */ dyesub_nputc(v, 0x00, 12); @@ -1953,7 +2082,9 @@ LIST(laminate_list_t, kodak_9810_laminate_list, laminate_t, kodak_9810_laminate) static void kodak_9810_printer_init(stp_vars_t *v) { - /* Command stream header */ + dyesub_privdata_t *pd = get_privdata(v); + +/* Command stream header */ stp_putc(0x1b, v); stp_zfwrite("MndROSETTA V001.00100000020525072696E74657242696E4D6F74726C", 1, 59, v); @@ -1975,7 +2106,7 @@ static void kodak_9810_printer_init(stp_vars_t *v) stp_zfwrite("FlsJbMkMed Name ", 1, 19, v); dyesub_nputc(v, 0x00, 4); stp_put32_be(64, v); - if (privdata.h_size == 3624) { + if (pd->h_size == 3624) { stp_zfwrite("YMCX 8x12 Glossy", 1, 16, v); } else { stp_zfwrite("YMCX 8x10 Glossy", 1, 16, v); @@ -1993,8 +2124,8 @@ static void kodak_9810_printer_init(stp_vars_t *v) /* Lamination */ stp_putc(0x1b, v); stp_zfwrite("FlsJbLam ", 1, 11, v); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); dyesub_nputc(v, 0x20, 5); dyesub_nputc(v, 0x00, 4); stp_put32_be(0, v); @@ -2017,17 +2148,17 @@ static void kodak_9810_printer_init(stp_vars_t *v) stp_zfwrite("MndSetLPage ", 1, 19, v); dyesub_nputc(v, 0x00, 4); stp_put32_be(8, v); - stp_put32_be(privdata.w_size, v); - stp_put32_be(privdata.h_size, v); + stp_put32_be(pd->w_size, v); + stp_put32_be(pd->h_size, v); /* Page dimensions II -- maybe this is image data size? */ stp_putc(0x1b, v); stp_zfwrite("MndImSpec Size ", 1, 19, v); dyesub_nputc(v, 0x00, 4); stp_put32_be(16, v); - stp_put32_be(privdata.w_size, v); - stp_put32_be(privdata.h_size, v); - stp_put32_be(privdata.w_size, v); + stp_put32_be(pd->w_size, v); + stp_put32_be(pd->h_size, v); + stp_put32_be(pd->w_size, v); stp_put32_be(0, v); /* Positioning within page? */ @@ -2072,7 +2203,7 @@ static void kodak_9810_printer_init(stp_vars_t *v) stp_put32_be(4, v); /* Cut at start/end of sheet */ - if (privdata.h_size == 3624) { + if (pd->h_size == 3624) { stp_zfwrite("\x00\x0c\x0e\x1c", 1, 4, v); } else { stp_zfwrite("\x00\x0c\x0b\xc4", 1, 4, v); @@ -2081,14 +2212,14 @@ static void kodak_9810_printer_init(stp_vars_t *v) #if 0 /* Additional Known Cut lists */ /* Single cut, down the center */ stp_put32_be(6, v); - if (privdata.h_size == 3624) { + if (pd->h_size == 3624) { stp_zfwrite("\x00\x0c\x07\x14\x0e\x1c", 1, 6, v); } else { stp_zfwrite("\x00\x0c\x05\xe8\x0b\xc4", 1, 6, v); } /* Double-Slug Cut, down the center */ stp_put32_be(8, v); - if (privdata.h_size == 3624) { + if (pd->h_size == 3624) { stp_zfwrite("\x00\x0c\x07\x01\x07\x27\x0e\x1c", 1, 6, v); } else { stp_zfwrite("\x00\x0c\x05\xd5\x05\xfb\x0b\xc4", 1, 6, v); @@ -2114,11 +2245,13 @@ static void kodak_9810_printer_end(stp_vars_t *v) static void kodak_9810_plane_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Data block */ stp_putc(0x1b, v); stp_zfwrite("FlsData Block ", 1, 19, v); dyesub_nputc(v, 0x00, 4); - stp_put32_be((privdata.w_size * privdata.h_size) + 8, v); + stp_put32_be((pd->w_size * pd->h_size) + 8, v); stp_zfwrite("Image ", 1, 8, v); } @@ -2153,19 +2286,21 @@ LIST(laminate_list_t, kodak_8810_laminate_list, laminate_t, kodak_8810_laminate) static void kodak_8810_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_putc(0x01, v); stp_putc(0x40, v); stp_putc(0x12, v); stp_putc(0x00, v); stp_putc(0x01, v); stp_put16_le(0x01, v); /* Actually, # of copies */ - stp_put16_le(privdata.w_size, v); - stp_put16_le(privdata.h_size, v); - stp_put16_le(privdata.w_size, v); - stp_put16_le(privdata.h_size, v); + stp_put16_le(pd->w_size, v); + stp_put16_le(pd->h_size, v); + stp_put16_le(pd->w_size, v); + stp_put16_le(pd->h_size, v); dyesub_nputc(v, 0, 4); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); stp_putc(0x00, v); /* Method -- 00 is normal, 02 is x2, 03 is x3 */ stp_putc(0x00, v); /* Reserved */ } @@ -2198,22 +2333,24 @@ LIST(laminate_list_t, kodak_7000_laminate_list, laminate_t, kodak_7000_laminate) static void kodak_70xx_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + stp_zfwrite("\x01\x40\x0a\x00\x01", 1, 5, v); stp_put16_le(0x01, v); /* Actually, # of copies */ - stp_put16_le(privdata.w_size, v); - stp_put16_le(privdata.h_size, v); + stp_put16_le(pd->w_size, v); + stp_put16_le(pd->h_size, v); - if (!strcmp(privdata.pagesize,"w288h432")) + if (!strcmp(pd->pagesize,"w288h432")) stp_putc(0x01, v); - else if (!strcmp(privdata.pagesize,"w432h576")) + else if (!strcmp(pd->pagesize,"w432h576")) stp_putc(0x03, v); - else if (!strcmp(privdata.pagesize,"w360h504")) + else if (!strcmp(pd->pagesize,"w360h504")) stp_putc(0x06, v); else stp_putc(0x01, v); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); stp_putc(0x00, v); } @@ -2277,7 +2414,9 @@ LIST(laminate_list_t, kodak_8500_laminate_list, laminate_t, kodak_8500_laminate) static void kodak_8500_printer_init(stp_vars_t *v) { - /* Start with NULL block */ + dyesub_privdata_t *pd = get_privdata(v); + +/* Start with NULL block */ dyesub_nputc(v, 0x00, 64); /* Number of copies */ stp_putc(0x1b, v); @@ -2294,8 +2433,8 @@ static void kodak_8500_printer_init(stp_vars_t *v) stp_putc(0x1b, v); stp_putc(0x5a, v); stp_putc(0x53, v); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); dyesub_nputc(v, 0x00, 57); /* Sharpening -- XXX not exported. */ stp_putc(0x1b, v); @@ -2306,12 +2445,12 @@ static void kodak_8500_printer_init(stp_vars_t *v) /* Lamination */ stp_putc(0x1b, v); stp_putc(0x59, v); - if (*((const char*)((privdata.laminate->seq).data)) == 0x02) { /* None */ + if (*((const char*)((pd->laminate->seq).data)) == 0x02) { /* None */ stp_putc(0x02, v); stp_putc(0x00, v); } else { - stp_zfwrite((const char*)((privdata.media->seq).data), 1, - (privdata.media->seq).bytes, v); + stp_zfwrite((const char*)((pd->media->seq).data), 1, + (pd->media->seq).bytes, v); } dyesub_nputc(v, 0x00, 60); /* Unknown */ @@ -2326,15 +2465,17 @@ static void kodak_8500_printer_init(stp_vars_t *v) stp_putc(0x54, v); dyesub_nputc(v, 0x00, 2); stp_put16_be(0, v); /* Starting row for this block */ - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); /* Number of rows in this block */ + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); /* Number of rows in this block */ dyesub_nputc(v, 0x00, 53); } static void kodak_8500_printer_end(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Pad data to 64-byte block */ - unsigned int length = privdata.w_size * privdata.h_size * 3; + unsigned int length = pd->w_size * pd->h_size * 3; length %= 64; if (length) { length = 64 - length; @@ -2366,6 +2507,8 @@ LIST(dyesub_printsize_list_t, mitsu_cp3020d_printsize_list, dyesub_printsize_t, static void mitsu_cp3020d_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Start with NULL block */ dyesub_nputc(v, 0x00, 64); /* Unknown */ @@ -2376,7 +2519,7 @@ static void mitsu_cp3020d_printer_init(stp_vars_t *v) stp_putc(0x1b, v); stp_putc(0x5a, v); stp_putc(0x46, v); - if (privdata.h_size == 3762) + if (pd->h_size == 3762) stp_putc(0x04, v); else stp_putc(0x00, v); @@ -2405,8 +2548,8 @@ static void mitsu_cp3020d_printer_init(stp_vars_t *v) stp_putc(0x1b, v); stp_putc(0x5a, v); stp_putc(0x53, v); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); dyesub_nputc(v, 0x00, 57); } @@ -2420,21 +2563,24 @@ static void mitsu_cp3020d_printer_end(stp_vars_t *v) static void mitsu_cp3020d_plane_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Plane data header */ stp_putc(0x1b, v); stp_putc(0x5a, v); - stp_putc(0x30 + 4 - privdata.plane, v); /* Y = x31, M = x32, C = x33 */ + stp_putc(0x30 + 4 - pd->plane, v); /* Y = x31, M = x32, C = x33 */ dyesub_nputc(v, 0x00, 2); stp_put16_be(0, v); /* Starting row for this block */ - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); /* Number of rows in this block */ + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); /* Number of rows in this block */ dyesub_nputc(v, 0x00, 53); } static void mitsu_cp3020d_plane_end(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); /* Pad data to 64-byte block */ - unsigned int length = privdata.w_size * privdata.h_size; + unsigned int length = pd->w_size * pd->h_size; length %= 64; if (length) { length = 64 - length; @@ -2445,6 +2591,8 @@ static void mitsu_cp3020d_plane_end(stp_vars_t *v) /* Mitsubishi CP3020DA/DAE */ static void mitsu_cp3020da_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Init */ stp_putc(0x1b, v); stp_putc(0x57, v); @@ -2454,8 +2602,8 @@ static void mitsu_cp3020da_printer_init(stp_vars_t *v) stp_putc(0x0a, v); stp_putc(0x10, v); dyesub_nputc(v, 0x00, 7); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); dyesub_nputc(v, 0x00, 32); /* Page count */ stp_putc(0x1b, v); @@ -2504,15 +2652,17 @@ static void mitsu_cp3020da_printer_end(stp_vars_t *v) static void mitsu_cp3020da_plane_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Plane data header */ stp_putc(0x1b, v); stp_putc(0x5a, v); stp_putc(0x54, v); - stp_putc((privdata.bpp > 8) ? 0x10: 0x00, v); + stp_putc((pd->bpp > 8) ? 0x10: 0x00, v); dyesub_nputc(v, 0x00, 2); stp_put16_be(0, v); /* Starting row for this block */ - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); /* Number of rows in this block */ + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); /* Number of rows in this block */ } /* Mitsubishi 9550D/DW */ @@ -2558,8 +2708,90 @@ static const dyesub_printsize_t mitsu_cp9550_printsize[] = LIST(dyesub_printsize_list_t, mitsu_cp9550_printsize_list, dyesub_printsize_t, mitsu_cp9550_printsize); +static const dyesub_stringitem_t mitsu9550_qualities[] = +{ + { "Fine", N_ ("Fine") }, + { "SuperFine", N_ ("Super Fine") }, + { "FineDeep", N_ ("Fine Deep") } +}; +LIST(dyesub_stringlist_t, mitsu9550_quality_list, dyesub_stringitem_t, mitsu9550_qualities); + +static const stp_parameter_t mitsu9550_parameters[] = +{ + { + "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup", + N_("Print Speed"), + STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, + STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0 + }, +}; +#define mitsu9550_parameter_count (sizeof(mitsu9550_parameters) / sizeof(const stp_parameter_t)) + +static int +mitsu9550_load_parameters(const stp_vars_t *v, const char *name, + stp_parameter_t *description) +{ + int i; + const dyesub_cap_t *caps = dyesub_get_model_capabilities( + stp_get_model_id(v)); + + if (caps->parameter_count && caps->parameters) + { + for (i = 0; i < caps->parameter_count; i++) + if (strcmp(name, caps->parameters[i].name) == 0) + { + stp_fill_parameter_settings(description, &(caps->parameters[i])); + break; + } + } + + if (strcmp(name, "PrintSpeed") == 0) + { + description->bounds.str = stp_string_list_create(); + + const dyesub_stringlist_t *mlist = &mitsu9550_quality_list; + for (i = 0; i < mlist->n_items; i++) + { + const dyesub_stringitem_t *m = &(mlist->item[i]); + stp_string_list_add_string(description->bounds.str, + m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */ + } + description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name; + description->is_active = 1; + } + else + { + return 0; + } + return 1; +} + +static int mitsu9550_parse_parameters(stp_vars_t *v) +{ + const char *quality = stp_get_string_parameter(v, "PrintSpeed"); + dyesub_privdata_t *pd = get_privdata(v); + + /* No need to set global params if there's no privdata yet */ + if (!pd) + return 1; + + pd->privdata.m9550.quality = 0; + pd->privdata.m9550.finedeep = 0; + + /* Parse options */ + if (strcmp(quality, "SuperFine") == 0) { + pd->privdata.m9550.quality = 0x80; + } else if (strcmp(quality, "FineDeep") == 0) { + pd->privdata.m9550.finedeep = 1; + } + + return 1; +} + static void mitsu_cp9550_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Init */ stp_putc(0x1b, v); stp_putc(0x57, v); @@ -2569,8 +2801,8 @@ static void mitsu_cp9550_printer_init(stp_vars_t *v) stp_putc(0x0a, v); stp_putc(0x10, v); dyesub_nputc(v, 0x00, 7); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); dyesub_nputc(v, 0x00, 32); /* Parameters 1 */ stp_putc(0x1b, v); @@ -2583,15 +2815,15 @@ static void mitsu_cp9550_printer_init(stp_vars_t *v) stp_putc(0x22, v); stp_putc(0x08, v); stp_putc(0x03, v); - dyesub_nputc(v, 0x00, 19); - stp_putc(0x01, v); /* Copies */ + dyesub_nputc(v, 0x00, 18); + stp_put16_be(1, v); /* Copies */ dyesub_nputc(v, 0x00, 2); - if (strcmp(privdata.pagesize,"w288h432-div2") == 0) + if (strcmp(pd->pagesize,"w288h432-div2") == 0) stp_putc(0x83, v); else stp_putc(0x00, v); dyesub_nputc(v, 0x00, 5); - stp_putc(0x00, v); /* XXX 00 == normal, 80 = fine */ + stp_putc(pd->privdata.m9550.quality, v); dyesub_nputc(v, 0x00, 10); stp_putc(0x01, v); /* Parameters 2 */ @@ -2602,7 +2834,7 @@ static void mitsu_cp9550_printer_init(stp_vars_t *v) stp_putc(0x00, v); stp_putc(0x40, v); dyesub_nputc(v, 0x00, 5); - stp_putc(0x00, v); /* XXX 00 == normal, 01 == finedeep (some models only) */ + stp_putc(pd->privdata.m9550.finedeep, v); dyesub_nputc(v, 0x00, 38); /* Unknown */ stp_putc(0x1b, v); @@ -2626,6 +2858,47 @@ static void mitsu_cp9550_printer_end(stp_vars_t *v) stp_putc(0x00, v); } +/* Mitsubishi CP9550DW-S */ + +static const dyesub_pagesize_t mitsu_cp9550s_page[] = +{ + { "w288h432", "4x6", PT(1416,346)+1, PT(2152,346)+1, 0, 0, 0, 0, + DYESUB_LANDSCAPE}, + { "w288h432-div2", "2x6*2", PT(1416,346)+1, PT(2152,346)+1, 0, 0, 0, 0, + DYESUB_LANDSCAPE}, + { "w360h504", "5x7", PT(1812,346)+1, PT(2452,346)+1, 0, 0, 0, 0, + DYESUB_PORTRAIT}, + { "w432h576", "6x8", PT(2152,346)+1, PT(2792,346)+1, 0, 0, 0, 0, + DYESUB_PORTRAIT}, + { "w432h612", "6x8.5", PT(2152,346)+1, PT(2956,346)+1, 0, 0, 0, 0, + DYESUB_PORTRAIT}, + { "w432h648", "6x9", PT(2152,346)+1, PT(3146,346)+1, 0, 0, 0, 0, + DYESUB_PORTRAIT}, +}; + +LIST(dyesub_pagesize_list_t, mitsu_cp9550s_page_list, dyesub_pagesize_t, mitsu_cp9550s_page); + +static const dyesub_printsize_t mitsu_cp9550s_printsize[] = +{ + { "346x346", "w288h432", 1416, 2152}, + { "346x346", "w288h432-div2", 1416, 2152}, + { "346x346", "w360h504", 1812, 2452}, + { "346x346", "w432h576", 2152, 2792}, + { "346x346", "w432h612", 2152, 2956}, + { "346x346", "w432h648", 2152, 3146}, +}; + +LIST(dyesub_printsize_list_t, mitsu_cp9550s_printsize_list, dyesub_printsize_t, mitsu_cp9550s_printsize); + +static void mitsu_cp9550s_printer_end(stp_vars_t *v) +{ + /* Page Footer */ + stp_putc(0x1b, v); + stp_putc(0x50, v); + stp_putc(0x47, v); + stp_putc(0x00, v); +} + /* Mitsubishi 9600D/DW */ static const dyesub_resolution_t res_mitsu9600_dpi[] = { @@ -2673,6 +2946,8 @@ LIST(dyesub_printsize_list_t, mitsu_cp9600_printsize_list, dyesub_printsize_t, m static void mitsu_cp9600_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Parameters 1 */ stp_putc(0x1b, v); stp_putc(0x57, v); @@ -2684,8 +2959,8 @@ static void mitsu_cp9600_printer_init(stp_vars_t *v) stp_putc(0x22, v); stp_putc(0x00, v); stp_putc(0x03, v); - dyesub_nputc(v, 0x00, 19); - stp_putc(0x01, v); /* Copies */ + dyesub_nputc(v, 0x00, 18); + stp_put16_be(1, v); /* Copies */ dyesub_nputc(v, 0x00, 19); stp_putc(0x01, v); /* Parameters 2 */ @@ -2697,8 +2972,8 @@ static void mitsu_cp9600_printer_init(stp_vars_t *v) stp_putc(0x0a, v); stp_putc(0x10, v); dyesub_nputc(v, 0x00, 7); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); dyesub_nputc(v, 0x00, 32); /* Parameters 3 */ stp_putc(0x1b, v); @@ -2755,13 +3030,94 @@ LIST(dyesub_printsize_list_t, mitsu_cp9810_printsize_list, dyesub_printsize_t, m static const laminate_t mitsu_cp9810_laminate[] = { {"Matte", N_("Matte"), {1, "\x01"}}, - {"None", N_("None"), {1, "\x00"}}, + {"Glossy", N_("Glossy"), {1, "\x00"}}, }; LIST(laminate_list_t, mitsu_cp9810_laminate_list, laminate_t, mitsu_cp9810_laminate); -static void mitsu_cp9810_printer_init(stp_vars_t *v) +static const dyesub_stringitem_t mitsu9810_qualities[] = +{ + { "Fine", N_ ("Fine") }, + { "SuperFine", N_ ("Super Fine") }, +}; +LIST(dyesub_stringlist_t, mitsu9810_quality_list, dyesub_stringitem_t, mitsu9810_qualities); + +static int +mitsu9810_load_parameters(const stp_vars_t *v, const char *name, + stp_parameter_t *description) +{ + int i; + const dyesub_cap_t *caps = dyesub_get_model_capabilities( + stp_get_model_id(v)); + + if (caps->parameter_count && caps->parameters) + { + for (i = 0; i < caps->parameter_count; i++) + if (strcmp(name, caps->parameters[i].name) == 0) + { + stp_fill_parameter_settings(description, &(caps->parameters[i])); + break; + } + } + + if (strcmp(name, "PrintSpeed") == 0) + { + description->bounds.str = stp_string_list_create(); + + const dyesub_stringlist_t *mlist = &mitsu9810_quality_list; + for (i = 0; i < mlist->n_items; i++) + { + const dyesub_stringitem_t *m = &(mlist->item[i]); + stp_string_list_add_string(description->bounds.str, + m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */ + } + description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name; + description->is_active = 1; + } + else + { + return 0; + } + return 1; +} + +static int mitsu9810_parse_parameters(stp_vars_t *v) +{ + const char *quality = stp_get_string_parameter(v, "PrintSpeed"); + dyesub_privdata_t *pd = get_privdata(v); + const laminate_t *laminate = NULL; + const dyesub_cap_t *caps = dyesub_get_model_capabilities( + stp_get_model_id(v)); + + /* No need to set global params if there's no privdata yet */ + if (!pd) + return 1; + + pd->privdata.m9550.quality = 0; + + /* Parse options */ + if (strcmp(quality, "SuperFine") == 0) { + pd->privdata.m9550.quality = 0x80; + } else if (strcmp(quality, "Fine") == 0) { + pd->privdata.m9550.finedeep = 0x10; + } + + /* Matte lamination forces SuperFine mode */ + if (caps->laminate) { + laminate = dyesub_get_laminate_pattern(v); + if (*((const char*)((laminate->seq).data)) != 0x00) { + pd->privdata.m9550.quality = 0x80; + } + } + + return 1; +} + + +static void mitsu_cp98xx_printer_init(stp_vars_t *v, int model) { + dyesub_privdata_t *pd = get_privdata(v); + /* Init */ stp_putc(0x1b, v); stp_putc(0x57, v); @@ -2769,12 +3125,16 @@ static void mitsu_cp9810_printer_init(stp_vars_t *v) stp_putc(0x2e, v); stp_putc(0x00, v); stp_putc(0x0a, v); - stp_putc(0x90, v); + stp_putc(model, v); dyesub_nputc(v, 0x00, 7); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); /* Lamination */ + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); + if (model == 0x90) { + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); /* Lamination */ + } else { + stp_putc(0x00, v); + } dyesub_nputc(v, 0x00, 31); /* Parameters 1 */ stp_putc(0x1b, v); @@ -2787,10 +3147,10 @@ static void mitsu_cp9810_printer_init(stp_vars_t *v) stp_putc(0x22, v); stp_putc(0x08, v); stp_putc(0x01, v); - dyesub_nputc(v, 0x00, 19); - stp_putc(0x01, v); /* Copies */ + dyesub_nputc(v, 0x00, 18); + stp_put16_be(1, v); /* Copies */ dyesub_nputc(v, 0x00, 8); - stp_putc(0x80, v); /* XXX 10 == Fine, 80 = SuperFine (required for lamination) */ + stp_putc(pd->privdata.m9550.quality, v); dyesub_nputc(v, 0x00, 10); stp_putc(0x01, v); /* Unknown */ @@ -2806,15 +3166,28 @@ static void mitsu_cp9810_printer_init(stp_vars_t *v) dyesub_nputc(v, 0x00, 36); } +static void mitsu_cp9810_printer_init(stp_vars_t *v) +{ + mitsu_cp98xx_printer_init(v, 0x90); +} + +static void mitsu_cp9800_printer_init(stp_vars_t *v) +{ + mitsu_cp98xx_printer_init(v, 0x10); +} + static void mitsu_cp9810_printer_end(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Job Footer */ stp_putc(0x1b, v); stp_putc(0x50, v); - stp_putc(0x4c, v); + stp_putc(0x4c, v); /* XXX 9800DW-S uses 0x4e, backend corrects */ stp_putc(0x00, v); - if (*((const char*)((privdata.laminate->seq).data)) == 0x01) { + if (pd->laminate && + *((const char*)((pd->laminate->seq).data)) == 0x01) { /* Generate a full plane of lamination data */ @@ -2831,8 +3204,8 @@ static void mitsu_cp9810_printer_end(stp_vars_t *v) mitsu_cp3020da_plane_init(v); /* First generate plane header */ /* Now generate lamination pattern */ - for (c = 0 ; c < privdata.w_size ; c++) { - for (r = 0 ; r < privdata.h_size ; r++) { + for (c = 0 ; c < pd->w_size ; c++) { + for (r = 0 ; r < pd->h_size ; r++) { int i = xrand(&seed) & 0x1f; if (i < 16) stp_put16_be(0x0202, v); @@ -2904,22 +3277,6 @@ static const laminate_t mitsu_cpd70x_laminate[] = LIST(laminate_list_t, mitsu_cpd70x_laminate_list, laminate_t, mitsu_cpd70x_laminate); -/* This list is *not* translated */ -static const dyesub_stringitem_t mitsu70x_uiconstraints[] = { - /* PPD generation handles constraint reciprocation */ - /* Basically, exclude Matte and "Fine" quality */ - {"UIConstraints", "*StpLaminate Matte *StpPrintSpeed Fine"}, -}; -LIST(dyesub_stringlist_t, mitsu70x_uiconstraints_list, dyesub_stringitem_t, mitsu70x_uiconstraints); - -typedef struct -{ - const char *quality; - int laminate_offset; -} mitsu70x_privdata_t; - -static mitsu70x_privdata_t mitsu70x_privdata; - static const dyesub_stringitem_t mitsu70x_qualities[] = { { "Fine", N_ ("Fine") }, @@ -2936,6 +3293,20 @@ static const stp_parameter_t mitsu70x_parameters[] = STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0 }, +#ifdef MITSU70X_8BPP + { + "UseLUT", N_("Internal Color Correction"), "Color=No,Category=Advanced Printer Setup", + N_("Use Internal Color Correction"), + STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE, + STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0 + }, + { + "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup", + N_("Sharpening to apply to image (0 is off, 1 is min, 9 is max"), + STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE, + STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0 + }, +#endif }; #define mitsu70x_parameter_count (sizeof(mitsu70x_parameters) / sizeof(const stp_parameter_t)) @@ -2971,6 +3342,19 @@ mitsu70x_load_parameters(const stp_vars_t *v, const char *name, description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name; description->is_active = 1; } +#ifdef MITSU70X_8BPP + else if (strcmp(name, "UseLUT") == 0) + { + description->is_active = 1; + } + else if (strcmp(name, "Sharpen") == 0) + { + description->deflt.integer = 4; + description->bounds.integer.lower = 0; + description->bounds.integer.upper = 9; + description->is_active = 1; + } +#endif else { return 0; @@ -2978,26 +3362,40 @@ mitsu70x_load_parameters(const stp_vars_t *v, const char *name, return 1; } -static void mitsu70x_parse_parameters(stp_vars_t *v) +static int mitsu70x_parse_parameters(stp_vars_t *v) { - mitsu70x_privdata.quality = stp_get_string_parameter(v, "PrintSpeed"); -} + const char *quality = stp_get_string_parameter(v, "PrintSpeed"); + dyesub_privdata_t *pd = get_privdata(v); -static void mitsu_cpd70k60_printer_init(stp_vars_t *v, unsigned char model) -{ - int quality; + /* No need to set global params if there's no privdata yet */ + if (!pd) + return 1; /* Parse options */ - if (strcmp(mitsu70x_privdata.quality, "SuperFine") == 0) { - quality = 3; - } else if (strcmp(mitsu70x_privdata.quality, "UltraFine") == 0) { - quality = 4; - } else if (strcmp(mitsu70x_privdata.quality, "Fine") == 0) { - quality = 0; + if (strcmp(quality, "SuperFine") == 0) { + pd->privdata.m70x.quality = 3; + } else if (strcmp(quality, "UltraFine") == 0) { + pd->privdata.m70x.quality = 4; + } else if (strcmp(quality, "Fine") == 0) { + pd->privdata.m70x.quality = 0; } else { - quality = 0; + pd->privdata.m70x.quality = 0; } +#ifdef MITSU70X_8BPP + pd->privdata.m70x.use_lut = stp_get_boolean_parameter(v, "UseLUT"); + pd->privdata.m70x.sharpen = stp_get_int_parameter(v, "Sharpen"); +#endif + + return 1; +} + +static void mitsu_cpd70k60_printer_init(stp_vars_t *v, unsigned char model) +{ + const dyesub_cap_t *caps = dyesub_get_model_capabilities( + stp_get_model_id(v)); + dyesub_privdata_t *pd = get_privdata(v); + /* Printer wakeup */ stp_putc(0x1b, v); stp_putc(0x45, v); @@ -3012,51 +3410,64 @@ static void mitsu_cpd70k60_printer_init(stp_vars_t *v, unsigned char model) stp_putc(model, v); /* k60 == x02, 305 == x90, d70x/d80 == x01 */ dyesub_nputc(v, 0x00, 12); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); - if (*((const char*)((privdata.laminate->seq).data)) != 0x00) { - stp_put16_be(privdata.w_size, v); - if (model == 0x02 || model == 0x90) { - mitsu70x_privdata.laminate_offset = 0; - quality = 4; /* Matte Lamination forces UltraFine on K60 or K305 */ + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); + if (caps->laminate && *((const char*)((pd->laminate->seq).data)) != 0x00) { + stp_put16_be(pd->w_size, v); + if (model == 0x00 || model == 0x90) { + pd->privdata.m70x.laminate_offset = 0; + if (!pd->privdata.m70x.quality) + pd->privdata.m70x.quality = 4; /* Matte Lamination forces UltraFine on K60 or K305 */ } else { /* Laminate a slightly larger boundary in Matte mode */ - mitsu70x_privdata.laminate_offset = 12; - quality = 3; /* Matte Lamination forces Superfine (or UltraFine) */ + pd->privdata.m70x.laminate_offset = 12; + if (!pd->privdata.m70x.quality) + pd->privdata.m70x.quality = 3; /* Matte Lamination forces Superfine (or UltraFine) */ } - stp_put16_be(privdata.h_size + mitsu70x_privdata.laminate_offset, v); + stp_put16_be(pd->h_size + pd->privdata.m70x.laminate_offset, v); } else { /* Glossy lamination here */ stp_put16_be(0, v); stp_put16_be(0, v); } - stp_putc(quality, v); + stp_putc(pd->privdata.m70x.quality, v); dyesub_nputc(v, 0x00, 7); - if (model != 0x01) { + if (model == 0x01) { stp_putc(0x00, v); /* D70x: 0x00 Auto deck selection, 0x01 for Lower, 0x02 for Upper. */ } else { stp_putc(0x01, v); /* All others have a single "lower" deck */ } dyesub_nputc(v, 0x00, 7); - + stp_putc(0x00, v); /* Lamination always enabled */ - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); /* Lamination mode */ + + if (caps->laminate) { + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); /* Lamination mode */ + } else { + stp_putc(0x00, v); + } dyesub_nputc(v, 0x00, 6); /* Multi-cut control */ - if (strcmp(privdata.pagesize,"w432h576-div2") == 0) { + if (strcmp(pd->pagesize,"w432h576-div2") == 0) { stp_putc(0x01, v); - } else if (strcmp(privdata.pagesize,"w360h504-div2") == 0) { + } else if (strcmp(pd->pagesize,"w360h504-div2") == 0) { stp_putc(0x01, v); - } else if (strcmp(privdata.pagesize,"w288h432-div2") == 0) { + } else if (strcmp(pd->pagesize,"w288h432-div2") == 0) { stp_putc(0x05, v); } else { stp_putc(0x00, v); } +#ifdef MITSU70X_8BPP + dyesub_nputc(v, 0x00, 12); + stp_putc(pd->privdata.m70x.sharpen, v); + stp_putc(0x01, v); /* Mark as 8bpp BGR rather than 16bpp YMC cooked */ + stp_putc(pd->privdata.m70x.use_lut, v); /* Use LUT? */ +#else dyesub_nputc(v, 0x00, 15); - +#endif dyesub_nputc(v, 0x00, 448); /* Pad to 512-byte block */ } @@ -3065,19 +3476,22 @@ static void mitsu_cpd70x_printer_init(stp_vars_t *v) mitsu_cpd70k60_printer_init(v, 0x01); } +#ifndef MITSU70X_8BPP static void mitsu_cpd70x_printer_end(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* If Matte lamination is enabled, generate a lamination plane */ - if (*((const char*)((privdata.laminate->seq).data)) != 0x00) { + if (*((const char*)((pd->laminate->seq).data)) != 0x00) { int r, c; unsigned long seed = 1; /* Now generate lamination pattern */ - for (c = 0 ; c < privdata.w_size ; c++) { - for (r = 0 ; r < privdata.h_size + mitsu70x_privdata.laminate_offset ; r++) { + for (c = 0 ; c < pd->w_size ; c++) { + for (r = 0 ; r < pd->h_size + pd->privdata.m70x.laminate_offset ; r++) { int i = xrand(&seed) & 0x3f; - if (mitsu70x_privdata.laminate_offset) { /* D70x uses 0x384b, 0x286a, 0x6c22 */ + if (pd->privdata.m70x.laminate_offset) { /* D70x uses 0x384b, 0x286a, 0x6c22 */ if (i < 42) stp_put16_be(0xe84b, v); else if (i < 62) @@ -3095,15 +3509,17 @@ static void mitsu_cpd70x_printer_end(stp_vars_t *v) } } /* Pad up to a 512-byte block */ - dyesub_nputc(v, 0x00, 512 - ((privdata.w_size * (privdata.h_size + mitsu70x_privdata.laminate_offset) * 2) % 512)); + dyesub_nputc(v, 0x00, 512 - ((pd->w_size * (pd->h_size + pd->privdata.m70x.laminate_offset) * 2) % 512)); } } - +#endif static void mitsu_cpd70x_plane_end(stp_vars_t *v) { +#ifndef MITSU70X_8BPP /* Pad up to a 512-byte block */ - dyesub_nputc(v, 0x00, 512 - ((privdata.h_size * privdata.w_size * 2) % 512)); + dyesub_nputc(v, 0x00, 512 - ((pd->h_size * pd->w_size * 2) % 512)); +#endif } /* Mitsubishi CP-K60D */ @@ -3145,7 +3561,7 @@ LIST(dyesub_printsize_list_t, mitsu_cpk60_printsize_list, dyesub_printsize_t, mi static void mitsu_cpk60_printer_init(stp_vars_t *v) { - mitsu_cpd70k60_printer_init(v, 0x02); + mitsu_cpd70k60_printer_init(v, 0x00); } /* Identical to the D70 except for one fewer quality mode */ @@ -3188,6 +3604,19 @@ mitsu_k60_load_parameters(const stp_vars_t *v, const char *name, description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name; description->is_active = 1; } +#ifdef MITSU70X_8BPP + else if (strcmp(name, "UseLUT") == 0) + { + description->is_active = 1; + } + else if (strcmp(name, "Sharpen") == 0) + { + description->deflt.integer = 4; + description->bounds.integer.lower = 0; + description->bounds.integer.upper = 9; + description->is_active = 1; + } +#endif else { return 0; @@ -3233,8 +3662,14 @@ static const dyesub_pagesize_t kodak305_page[] = { { "w288h432", "4x6", PT(1218,300)+1, PT(1864,300)+1, 0, 0, 0, 0, DYESUB_LANDSCAPE}, + { "w288h432-div2", "2x6*2", PT(1218,300)+1, PT(1864,300)+1, 0, 0, 0, 0, + DYESUB_LANDSCAPE}, + { "w432h432", "6x6", PT(1820,300)+1, PT(1864,300)+1, 0, 0, 0, 0, + DYESUB_LANDSCAPE}, { "w432h576", "6x8", PT(1864,300)+1, PT(2422,300)+1, 0, 0, 0, 0, DYESUB_PORTRAIT}, + { "w432h576-div2", "4x6*2", PT(1864,300)+1, PT(2454,300)+1, 0, 0, 0, 0, + DYESUB_PORTRAIT}, }; LIST(dyesub_pagesize_list_t, kodak305_page_list, dyesub_pagesize_t, kodak305_page); @@ -3242,14 +3677,17 @@ LIST(dyesub_pagesize_list_t, kodak305_page_list, dyesub_pagesize_t, kodak305_pag static const dyesub_printsize_t kodak305_printsize[] = { { "300x300", "w288h432", 1218, 1864}, + { "300x300", "w288h432-div2", 1218, 1864}, + { "300x300", "w432h432", 1820, 1864}, { "300x300", "w432h576", 1864, 2422}, + { "300x300", "w432h576-div2", 1864, 2454}, }; LIST(dyesub_printsize_list_t, kodak305_printsize_list, dyesub_printsize_t, kodak305_printsize); static void kodak305_printer_init(stp_vars_t *v) { - mitsu_cpd70k60_printer_init(v, 0x90); + mitsu_cpd70k60_printer_init(v, 0x90); } /* Mitsubishi CP-D90D */ @@ -3298,8 +3736,96 @@ static const dyesub_printsize_t mitsu_cpd90_printsize[] = LIST(dyesub_printsize_list_t, mitsu_cpd90_printsize_list, dyesub_printsize_t, mitsu_cpd90_printsize); +static const dyesub_stringitem_t mitsu_d90_qualities[] = +{ + { "Auto", N_ ("Automatic") }, + { "Fine", N_ ("Fine") }, + { "UltraFine", N_ ("Ultra Fine") } +}; +LIST(dyesub_stringlist_t, mitsu_d90_quality_list, dyesub_stringitem_t, mitsu_d90_qualities); + +static int +mitsu_d90_load_parameters(const stp_vars_t *v, const char *name, + stp_parameter_t *description) +{ + int i; + const dyesub_cap_t *caps = dyesub_get_model_capabilities( + stp_get_model_id(v)); + + if (caps->parameter_count && caps->parameters) + { + for (i = 0; i < caps->parameter_count; i++) + if (strcmp(name, caps->parameters[i].name) == 0) + { + stp_fill_parameter_settings(description, &(caps->parameters[i])); + break; + } + } + + if (strcmp(name, "PrintSpeed") == 0) + { + description->bounds.str = stp_string_list_create(); + + const dyesub_stringlist_t *mlist = &mitsu_d90_quality_list; + for (i = 0; i < mlist->n_items; i++) + { + const dyesub_stringitem_t *m = &(mlist->item[i]); + stp_string_list_add_string(description->bounds.str, + m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */ + } + description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name; + description->is_active = 1; + } +#ifdef MITSU70X_8BPP + else if (strcmp(name, "UseLUT") == 0) + { + description->is_active = 1; + } + else if (strcmp(name, "Sharpen") == 0) + { + description->deflt.integer = 4; + description->bounds.integer.lower = 0; + description->bounds.integer.upper = 9; + description->is_active = 1; + } +#endif + else + { + return 0; + } + return 1; +} + +static int mitsu_d90_parse_parameters(stp_vars_t *v) +{ + const char *quality = stp_get_string_parameter(v, "PrintSpeed"); + dyesub_privdata_t *pd = get_privdata(v); + + /* No need to set global params if there's no privdata yet */ + if (!pd) + return 1; + + /* Parse options */ + if (strcmp(quality, "UltraFine") == 0) { + pd->privdata.m70x.quality = 3; + } else if (strcmp(quality, "Fine") == 0) { + pd->privdata.m70x.quality = 2; + } else { + pd->privdata.m70x.quality = 0; + } + +#ifdef MITSU70X_8BPP + pd->privdata.m70x.use_lut = stp_get_boolean_parameter(v, "UseLUT"); + pd->privdata.m70x.sharpen = stp_get_int_parameter(v, "Sharpen"); +#endif + + return 1; +} + static void mitsu_cpd90_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Start things going */ stp_putc(0x1b, v); stp_putc(0x53, v); @@ -3307,23 +3833,23 @@ static void mitsu_cpd90_printer_init(stp_vars_t *v) stp_putc(0x30, v); stp_putc(0x00, v); stp_putc(0x33, v); - stp_put16_be(privdata.w_size, v); /* Columns */ - stp_put16_be(privdata.h_size, v); /* Rows */ + stp_put16_be(pd->w_size, v); /* Columns */ + stp_put16_be(pd->h_size, v); /* Rows */ stp_putc(0x64, v); stp_putc(0x00, v); stp_putc(0x00, v); stp_putc(0x01, v); stp_putc(0x00, v); - if (strcmp(privdata.pagesize,"w432h576-div2") == 0) + if (strcmp(pd->pagesize,"w432h576-div2") == 0) stp_putc(0x01, v); else stp_putc(0x00, v); - if (strcmp(privdata.pagesize,"w432h576-div2") == 0) { + if (strcmp(pd->pagesize,"w432h576-div2") == 0) { stp_putc(0x04, v); stp_putc(0xbe, v); dyesub_nputc(v, 0x00, 14); - } else if (strcmp(privdata.pagesize,"w288h432-div2") == 0) { + } else if (strcmp(pd->pagesize,"w288h432-div2") == 0) { stp_putc(0x02, v); stp_putc(0x65, v); stp_putc(0x01, v); @@ -3337,12 +3863,16 @@ static void mitsu_cpd90_printer_init(stp_vars_t *v) dyesub_nputc(v, 0x00, 16); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); /* Lamination mode */ - stp_putc(0x00, v); /* XXX 0x02 = fine, 0x03 = ultrafine, 0x00 = auto */ - stp_putc(0x00, v); /* XXX 0x01 = no color correction, 0x00 = on */ - stp_putc(0x04, v); - stp_putc(0x04, v); + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); /* Lamination mode */ + stp_putc(pd->privdata.m70x.quality, v); +#ifdef MITSU70X_8BPP + stp_putc(pd->privdata.m70x.use_lut, v); +#else + stp_putc(0x00, v); /* ie use printer's built in LUT */ +#endif + stp_putc(pd->privdata.m70x.sharpen, v); /* Horizontal */ + stp_putc(pd->privdata.m70x.sharpen, v); /* Vertical */ dyesub_nputc(v, 0x00, 11); dyesub_nputc(v, 0x00, 512 - 64); @@ -3355,8 +3885,8 @@ static void mitsu_cpd90_printer_init(stp_vars_t *v) stp_putc(0x00, v); stp_putc(0x09, v); dyesub_nputc(v, 0x00, 4); - stp_put16_be(privdata.w_size, v); /* Columns */ - stp_put16_be(privdata.h_size, v); /* Rows */ + stp_put16_be(pd->w_size, v); /* Columns */ + stp_put16_be(pd->h_size, v); /* Rows */ dyesub_nputc(v, 0x00, 2); dyesub_nputc(v, 0x00, 512 - 32); @@ -3370,9 +3900,40 @@ static void mitsu_cpd90_printer_end(stp_vars_t *v) stp_putc(0x51, v); stp_putc(0x31, v); stp_putc(0x00, v); - stp_putc(0x05, v); + stp_putc(0x05, v); /* XXX seconds to wait for second print */ } +/* Fujifilm ASK-300 */ +static const dyesub_pagesize_t fuji_ask300_page[] = +{ + { "B7", "3.5x5", PT(1076,300)+1, PT(1568,300)+1, 0, 0, 0, 0, + DYESUB_LANDSCAPE}, + { "w288h432", "4x6", PT(1228,300)+1, PT(1864,300)+1, 0, 0, 0, 0, + DYESUB_LANDSCAPE}, + { "w360h504", "5x7", PT(1568,300)+1, PT(2128,300)+1, 0, 0, 0, 0, + DYESUB_PORTRAIT}, + { "w360h504-div2", "3.5x5*2", PT(1568,300)+1, PT(2128,300)+1, 0, 0, 0, 0, + DYESUB_PORTRAIT}, + { "w432h576", "6x8", PT(1864,300)+1, PT(2422,300)+1, 0, 0, 0, 0, + DYESUB_PORTRAIT}, + { "w432h648", "6x9", PT(1864,300)+1, PT(2730,300)+1, 0, 0, 0, 0, + DYESUB_PORTRAIT}, +}; + +LIST(dyesub_pagesize_list_t, fuji_ask300_page_list, dyesub_pagesize_t, fuji_ask300_page); + +static const dyesub_printsize_t fuji_ask300_printsize[] = +{ + { "300x300", "B7", 1076, 1568}, + { "300x300", "w288h432", 1228, 1864}, + { "300x300", "w360h504", 1568, 2128}, + { "300x300", "w360h504-div2", 1568, 2128}, + { "300x300", "w432h576", 1864, 2422}, + { "300x300", "w432h648", 1864, 2730}, +}; + +LIST(dyesub_printsize_list_t, fuji_ask300_printsize_list, dyesub_printsize_t, fuji_ask300_printsize); + /* Shinko CHC-S9045 (experimental) */ static const dyesub_pagesize_t shinko_chcs9045_page[] = { @@ -3406,21 +3967,23 @@ LIST(dyesub_printsize_list_t, shinko_chcs9045_printsize_list, dyesub_printsize_t static void shinko_chcs9045_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + char pg = '\0'; char sticker = '\0'; stp_zprintf(v, "\033CHC\n"); stp_put16_be(1, v); stp_put16_be(1, v); - stp_put16_be(privdata.w_size, v); - stp_put16_be(privdata.h_size, v); - if (strcmp(privdata.pagesize,"B7") == 0) + stp_put16_be(pd->w_size, v); + stp_put16_be(pd->h_size, v); + if (strcmp(pd->pagesize,"B7") == 0) pg = '\1'; - else if (strcmp(privdata.pagesize,"w360h504") == 0) + else if (strcmp(pd->pagesize,"w360h504") == 0) pg = '\3'; - else if (strcmp(privdata.pagesize,"w432h576") == 0) + else if (strcmp(pd->pagesize,"w432h576") == 0) pg = '\5'; - else if (strcmp(privdata.pagesize,"w283h425") == 0) + else if (strcmp(pd->pagesize,"w283h425") == 0) sticker = '\3'; stp_putc(pg, v); stp_putc('\0', v); @@ -3480,23 +4043,25 @@ LIST(laminate_list_t, shinko_chcs2145_laminate_list, laminate_t, shinko_chcs2145 static void shinko_chcs2145_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + int media = 0; - if (strcmp(privdata.pagesize,"w288h432") == 0) + if (strcmp(pd->pagesize,"w288h432") == 0) media = '\0'; - else if (strcmp(privdata.pagesize,"w288h432-div2") == 0) + else if (strcmp(pd->pagesize,"w288h432-div2") == 0) media = '\0'; - else if (strcmp(privdata.pagesize,"B7") == 0) + else if (strcmp(pd->pagesize,"B7") == 0) media = '\1'; - else if (strcmp(privdata.pagesize,"w360h504") == 0) + else if (strcmp(pd->pagesize,"w360h504") == 0) media = '\3'; - else if (strcmp(privdata.pagesize,"w432h576") == 0) + else if (strcmp(pd->pagesize,"w432h576") == 0) media = '\6'; - else if (strcmp(privdata.pagesize,"w432h648") == 0) + else if (strcmp(pd->pagesize,"w432h648") == 0) media = '\5'; - else if (strcmp(privdata.pagesize,"w432h576-div2") == 0) + else if (strcmp(pd->pagesize,"w432h576-div2") == 0) media = '\5'; - else if (strcmp(privdata.pagesize,"w144h432") == 0) + else if (strcmp(pd->pagesize,"w144h432") == 0) media = '\7'; stp_put32_le(0x10, v); @@ -3509,22 +4074,22 @@ static void shinko_chcs2145_printer_init(stp_vars_t *v) stp_put32_le(media, v); /* Media Type */ stp_put32_le(0x00, v); - if (strcmp(privdata.pagesize,"w432h576-div2") == 0) { + if (strcmp(pd->pagesize,"w432h576-div2") == 0) { stp_put32_le(0x02, v); - } else if (strcmp(privdata.pagesize,"w288h432-div2") == 0) { + } else if (strcmp(pd->pagesize,"w288h432-div2") == 0) { stp_put32_le(0x04, v); } else { stp_put32_le(0x00, v); /* Print Method */ } - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); /* Print Mode */ + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); /* Print Mode */ stp_put32_le(0x00, v); stp_put32_le(0x00, v); stp_put32_le(0x00, v); - stp_put32_le(privdata.w_size, v); /* Columns */ - stp_put32_le(privdata.h_size, v); /* Rows */ + stp_put32_le(pd->w_size, v); /* Columns */ + stp_put32_le(pd->h_size, v); /* Rows */ stp_put32_le(0x01, v); /* Copies */ stp_put32_le(0x00, v); @@ -3534,7 +4099,7 @@ static void shinko_chcs2145_printer_init(stp_vars_t *v) stp_put32_le(0x00, v); stp_put32_le(0xffffffce, v); - stp_put32_le(privdata.w_dpi, v); /* Dots Per Inch */ + stp_put32_le(pd->w_dpi, v); /* Dots Per Inch */ stp_put32_le(0xffffffce, v); stp_put32_le(0x00, v); @@ -3601,29 +4166,31 @@ LIST(laminate_list_t, shinko_chcs1245_laminate_list, laminate_t, shinko_chcs1245 static void shinko_chcs1245_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + int media = 0; - if (strcmp(privdata.pagesize,"w288h576") == 0) + if (strcmp(pd->pagesize,"w288h576") == 0) media = 5; - else if (strcmp(privdata.pagesize,"w360h576") == 0) + else if (strcmp(pd->pagesize,"w360h576") == 0) media = 4; - else if (strcmp(privdata.pagesize,"w432h576") == 0) + else if (strcmp(pd->pagesize,"w432h576") == 0) media = 6; - else if (strcmp(privdata.pagesize,"w576h576") == 0) + else if (strcmp(pd->pagesize,"w576h576") == 0) media = 9; - else if (strcmp(privdata.pagesize,"w576h576-div2") == 0) + else if (strcmp(pd->pagesize,"w576h576-div2") == 0) media = 2; - else if (strcmp(privdata.pagesize,"c8x10") == 0) + else if (strcmp(pd->pagesize,"c8x10") == 0) media = 0; - else if (strcmp(privdata.pagesize,"c8x10-w576h432_w576h288") == 0) + else if (strcmp(pd->pagesize,"c8x10-w576h432_w576h288") == 0) media = 3; - else if (strcmp(privdata.pagesize,"c8x10-div2") == 0) + else if (strcmp(pd->pagesize,"c8x10-div2") == 0) media = 1; - else if (strcmp(privdata.pagesize,"w576h864") == 0) + else if (strcmp(pd->pagesize,"w576h864") == 0) media = 0; - else if (strcmp(privdata.pagesize,"w576h864-div2") == 0) + else if (strcmp(pd->pagesize,"w576h864-div2") == 0) media = 7; - else if (strcmp(privdata.pagesize,"w576h864-div3") == 0) + else if (strcmp(pd->pagesize,"w576h864-div3") == 0) media = 8; stp_put32_le(0x10, v); @@ -3637,19 +4204,19 @@ static void shinko_chcs1245_printer_init(stp_vars_t *v) stp_put32_le(0x00, v); stp_put32_le(media, v); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); /* Print Mode */ + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); /* Print Mode */ stp_put32_le(0x00, v); - if (((const unsigned char*)(privdata.laminate->seq).data)[0] == 0x02 || - ((const unsigned char*)(privdata.laminate->seq).data)[0] == 0x03) { + if (((const unsigned char*)(pd->laminate->seq).data)[0] == 0x02 || + ((const unsigned char*)(pd->laminate->seq).data)[0] == 0x03) { stp_put32_le(0x07fffffff, v); /* Glossy */ } else { stp_put32_le(0x0, v); /* XXX matte intensity -25>0>+25 */ } stp_put32_le(0x00, v); /* XXX "dust removal mode" -- 0x00 printer default, 0x02 on, 0x01 for off. */ - stp_put32_le(privdata.w_size, v); /* Columns */ - stp_put32_le(privdata.h_size, v); /* Rows */ + stp_put32_le(pd->w_size, v); /* Columns */ + stp_put32_le(pd->h_size, v); /* Rows */ stp_put32_le(0x01, v); /* Copies */ stp_put32_le(0x00, v); @@ -3659,7 +4226,7 @@ static void shinko_chcs1245_printer_init(stp_vars_t *v) stp_put32_le(0x00, v); stp_put32_le(0xffffffce, v); - stp_put32_le(privdata.w_dpi, v); /* Dots Per Inch */ + stp_put32_le(pd->w_dpi, v); /* Dots Per Inch */ stp_put32_le(0xffffffce, v); stp_put32_le(0x00, v); @@ -3714,27 +4281,28 @@ LIST(laminate_list_t, shinko_chcs6245_laminate_list, laminate_t, shinko_chcs6245 static void shinko_chcs6245_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); int media = 0; - if (strcmp(privdata.pagesize,"w288h576") == 0) + if (strcmp(pd->pagesize,"w288h576") == 0) media = 0x20; - else if (strcmp(privdata.pagesize,"w360h576") == 0) + else if (strcmp(pd->pagesize,"w360h576") == 0) media = 0x21; - else if (strcmp(privdata.pagesize,"w432h576") == 0) + else if (strcmp(pd->pagesize,"w432h576") == 0) media = 0x22; - else if (strcmp(privdata.pagesize,"w576h576") == 0) + else if (strcmp(pd->pagesize,"w576h576") == 0) media = 0x23; - else if (strcmp(privdata.pagesize,"c8x10") == 0) + else if (strcmp(pd->pagesize,"c8x10") == 0) media = 0x10; - else if (strcmp(privdata.pagesize,"w576h864") == 0) + else if (strcmp(pd->pagesize,"w576h864") == 0) media = 0x11; - else if (strcmp(privdata.pagesize,"w576h576-div2") == 0) + else if (strcmp(pd->pagesize,"w576h576-div2") == 0) media = 0x30; - else if (strcmp(privdata.pagesize,"c8x10-div2") == 0) + else if (strcmp(pd->pagesize,"c8x10-div2") == 0) media = 0x31; - else if (strcmp(privdata.pagesize,"w576h864-div2") == 0) + else if (strcmp(pd->pagesize,"w576h864-div2") == 0) media = 0x32; - else if (strcmp(privdata.pagesize,"w576h864-div3") == 0) + else if (strcmp(pd->pagesize,"w576h864-div3") == 0) media = 0x40; stp_put32_le(0x10, v); @@ -3749,13 +4317,13 @@ static void shinko_chcs6245_printer_init(stp_vars_t *v) stp_put32_le(0x00, v); stp_put32_le(0x00, v); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); /* Lamination */ + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); /* Lamination */ stp_put32_le(0x00, v); stp_put32_le(0x00, v); - stp_put32_le(privdata.w_size, v); /* Columns */ - stp_put32_le(privdata.h_size, v); /* Rows */ + stp_put32_le(pd->w_size, v); /* Columns */ + stp_put32_le(pd->h_size, v); /* Rows */ stp_put32_le(0x01, v); /* Copies */ stp_put32_le(0x00, v); @@ -3765,7 +4333,7 @@ static void shinko_chcs6245_printer_init(stp_vars_t *v) stp_put32_le(0x00, v); stp_put32_le(0xffffffce, v); - stp_put32_le(privdata.w_dpi, v); /* Dots Per Inch */ + stp_put32_le(pd->w_dpi, v); /* Dots Per Inch */ stp_put32_le(0xffffffce, v); stp_put32_le(0x00, v); @@ -3831,33 +4399,35 @@ LIST(laminate_list_t, shinko_chcs6145_laminate_list, laminate_t, shinko_chcs6145 static void shinko_chcs6145_printer_init(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + int media = 0; - if (strcmp(privdata.pagesize,"w288h432") == 0) + if (strcmp(pd->pagesize,"w288h432") == 0) media = 0x00; - else if (strcmp(privdata.pagesize,"w288h432-div2") == 0) + else if (strcmp(pd->pagesize,"w288h432-div2") == 0) media = 0x00; - else if (strcmp(privdata.pagesize,"w360h360") == 0) + else if (strcmp(pd->pagesize,"w360h360") == 0) media = 0x08; - else if (strcmp(privdata.pagesize,"w360h504") == 0) + else if (strcmp(pd->pagesize,"w360h504") == 0) media = 0x03; - else if (strcmp(privdata.pagesize,"w432h432") == 0) + else if (strcmp(pd->pagesize,"w432h432") == 0) media = 0x06; - else if (strcmp(privdata.pagesize,"w432h576") == 0) + else if (strcmp(pd->pagesize,"w432h576") == 0) media = 0x06; - else if (strcmp(privdata.pagesize,"w144h432") == 0) + else if (strcmp(pd->pagesize,"w144h432") == 0) media = 0x07; - else if (strcmp(privdata.pagesize,"w432h576-w432h432_w432h144") == 0) + else if (strcmp(pd->pagesize,"w432h576-w432h432_w432h144") == 0) media = 0x06; - else if (strcmp(privdata.pagesize,"w432h576-div2") == 0) + else if (strcmp(pd->pagesize,"w432h576-div2") == 0) media = 0x06; - else if (strcmp(privdata.pagesize,"w432h648") == 0) + else if (strcmp(pd->pagesize,"w432h648") == 0) media = 0x05; stp_put32_le(0x10, v); stp_put32_le(6145, v); /* Printer Model */ - if (!strcmp(privdata.pagesize,"w360h360") || - !strcmp(privdata.pagesize,"w360h504")) + if (!strcmp(pd->pagesize,"w360h360") || + !strcmp(pd->pagesize,"w360h504")) stp_put32_le(0x02, v); /* 5" media */ else stp_put32_le(0x03, v); /* 6" media */ @@ -3868,23 +4438,23 @@ static void shinko_chcs6145_printer_init(stp_vars_t *v) stp_put32_le(media, v); /* Media Type */ stp_put32_le(0x00, v); - if (strcmp(privdata.pagesize,"w432h576-w432h432_w432h144") == 0) { + if (strcmp(pd->pagesize,"w432h576-w432h432_w432h144") == 0) { stp_put32_le(0x05, v); - } else if (strcmp(privdata.pagesize,"w288h432-div2") == 0) { + } else if (strcmp(pd->pagesize,"w288h432-div2") == 0) { stp_put32_le(0x04, v); - } else if (strcmp(privdata.pagesize,"w432h576-div2") == 0) { + } else if (strcmp(pd->pagesize,"w432h576-div2") == 0) { stp_put32_le(0x02, v); } else { stp_put32_le(0x00, v); } stp_put32_le(0x00, v); /* XXX quality; 00 == default, 0x01 == std */ - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); /* Lamination */ + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); /* Lamination */ stp_put32_le(0x00, v); stp_put32_le(0x00, v); - stp_put32_le(privdata.w_size, v); /* Columns */ - stp_put32_le(privdata.h_size, v); /* Rows */ + stp_put32_le(pd->w_size, v); /* Columns */ + stp_put32_le(pd->h_size, v); /* Rows */ stp_put32_le(0x01, v); /* Copies */ stp_put32_le(0x00, v); @@ -3894,7 +4464,7 @@ static void shinko_chcs6145_printer_init(stp_vars_t *v) stp_put32_le(0x00, v); stp_put32_le(0xffffffce, v); - stp_put32_le(privdata.w_dpi, v); /* Dots Per Inch */ + stp_put32_le(pd->w_dpi, v); /* Dots Per Inch */ stp_put32_le(0xffffffce, v); stp_put32_le(0x00, v); @@ -3996,10 +4566,12 @@ LIST(laminate_list_t, dnpds40_laminate_list, laminate_t, dnpds40_laminate); static void dnp_printer_start_common(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Configure Lamination */ stp_zprintf(v, "\033PCNTRL OVERCOAT 0000000800000"); - stp_zfwrite((privdata.laminate->seq).data, 1, - (privdata.laminate->seq).bytes, v); /* Lamination mode */ + stp_zfwrite((pd->laminate->seq).data, 1, + (pd->laminate->seq).bytes, v); /* Lamination mode */ /* Set quantity.. Backend overrides as needed. */ stp_zprintf(v, "\033PCNTRL QTY 000000080000001\r"); @@ -4007,14 +4579,16 @@ static void dnp_printer_start_common(stp_vars_t *v) static void dnpds40_printer_start(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Common code */ dnp_printer_start_common(v); /* Set cutter option to "normal" */ stp_zprintf(v, "\033PCNTRL CUTTER 0000000800000"); - if (!strcmp(privdata.pagesize, "w288h432-div2")) { + if (!strcmp(pd->pagesize, "w288h432-div2")) { stp_zprintf(v, "120"); - } else if (!strcmp(privdata.pagesize, "w432h576-div4")) { + } else if (!strcmp(pd->pagesize, "w432h576-div4")) { stp_zprintf(v, "120"); } else { stp_zprintf(v, "000"); @@ -4023,23 +4597,23 @@ static void dnpds40_printer_start(stp_vars_t *v) /* Configure multi-cut/page size */ stp_zprintf(v, "\033PIMAGE MULTICUT 00000008000000"); - if (!strcmp(privdata.pagesize, "B7")) { + if (!strcmp(pd->pagesize, "B7")) { stp_zprintf(v, "01"); - } else if (!strcmp(privdata.pagesize, "w288h432")) { + } else if (!strcmp(pd->pagesize, "w288h432")) { stp_zprintf(v, "02"); - } else if (!strcmp(privdata.pagesize, "w360h504")) { + } else if (!strcmp(pd->pagesize, "w360h504")) { stp_zprintf(v, "03"); - } else if (!strcmp(privdata.pagesize, "w360h504-div2")) { + } else if (!strcmp(pd->pagesize, "w360h504-div2")) { stp_zprintf(v, "22"); - } else if (!strcmp(privdata.pagesize, "w432h576")) { + } else if (!strcmp(pd->pagesize, "w432h576")) { stp_zprintf(v, "04"); - } else if (!strcmp(privdata.pagesize, "w432h648")) { + } else if (!strcmp(pd->pagesize, "w432h648")) { stp_zprintf(v, "05"); - } else if (!strcmp(privdata.pagesize, "w432h576-div2")) { + } else if (!strcmp(pd->pagesize, "w432h576-div2")) { stp_zprintf(v, "12"); - } else if (!strcmp(privdata.pagesize, "w288h432-div2")) { + } else if (!strcmp(pd->pagesize, "w288h432-div2")) { stp_zprintf(v, "02"); - } else if (!strcmp(privdata.pagesize, "w432h576-div4")) { + } else if (!strcmp(pd->pagesize, "w432h576-div4")) { stp_zprintf(v, "04"); } else { stp_zprintf(v, "00"); /* should be impossible. */ @@ -4053,12 +4627,14 @@ static void dnpds40_printer_end(stp_vars_t *v) static void dnpds40_plane_init(stp_vars_t *v) { - char p = (privdata.plane == 3 ? 'Y' : - (privdata.plane == 2 ? 'M' : + dyesub_privdata_t *pd = get_privdata(v); + + char p = (pd->plane == 3 ? 'Y' : + (pd->plane == 2 ? 'M' : 'C' )); long PadSize = 10; - long FSize = (privdata.w_size*privdata.h_size) + 1024 + 54 + PadSize; + long FSize = (pd->w_size*pd->h_size) + 1024 + 54 + PadSize; /* Printer command plus length of data to follow */ stp_zprintf(v, "\033PIMAGE %cPLANE %08ld", p, FSize); @@ -4073,13 +4649,13 @@ static void dnpds40_plane_init(stp_vars_t *v) /* DIB header */ stp_put32_le(40, v); /* DIB header size */ - stp_put32_le(privdata.w_size, v); - stp_put32_le(privdata.h_size, v); + stp_put32_le(pd->w_size, v); + stp_put32_le(pd->h_size, v); stp_put16_le(1, v); /* single channel */ stp_put16_le(8, v); /* 8bpp */ dyesub_nputc(v, '\0', 8); /* compression + image size are ignored */ stp_put32_le(11808, v); /* horizontal pixels per meter, fixed at 300dpi */ - if (privdata.h_dpi == 600) + if (pd->h_dpi == 600) stp_put32_le(23615, v); /* vertical pixels per meter @ 600dpi */ else stp_put32_le(11808, v); /* vertical pixels per meter @ 300dpi */ @@ -4090,6 +4666,7 @@ static void dnpds40_plane_init(stp_vars_t *v) } /* Dai Nippon Printing DS80 */ + /* Imaging area is wider than print size, we always must supply the printer with the full imaging width. */ static const dyesub_pagesize_t dnpds80_page[] = @@ -4149,8 +4726,58 @@ static const dyesub_printsize_t dnpds80_printsize[] = LIST(dyesub_printsize_list_t, dnpds80_printsize_list, dyesub_printsize_t, dnpds80_printsize); +static int dnpds80_parse_parameters(stp_vars_t *v) +{ + const char *pagesize = stp_get_string_parameter(v, "PageSize"); + dyesub_privdata_t *pd = get_privdata(v); + int multicut = 0; + + if (!strcmp(pagesize, "c8x10")) { + multicut = 6; + } else if (!strcmp(pagesize, "w576h864")) { + multicut = 7; + } else if (!strcmp(pagesize, "w288h576")) { + multicut = 8; + } else if (!strcmp(pagesize, "w360h576")) { + multicut = 9; + } else if (!strcmp(pagesize, "w432h576")) { + multicut = 10; + } else if (!strcmp(pagesize, "w576h576")) { + multicut = 11; + } else if (!strcmp(pagesize, "w576h576-div2")) { + multicut = 13; + } else if (!strcmp(pagesize, "c8x10-div2")) { + multicut = 14; + } else if (!strcmp(pagesize, "w576h864-div2")) { + multicut = 15; + } else if (!strcmp(pagesize, "w576h648-w576h360_w576h288")) { + multicut = 16; + } else if (!strcmp(pagesize, "c8x10-w576h432_w576h288")) { + multicut = 17; + } else if (!strcmp(pagesize, "w576h792-w576h432_w576h360")) { + multicut = 18; + } else if (!strcmp(pagesize, "w576h864-w576h576_w576h288")) { + multicut = 19; + } else if (!strcmp(pagesize, "w576h864-div3")) { + multicut = 20; + } else if (!strcmp(pagesize, "A4")) { + multicut = 21; + } else { + stp_eprintf(v, _("Illegal print size selected for roll media!\n")); + return 0; + } + + /* No need to set global params if there's no privdata yet */ + if (pd) + pd->privdata.dnp.multicut = multicut; + + return 1; +} + static void dnpds80_printer_start(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Common code */ dnp_printer_start_common(v); @@ -4158,41 +4785,7 @@ static void dnpds80_printer_start(stp_vars_t *v) stp_zprintf(v, "\033PCNTRL CUTTER 0000000800000000"); /* Configure multi-cut/page size */ - stp_zprintf(v, "\033PIMAGE MULTICUT 00000008000000"); - - if (!strcmp(privdata.pagesize, "c8x10")) { - stp_zprintf(v, "06"); - } else if (!strcmp(privdata.pagesize, "w576h864")) { - stp_zprintf(v, "07"); - } else if (!strcmp(privdata.pagesize, "w288h576")) { - stp_zprintf(v, "08"); - } else if (!strcmp(privdata.pagesize, "w360h576")) { - stp_zprintf(v, "09"); - } else if (!strcmp(privdata.pagesize, "w432h576")) { - stp_zprintf(v, "10"); - } else if (!strcmp(privdata.pagesize, "w576h576")) { - stp_zprintf(v, "11"); - } else if (!strcmp(privdata.pagesize, "w576h576-div2")) { - stp_zprintf(v, "13"); - } else if (!strcmp(privdata.pagesize, "c8x10-div2")) { - stp_zprintf(v, "14"); - } else if (!strcmp(privdata.pagesize, "w576h864-div2")) { - stp_zprintf(v, "15"); - } else if (!strcmp(privdata.pagesize, "w576h648-w576h360_w576h288")) { - stp_zprintf(v, "16"); - } else if (!strcmp(privdata.pagesize, "c8x10-w576h432_w576h288")) { - stp_zprintf(v, "17"); - } else if (!strcmp(privdata.pagesize, "w576h792-w576h432_w576h360")) { - stp_zprintf(v, "18"); - } else if (!strcmp(privdata.pagesize, "w576h864-w576h576_w576h288")) { - stp_zprintf(v, "19"); - } else if (!strcmp(privdata.pagesize, "w576h864-div3")) { - stp_zprintf(v, "20"); - } else if (!strcmp(privdata.pagesize, "A4")) { - stp_zprintf(v, "21"); - } else { - stp_zprintf(v, "00"); /* should not be possible */ - } + stp_zprintf(v, "\033PIMAGE MULTICUT 00000008%08d", pd->privdata.dnp.multicut); } /* Dai Nippon Printing DS80DX */ @@ -4204,6 +4797,75 @@ static const dyesub_media_t dnpds80dx_medias[] = LIST(dyesub_media_list_t, dnpds80dx_media_list, dyesub_media_t, dnpds80dx_medias); +static int dnpds80dx_parse_parameters(stp_vars_t *v) +{ + const char *pagesize; + const dyesub_media_t* media = NULL; + const char* duplex_mode; + int page_number; + dyesub_privdata_t *pd = get_privdata(v); + int multicut = 0; + + pagesize = stp_get_string_parameter(v, "PageSize"); + duplex_mode = stp_get_string_parameter(v, "Duplex"); + media = dyesub_get_mediatype(v); + page_number = stp_get_int_parameter(v, "PageNumber"); + + if (!strcmp(media->name, "Roll")) { + if (strcmp(duplex_mode, "None") && strcmp(duplex_mode, "Standard")) { + stp_eprintf(v, _("Duplex not supported on roll media, switching to sheet media!\n")); + stp_set_string_parameter(v, "MediaType", "Sheet"); + } else { + /* If we're not using duplex and roll media, this is + effectively a DS80 (non-DX) */ + return dnpds80_parse_parameters(v); + } + } + + if (!strcmp(pagesize, "c8x10")) { + multicut = 6; + } else if (!strcmp(pagesize, "w576h864")) { + multicut = 7; + } else if (!strcmp(pagesize, "w288h576")) { + multicut = 8; + } else if (!strcmp(pagesize, "w360h576")) { + multicut = 9; + } else if (!strcmp(pagesize, "w432h576")) { + multicut = 10; + } else if (!strcmp(pagesize, "w576h576")) { + multicut = 11; + } else if (!strcmp(pagesize, "w576h774-w576h756")) { + multicut = 25; + } else if (!strcmp(pagesize, "w576h774")) { + multicut = 26; + } else if (!strcmp(pagesize, "w576h576-div2")) { + multicut = 13; + } else if (!strcmp(pagesize, "c8x10-div2")) { + multicut = 14; + } else if (!strcmp(pagesize, "w576h864-div2")) { + multicut = 15; + } else if (!strcmp(pagesize, "w576h864-div3sheet")) { + multicut = 28; + } else { + stp_eprintf(v, _("Illegal print size selected for sheet media!\n")); + return 0; + } + + /* Add correct offset to multicut mode based on duplex state */ + if (!strcmp(duplex_mode, "None") || !strcmp(duplex_mode, "Standard")) + multicut += 100; /* Simplex */ + else if (page_number & 1) + multicut += 300; /* Duplex, back */ + else + multicut += 200; /* Duplex, front */ + + /* No need to set global params if there's no privdata yet */ + if (pd) + pd->privdata.dnp.multicut = multicut; + + return 1; +} + /* This is the same as the DS80, except with 10.5" and 10.75" sizes only meant for sheet media. Duplex is *only* supported on sheet media. @@ -4278,62 +4940,6 @@ static const dyesub_printsize_t dnpds80dx_printsize[] = LIST(dyesub_printsize_list_t, dnpds80dx_printsize_list, dyesub_printsize_t, dnpds80dx_printsize); -static void dnpds80dx_printer_start(stp_vars_t *v) -{ - int multicut; - - /* If we're using roll media, act the same as a standard DS80 */ - if (!strcmp(privdata.media->name, "Roll")) - { - dnpds80_printer_start(v); - return; - } - - /* Common code */ - dnp_printer_start_common(v); - - /* Set cutter option to "normal" */ - stp_zprintf(v, "\033PCNTRL CUTTER 0000000800000000"); - - if (!strcmp(privdata.pagesize, "c8x10")) { - multicut = 6; - } else if (!strcmp(privdata.pagesize, "w576h864")) { - multicut = 7; - } else if (!strcmp(privdata.pagesize, "w288h576")) { - multicut = 8; - } else if (!strcmp(privdata.pagesize, "w360h576")) { - multicut = 9; - } else if (!strcmp(privdata.pagesize, "w432h576")) { - multicut = 10; - } else if (!strcmp(privdata.pagesize, "w576h576")) { - multicut = 11; - } else if (!strcmp(privdata.pagesize, "w576h774-w576h756")) { - multicut = 25; - } else if (!strcmp(privdata.pagesize, "w576h774")) { - multicut = 26; - } else if (!strcmp(privdata.pagesize, "w576h576-div2")) { - multicut = 13; - } else if (!strcmp(privdata.pagesize, "c8x10-div2")) { - multicut = 14; - } else if (!strcmp(privdata.pagesize, "w576h864-div2")) { - multicut = 15; - } else if (!strcmp(privdata.pagesize, "w576h864-div3sheet")) { - multicut = 28; - } else { - multicut = 0; - } - - /* Add correct offset to multicut mode based on duplex state */ - if (!strcmp(privdata.duplex_mode, "None")) - multicut += 100; /* Simplex */ - else if (privdata.page_number & 1) - multicut += 300; /* Duplex, back */ - else - multicut += 200; /* Duplex, front */ - - stp_zprintf(v, "\033PIMAGE MULTICUT 00000008%08d", multicut); -} - /* Dai Nippon Printing DS-RX1 */ /* Imaging area is wider than print size, we always must supply the printer with the full imaging width. */ @@ -4375,14 +4981,16 @@ LIST(dyesub_printsize_list_t, dnpsrx1_printsize_list, dyesub_printsize_t, dnpsrx static void dnpdsrx1_printer_start(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Common code */ dnp_printer_start_common(v); /* Set cutter option to "normal" */ stp_zprintf(v, "\033PCNTRL CUTTER 0000000800000"); - if (!strcmp(privdata.pagesize, "w288h432-div2")) { + if (!strcmp(pd->pagesize, "w288h432-div2")) { stp_zprintf(v, "120"); - } else if (!strcmp(privdata.pagesize, "w432h576-div4")) { + } else if (!strcmp(pd->pagesize, "w432h576-div4")) { stp_zprintf(v, "120"); } else { stp_zprintf(v, "000"); @@ -4391,21 +4999,21 @@ static void dnpdsrx1_printer_start(stp_vars_t *v) /* Configure multi-cut/page size */ stp_zprintf(v, "\033PIMAGE MULTICUT 00000008000000"); - if (!strcmp(privdata.pagesize, "B7")) { + if (!strcmp(pd->pagesize, "B7")) { stp_zprintf(v, "01"); - } else if (!strcmp(privdata.pagesize, "w288h432")) { + } else if (!strcmp(pd->pagesize, "w288h432")) { stp_zprintf(v, "02"); - } else if (!strcmp(privdata.pagesize, "w360h504")) { + } else if (!strcmp(pd->pagesize, "w360h504")) { stp_zprintf(v, "03"); - } else if (!strcmp(privdata.pagesize, "w360h504-div2")) { + } else if (!strcmp(pd->pagesize, "w360h504-div2")) { stp_zprintf(v, "22"); - } else if (!strcmp(privdata.pagesize, "w432h576")) { + } else if (!strcmp(pd->pagesize, "w432h576")) { stp_zprintf(v, "04"); - } else if (!strcmp(privdata.pagesize, "w432h576-div2")) { + } else if (!strcmp(pd->pagesize, "w432h576-div2")) { stp_zprintf(v, "12"); - } else if (!strcmp(privdata.pagesize, "w288h432-div2")) { + } else if (!strcmp(pd->pagesize, "w288h432-div2")) { stp_zprintf(v, "02"); - } else if (!strcmp(privdata.pagesize, "w432h576-div4")) { + } else if (!strcmp(pd->pagesize, "w432h576-div4")) { stp_zprintf(v, "04"); } else { stp_zprintf(v, "00"); @@ -4480,54 +5088,56 @@ LIST(dyesub_printsize_list_t, dnpds620_printsize_list, dyesub_printsize_t, dnpds static void dnpds620_printer_start(stp_vars_t *v) { + dyesub_privdata_t *pd = get_privdata(v); + /* Common code */ dnp_printer_start_common(v); /* Multicut when 8x6 media is in use */ - if (!strcmp(privdata.pagesize, "w432h576") && - !strcmp(privdata.pagesize, "w432h648")) { + if (!strcmp(pd->pagesize, "w432h576") || + !strcmp(pd->pagesize, "w432h648")) { stp_zprintf(v, "\033PCNTRL FULL_CUTTER_SET 00000016"); stp_zprintf(v, "0000000000000000"); - } else if (!strcmp(privdata.pagesize, "w432h576-div4")) { + } else if (!strcmp(pd->pagesize, "w432h576-div4")) { stp_zprintf(v, "\033PCNTRL FULL_CUTTER_SET 00000016"); stp_zprintf(v, "0200200200200000"); - } else if (!strcmp(privdata.pagesize, "w432h576-w432h432_w432h144")) { + } else if (!strcmp(pd->pagesize, "w432h576-w432h432_w432h144")) { stp_zprintf(v, "\033PCNTRL FULL_CUTTER_SET 00000016"); stp_zprintf(v, "0600200000000000"); - } else if (!strcmp(privdata.pagesize, "w288h432-div2")) { + } else if (!strcmp(pd->pagesize, "w288h432-div2")) { stp_zprintf(v, "\033PCNTRL CUTTER 00000008"); stp_zprintf(v, "00000120"); } /* Configure multi-cut/page size */ stp_zprintf(v, "\033PIMAGE MULTICUT 00000008000000"); - if (!strcmp(privdata.pagesize, "B7")) { + if (!strcmp(pd->pagesize, "B7")) { stp_zprintf(v, "01"); - } else if (!strcmp(privdata.pagesize, "w288h432")) { + } else if (!strcmp(pd->pagesize, "w288h432")) { stp_zprintf(v, "02"); - } else if (!strcmp(privdata.pagesize, "w288h432-div2")) { + } else if (!strcmp(pd->pagesize, "w288h432-div2")) { stp_zprintf(v, "02"); - } else if (!strcmp(privdata.pagesize, "w324h432")) { + } else if (!strcmp(pd->pagesize, "w324h432")) { stp_zprintf(v, "30"); - } else if (!strcmp(privdata.pagesize, "w360h360")) { + } else if (!strcmp(pd->pagesize, "w360h360")) { stp_zprintf(v, "29"); - } else if (!strcmp(privdata.pagesize, "w360h504")) { + } else if (!strcmp(pd->pagesize, "w360h504")) { stp_zprintf(v, "03"); - } else if (!strcmp(privdata.pagesize, "w360h504-div2")) { + } else if (!strcmp(pd->pagesize, "w360h504-div2")) { stp_zprintf(v, "22"); - } else if (!strcmp(privdata.pagesize, "w432h432")) { + } else if (!strcmp(pd->pagesize, "w432h432")) { stp_zprintf(v, "27"); - } else if (!strcmp(privdata.pagesize, "w432h576")) { + } else if (!strcmp(pd->pagesize, "w432h576")) { stp_zprintf(v, "04"); - } else if (!strcmp(privdata.pagesize, "w432h576-w432h432_w432h144")) { + } else if (!strcmp(pd->pagesize, "w432h576-w432h432_w432h144")) { stp_zprintf(v, "04"); - } else if (!strcmp(privdata.pagesize, "w432h576-div4")) { + } else if (!strcmp(pd->pagesize, "w432h576-div4")) { stp_zprintf(v, "04"); - } else if (!strcmp(privdata.pagesize, "w432h576-div2")) { + } else if (!strcmp(pd->pagesize, "w432h576-div2")) { stp_zprintf(v, "12"); - } else if (!strcmp(privdata.pagesize, "w432h648")) { + } else if (!strcmp(pd->pagesize, "w432h648")) { stp_zprintf(v, "05"); - } else if (!strcmp(privdata.pagesize, "w432h648-div2")) { + } else if (!strcmp(pd->pagesize, "w432h648-div2")) { stp_zprintf(v, "31"); } else { stp_zprintf(v, "00"); /* Should be impossible */ @@ -4578,65 +5188,69 @@ LIST(dyesub_printsize_list_t, citizen_cw01_printsize_list, dyesub_printsize_t, c static void citizen_cw01_printer_start(stp_vars_t *v) { - int media = 0; - - if (strcmp(privdata.pagesize,"w252h338") == 0) - media = 0x00; - else if (strcmp(privdata.pagesize,"B7") == 0) - media = 0x01; - else if (strcmp(privdata.pagesize,"w288h432") == 0) - media = 0x02; - else if (strcmp(privdata.pagesize,"w338h504") == 0) - media = 0x03; - else if (strcmp(privdata.pagesize,"w360h504") == 0) - media = 0x04; - else if (strcmp(privdata.pagesize,"w432h576") == 0) - media = 0x05; - else if (strcmp(privdata.pagesize,"w432h576") == 0) - media = 0x06; - - stp_putc(media, v); - if (privdata.h_dpi == 600) { - stp_putc(0x01, v); - } else { - stp_putc(0x00, v); - } - stp_putc(0x01, v); /* This is actually number of copies */ - stp_putc(0x00, v); + dyesub_privdata_t *pd = get_privdata(v); - /* Compute plane size */ - media = (privdata.w_size * privdata.h_size) + 1024 + 40; + int media = 0; + + if (strcmp(pd->pagesize,"w252h338") == 0) + media = 0x00; + else if (strcmp(pd->pagesize,"B7") == 0) + media = 0x01; + else if (strcmp(pd->pagesize,"w288h432") == 0) + media = 0x02; + else if (strcmp(pd->pagesize,"w338h504") == 0) + media = 0x03; + else if (strcmp(pd->pagesize,"w360h504") == 0) + media = 0x04; + else if (strcmp(pd->pagesize,"w432h576") == 0) + media = 0x05; + else if (strcmp(pd->pagesize,"w432h576") == 0) + media = 0x06; + + stp_putc(media, v); + if (pd->h_dpi == 600) { + stp_putc(0x01, v); + } else { + stp_putc(0x00, v); + } + stp_putc(0x01, v); /* This is actually number of copies */ + stp_putc(0x00, v); - stp_put32_le(media, v); - stp_put32_le(0x0, v); + /* Compute plane size */ + media = (pd->w_size * pd->h_size) + 1024 + 40; + + stp_put32_le(media, v); + stp_put32_le(0x0, v); } static void citizen_cw01_plane_init(stp_vars_t *v) { - int i; - - stp_put32_le(0x28, v); - stp_put32_le(0x0800, v); - stp_put16_le(privdata.h_size, v); /* number of rows */ - stp_put16_le(0x0, v); - stp_put32_le(0x080001, v); - stp_put32_le(0x00, v); - stp_put32_le(0x00, v); - stp_put32_le(0x335a, v); - if (privdata.h_dpi == 600) { - stp_put32_le(0x5c40, v); - } else { - stp_put32_le(0x335a, v); - } - stp_put32_le(0x0100, v); - stp_put32_le(0x00, v); - - /* Write the color curve data. */ - for (i = 0xff; i >= 0 ; i--) { - unsigned long tmp; - tmp = i | (i << 8) | (i << 16); - stp_put32_le(tmp, v); - } + dyesub_privdata_t *pd = get_privdata(v); + + int i; + + stp_put32_le(0x28, v); + stp_put32_le(0x0800, v); + stp_put16_le(pd->h_size, v); /* number of rows */ + stp_put16_le(0x0, v); + stp_put32_le(0x080001, v); + stp_put32_le(0x00, v); + stp_put32_le(0x00, v); + stp_put32_le(0x335a, v); + if (pd->h_dpi == 600) { + stp_put32_le(0x5c40, v); + } else { + stp_put32_le(0x335a, v); + } + stp_put32_le(0x0100, v); + stp_put32_le(0x00, v); + + /* Write the color curve data. */ + for (i = 0xff; i >= 0 ; i--) { + unsigned long tmp; + tmp = i | (i << 8) | (i << 16); + stp_put32_le(tmp, v); + } } /* Model capabilities */ @@ -4655,7 +5269,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &p10_printer_init_func, &p10_printer_end_func, NULL, NULL, &p10_block_init_func, NULL, - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &p10_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4672,7 +5286,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &p200_printer_init_func, &p200_printer_end_func, &p200_plane_init_func, NULL, NULL, NULL, - p200_adj_any, p200_adj_any, p200_adj_any, + &p200_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4689,7 +5303,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &p300_printer_init_func, NULL, NULL, &p300_plane_end_func, &p300_block_init_func, NULL, - p300_adj_cyan, p300_adj_magenta, p300_adj_yellow, + &p300_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4706,7 +5320,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &p400_printer_init_func, NULL, &p400_plane_init_func, &p400_plane_end_func, &p400_block_init_func, NULL, - p400_adj_cyan, p400_adj_magenta, p400_adj_yellow, + &p400_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4722,7 +5336,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &p440_printer_init_func, &p440_printer_end_func, NULL, NULL, &p440_block_init_func, &p440_block_end_func, - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &p10_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4738,7 +5352,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &ps100_printer_init_func, &ps100_printer_end_func, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4756,7 +5370,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &cp10_printer_init_func, NULL, &cpx00_plane_init_func, NULL, NULL, NULL, - cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow, + &cpx00_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4774,7 +5388,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &cpx00_printer_init_func, NULL, &cpx00_plane_init_func, NULL, NULL, NULL, - cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow, + &cpx00_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4795,7 +5409,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &cpx00_printer_init_func, NULL, &cpx00_plane_init_func, NULL, NULL, NULL, - cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow, + cpx00_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4813,7 +5427,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &es1_printer_init_func, NULL, &es1_plane_init_func, NULL, NULL, NULL, - cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow, + cpx00_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4831,7 +5445,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &es2_printer_init_func, NULL, &es2_plane_init_func, NULL, NULL, NULL, - cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow, + cpx00_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4849,7 +5463,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &es3_printer_init_func, &es3_printer_end_func, &es2_plane_init_func, NULL, NULL, NULL, - cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow, + cpx00_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4867,7 +5481,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &es40_printer_init_func, &es3_printer_end_func, &es2_plane_init_func, NULL, NULL, NULL, - cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow, + cpx00_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4885,7 +5499,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &cp790_printer_init_func, &es3_printer_end_func, &es2_plane_init_func, NULL, NULL, NULL, - cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow, + cpx00_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4903,7 +5517,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &cpx00_printer_init_func, NULL, &cpx00_plane_init_func, NULL, NULL, NULL, - cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow, + cpx00_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4921,7 +5535,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &cpx00_printer_init_func, &cp900_printer_end_func, &cpx00_plane_init_func, NULL, NULL, NULL, - cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow, + cpx00_adjust_curves, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4939,7 +5553,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &cp910_printer_init_func, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, /* Printer handles color correction! */ + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4956,7 +5570,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &updp10_printer_init_func, &updp10_printer_end_func, NULL, NULL, NULL, NULL, - updp10_adj_cyan, updp10_adj_magenta, updp10_adj_yellow, + updp10_adjust_curves, &updp10_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4972,7 +5586,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &updr150_printer_init_func, &updr150_printer_end_func, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, &updp10_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -4989,7 +5603,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &dppex5_printer_init, &dppex5_printer_end, NULL, NULL, &dppex5_block_init, NULL, - NULL, NULL, NULL, + NULL, &dppex5_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5005,7 +5619,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &updr100_printer_init_func, &updr100_printer_end_func, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, &updr100_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5021,7 +5635,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &updr200_printer_init_func, &updr150_printer_end_func, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, &updr200_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5037,7 +5651,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &upcr10_printer_init_func, &upcr10_printer_end_func, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5054,7 +5668,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &cx400_printer_init_func, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5071,7 +5685,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &cx400_printer_init_func, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5087,7 +5701,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &nx500_printer_init_func, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5104,7 +5718,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &kodak_dock_printer_init, NULL, &kodak_dock_plane_init, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5120,7 +5734,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &kodak_68xx_printer_init, NULL, NULL, NULL, /* No plane funcs */ NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &kodak_6800_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5136,7 +5750,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &kodak_68xx_printer_init, NULL, NULL, NULL, /* No plane funcs */ NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &kodak_6800_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5152,7 +5766,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &kodak_605_printer_init, NULL, NULL, NULL, /* No plane funcs */ NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &kodak_605_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5170,7 +5784,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &kodak_1400_printer_init, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, &kodak_6800_laminate_list, &kodak_1400_media_list, NULL, NULL, NULL, 0, NULL, NULL, @@ -5188,7 +5802,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &kodak_805_printer_init, NULL, NULL, NULL, /* No plane funcs */ NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &kodak_6800_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5205,7 +5819,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &kodak_9810_printer_init, &kodak_9810_printer_end, &kodak_9810_plane_init, NULL, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &kodak_9810_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5222,7 +5836,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &kodak_8810_printer_init, NULL, NULL, NULL, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &kodak_8810_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5239,7 +5853,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &kodak_70xx_printer_init, NULL, NULL, NULL, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &kodak_7000_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5256,7 +5870,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &kodak_70xx_printer_init, NULL, NULL, NULL, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &kodak_7000_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5272,8 +5886,8 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &kodak_8500_printer_init, &kodak_8500_printer_end, NULL, NULL, /* No plane funcs */ NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ - &kodak_8500_laminate_list, &kodak_8500_media_list, + NULL, + &kodak_8500_laminate_list, &kodak_8500_media_list, NULL, NULL, NULL, 0, NULL, NULL, }, @@ -5289,7 +5903,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &mitsu_cp3020d_printer_init, &mitsu_cp3020d_printer_end, &mitsu_cp3020d_plane_init, &mitsu_cp3020d_plane_end, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5306,7 +5920,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &mitsu_cp3020da_printer_init, &mitsu_cp3020da_printer_end, &mitsu_cp3020da_plane_init, NULL, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5323,14 +5937,17 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &mitsu_cp9550_printer_init, &mitsu_cp9550_printer_end, &mitsu_cp3020da_plane_init, NULL, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, NULL, NULL, NULL, NULL, - NULL, 0, NULL, NULL, + mitsu9550_parameters, + mitsu9550_parameter_count, + mitsu9550_load_parameters, + mitsu9550_parse_parameters, }, { /* Mitsubishi CP9810D */ 4104, - &bgr_ink_list, + &ymc_ink_list, &res_300dpi_list, &mitsu_cp9810_page_list, &mitsu_cp9810_printsize_list, @@ -5341,25 +5958,37 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &mitsu_cp9810_printer_init, &mitsu_cp9810_printer_end, &mitsu_cp3020da_plane_init, NULL, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &mitsu_cp9810_laminate_list, NULL, NULL, NULL, - NULL, 0, NULL, NULL, + mitsu9550_parameters, + mitsu9550_parameter_count, + mitsu9810_load_parameters, + mitsu9810_parse_parameters, }, { /* Mitsubishi CPD70D/CPD707D */ 4105, +#ifdef MITSU70X_8BPP + &bgr_ink_list, +#else &ymc_ink_list, +#endif &res_300dpi_list, &mitsu_cpd70x_page_list, &mitsu_cpd70x_printsize_list, SHRT_MAX, +#ifdef MITSU70X_8BPP + DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT, + &mitsu_cpd70x_printer_init, NULL, +#else DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_16BPP | DYESUB_FEATURE_BIGENDIAN, - &mitsu_cpd70x_printer_init, &mitsu_cpd70x_printer_end, + &mitsu_cpd70x_printer_init, &mitsu_cpd70x_printer_end, +#endif NULL, &mitsu_cpd70x_plane_end, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &mitsu_cpd70x_laminate_list, NULL, NULL, NULL, mitsu70x_parameters, @@ -5369,18 +5998,27 @@ static const dyesub_cap_t dyesub_model_capabilities[] = }, { /* Mitsubishi CPK60D */ 4106, +#ifdef MITSU70X_8BPP + &bgr_ink_list, +#else &ymc_ink_list, +#endif &res_300dpi_list, &mitsu_cpk60_page_list, &mitsu_cpk60_printsize_list, SHRT_MAX, +#ifdef MITSU70X_8BPP + DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT, + &mitsu_cpk60_printer_init, NULL, +#else DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_16BPP | DYESUB_FEATURE_BIGENDIAN, &mitsu_cpk60_printer_init, &mitsu_cpd70x_printer_end, +#endif NULL, &mitsu_cpd70x_plane_end, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &mitsu_cpd70x_laminate_list, NULL, NULL, NULL, mitsu70x_parameters, @@ -5390,18 +6028,27 @@ static const dyesub_cap_t dyesub_model_capabilities[] = }, { /* Mitsubishi CPD80D */ 4107, +#ifdef MITSU70X_8BPP + &bgr_ink_list, +#else &ymc_ink_list, +#endif &res_300dpi_list, &mitsu_cpd80_page_list, &mitsu_cpd80_printsize_list, SHRT_MAX, +#ifdef MITSU70X_8BPP + DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT, + &mitsu_cpd70x_printer_init, NULL, +#else DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_16BPP | DYESUB_FEATURE_BIGENDIAN, &mitsu_cpd70x_printer_init, &mitsu_cpd70x_printer_end, +#endif NULL, &mitsu_cpd70x_plane_end, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &mitsu_cpd70x_laminate_list, NULL, NULL, NULL, mitsu70x_parameters, @@ -5411,18 +6058,27 @@ static const dyesub_cap_t dyesub_model_capabilities[] = }, { /* Kodak 305 */ 4108, +#ifdef MITSU70X_8BPP + &bgr_ink_list, +#else &ymc_ink_list, +#endif &res_300dpi_list, &kodak305_page_list, &kodak305_printsize_list, SHRT_MAX, +#ifdef MITSU70X_8BPP + DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT, + &kodak305_printer_init, NULL, +#else DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_16BPP | DYESUB_FEATURE_BIGENDIAN, &kodak305_printer_init, &mitsu_cpd70x_printer_end, +#endif NULL, &mitsu_cpd70x_plane_end, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &mitsu_cpd70x_laminate_list, NULL, NULL, NULL, mitsu70x_parameters, @@ -5441,14 +6097,17 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &mitsu_cpd90_printer_init, &mitsu_cpd90_printer_end, NULL, NULL, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, &mitsu_cpd70x_laminate_list, NULL, NULL, NULL, - NULL, 0, NULL, NULL, + mitsu70x_parameters, + mitsu70x_parameter_count, + mitsu_d90_load_parameters, + mitsu_d90_parse_parameters, }, { /* Mitsubishi CP9600D */ 4110, - &bgr_ink_list, + &rgb_ink_list, &res_mitsu9600_dpi_list, &mitsu_cp9600_page_list, &mitsu_cp9600_printsize_list, @@ -5458,27 +6117,81 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &mitsu_cp9600_printer_init, &mitsu_cp9600_printer_end, &mitsu_cp3020da_plane_init, NULL, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, }, { /* Mitsubishi CP9550DW-S */ 4111, - &rgb_ink_list, /* Identical to 9550D except it's rgb instead of bgr */ + &rgb_ink_list, &res_346dpi_list, - &mitsu_cp9550_page_list, - &mitsu_cp9550_printsize_list, + &mitsu_cp9550s_page_list, + &mitsu_cp9550s_printsize_list, SHRT_MAX, DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_INTERLACE, - &mitsu_cp9550_printer_init, &mitsu_cp9550_printer_end, + &mitsu_cp9550_printer_init, &mitsu_cp9550s_printer_end, &mitsu_cp3020da_plane_init, NULL, NULL, NULL, /* No block funcs */ - NULL, NULL, NULL, /* color profile/adjustment is built into printer */ + NULL, NULL, NULL, NULL, NULL, - NULL, 0, NULL, NULL, + mitsu9550_parameters, + mitsu9550_parameter_count, + mitsu9550_load_parameters, + mitsu9550_parse_parameters, + }, + { /* Fujifilm ASK-300 */ + 4112, +#ifdef MITSU70X_8BPP + &bgr_ink_list, +#else + &ymc_ink_list, +#endif + &res_300dpi_list, + &fuji_ask300_page_list, + &fuji_ask300_printsize_list, + SHRT_MAX, +#ifdef MITSU70X_8BPP + DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT, + &mitsu_cpd70x_printer_init, NULL, +#else + DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT + | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_16BPP + | DYESUB_FEATURE_BIGENDIAN, + &mitsu_cpd70x_printer_init, &mitsu_cpd70x_printer_end, +#endif + NULL, &mitsu_cpd70x_plane_end, + NULL, NULL, /* No block funcs */ + NULL, + NULL, NULL, + NULL, NULL, + mitsu70x_parameters, + mitsu70x_parameter_count, + mitsu_k60_load_parameters, + mitsu70x_parse_parameters, + }, + { /* Mitsubishi CP9800D */ + 4113, + &ymc_ink_list, + &res_300dpi_list, + &mitsu_cp9810_page_list, + &mitsu_cp9810_printsize_list, + SHRT_MAX, + DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT + | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_12BPP + | DYESUB_FEATURE_BIGENDIAN, + &mitsu_cp9800_printer_init, &mitsu_cp9810_printer_end, + &mitsu_cp3020da_plane_init, NULL, + NULL, NULL, /* No block funcs */ + NULL, + NULL, NULL, + NULL, NULL, + mitsu9550_parameters, + mitsu9550_parameter_count, + mitsu9810_load_parameters, + mitsu9810_parse_parameters, }, { /* Shinko CHC-S9045 (experimental) */ 5000, @@ -5491,7 +6204,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &shinko_chcs9045_printer_init, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5507,7 +6220,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &shinko_chcs2145_printer_init, &shinko_chcs2145_printer_end, NULL, NULL, /* No planes */ NULL, NULL, /* No blocks */ - NULL, NULL, NULL, /* Color correction in printer */ + NULL, &shinko_chcs2145_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5523,7 +6236,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &shinko_chcs1245_printer_init, &shinko_chcs2145_printer_end, NULL, NULL, /* No planes */ NULL, NULL, /* No blocks */ - NULL, NULL, NULL, /* Color correction in printer */ + NULL, &shinko_chcs1245_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5539,7 +6252,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &shinko_chcs6245_printer_init, &shinko_chcs2145_printer_end, NULL, NULL, /* No planes */ NULL, NULL, /* No blocks */ - NULL, NULL, NULL, /* Color correction in printer */ + NULL, &shinko_chcs6245_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5555,7 +6268,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &shinko_chcs6145_printer_init, &shinko_chcs2145_printer_end, NULL, NULL, /* No planes */ NULL, NULL, /* No blocks */ - NULL, NULL, NULL, /* Color correction in printer */ + NULL, &shinko_chcs6145_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5571,7 +6284,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &shinko_chcs6145_printer_init, &shinko_chcs2145_printer_end, NULL, NULL, /* No planes */ NULL, NULL, /* No blocks */ - NULL, NULL, NULL, /* Color correction in printer */ + NULL, &shinko_chcs6145_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5588,7 +6301,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &dnpds40_printer_start, &dnpds40_printer_end, &dnpds40_plane_init, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, &dnpds40_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5605,10 +6318,10 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &dnpds80_printer_start, &dnpds40_printer_end, &dnpds40_plane_init, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, &dnpds40_laminate_list, NULL, NULL, NULL, - NULL, 0, NULL, NULL, + NULL, 0, NULL, dnpds80_parse_parameters, }, { /* Dai Nippon Printing DSRX1 */ 6002, @@ -5622,7 +6335,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &dnpdsrx1_printer_start, &dnpds40_printer_end, &dnpds40_plane_init, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, &dnpds40_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5639,7 +6352,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &dnpds620_printer_start, &dnpds40_printer_end, &dnpds40_plane_init, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, &dnpds620_laminate_list, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5656,7 +6369,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] = &citizen_cw01_printer_start, NULL, &citizen_cw01_plane_init, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -5670,13 +6383,13 @@ static const dyesub_cap_t dyesub_model_capabilities[] = SHRT_MAX, DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_DUPLEX, - &dnpds80dx_printer_start, &dnpds40_printer_end, + &dnpds80_printer_start, &dnpds40_printer_end, &dnpds40_plane_init, NULL, NULL, NULL, - NULL, NULL, NULL, + NULL, &dnpds40_laminate_list, &dnpds80dx_media_list, NULL, NULL, - NULL, 0, NULL, NULL, + NULL, 0, NULL, dnpds80dx_parse_parameters, }, }; @@ -6265,15 +6978,18 @@ dyesub_describe_output(const stp_vars_t *v) return dyesub_describe_output_internal(v, &ipv); } +#define NPUTC_BUFSIZE (512) + static void dyesub_nputc(stp_vars_t *v, char byte, int count) { + char buf[NPUTC_BUFSIZE]; + if (count == 1) stp_putc(byte, v); else { int i; - char *buf = privdata.nputc_buf; int size = count; int blocks = size / NPUTC_BUFSIZE; int leftover = size % NPUTC_BUFSIZE; @@ -6326,6 +7042,20 @@ dyesub_exec(stp_vars_t *v, } static int +dyesub_exec_check(stp_vars_t *v, + int (*func)(stp_vars_t *), + const char *debug_string) +{ + if (func) + { + stp_deprintf(STP_DBG_DYESUB, "dyesub: %s\n", debug_string); + return (*func)(v); + } + return 1; +} + + +static int dyesub_interpolate(int oldval, int oldsize, int newsize) { /* @@ -6510,10 +7240,13 @@ dyesub_print_row(stp_vars_t *v, static int dyesub_print_plane(stp_vars_t *v, - dyesub_print_vars_t *pv, - const dyesub_cap_t *caps, - int plane) + dyesub_print_vars_t *pv, + dyesub_privdata_t *pd, + const dyesub_cap_t *caps, + int plane) { + + int ret = 0; int h, row, p; int out_bytes = ((pv->plane_interlacing || pv->row_interlacing) ? 1 : pv->ink_channels) @@ -6527,11 +7260,11 @@ dyesub_print_plane(stp_vars_t *v, if (h % caps->block_size == 0) { /* block init */ - privdata.block_min_h = h + pv->prnt_px; - privdata.block_min_w = pv->prnl_px; - privdata.block_max_h = MIN(h + pv->prnt_px + caps->block_size - 1, + pd->block_min_h = h + pv->prnt_px; + pd->block_min_w = pv->prnl_px; + pd->block_max_h = MIN(h + pv->prnt_px + caps->block_size - 1, pv->prnb_px); - privdata.block_max_w = pv->prnr_px; + pd->block_max_w = pv->prnr_px; dyesub_exec(v, caps->block_init_func, "caps->block_init"); } @@ -6562,7 +7295,7 @@ dyesub_print_plane(stp_vars_t *v, } } - if (h + pv->prnt_px == privdata.block_max_h) + if (h + pv->prnt_px == pd->block_max_h) { /* block end */ dyesub_exec(v, caps->block_end_func, "caps->block_end"); } @@ -6606,12 +7339,23 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image) int pl; + dyesub_privdata_t *pd; + if (!stp_verify(v)) { stp_eprintf(v, _("Print options not verified; cannot print.\n")); return 0; } + + /* Clean up private state */ (void) memset(&pv, 0, sizeof(pv)); + + /* Allocate privdata structure */ + pd = stp_zalloc(sizeof(dyesub_privdata_t)); + stp_allocate_component_data(v, "Driver", NULL, NULL, pd); + + /* Parse any per-printer parameters *before* the generic ones */ + dyesub_exec_check(v, caps->parse_parameters, "caps->parse_parameters"); stp_image_init(image); pv.imgw_px = stp_image_width(image); @@ -6620,20 +7364,17 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image) stp_describe_resolution(v, &w_dpi, &h_dpi); dyesub_printsize(v, &max_print_px_width, &max_print_px_height); - /* Parse any per-printer parameters */ - dyesub_exec(v, caps->parse_parameters, "caps->parse_parameters"); - /* Duplex processing -- Rotate even pages for DuplexNoTumble */ - privdata.duplex_mode = stp_get_string_parameter(v, "Duplex"); - privdata.page_number = stp_get_int_parameter(v, "PageNumber"); - if((privdata.page_number & 1) && privdata.duplex_mode && !strcmp(privdata.duplex_mode,"DuplexNoTumble")) + pd->duplex_mode = stp_get_string_parameter(v, "Duplex"); + pd->page_number = stp_get_int_parameter(v, "PageNumber"); + if((pd->page_number & 1) && pd->duplex_mode && !strcmp(pd->duplex_mode,"DuplexNoTumble")) image = stpi_buffer_image(image,BUFFER_FLAG_FLIP_X | BUFFER_FLAG_FLIP_Y); - privdata.pagesize = stp_get_string_parameter(v, "PageSize"); + pd->pagesize = stp_get_string_parameter(v, "PageSize"); if (caps->laminate) - privdata.laminate = dyesub_get_laminate_pattern(v); + pd->laminate = dyesub_get_laminate_pattern(v); if (caps->media) - privdata.media = dyesub_get_mediatype(v); + pd->media = dyesub_get_mediatype(v); dyesub_imageable_area_internal(v, (dyesub_feature(caps, DYESUB_FEATURE_WHITE_BORDER) ? 1 : 0), @@ -6756,9 +7497,8 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image) /* /FIXME */ /* FIXME: Provide a way of disabling/altering these curves */ - dyesub_adjust_curve(v, caps->adj_cyan, "CyanCurve"); - dyesub_adjust_curve(v, caps->adj_magenta, "MagentaCurve"); - dyesub_adjust_curve(v, caps->adj_yellow, "YellowCurve"); + /* XXX reuse 'UseLUT' from mitsu70x? or 'SimpleGamma' ? */ + dyesub_exec(v, caps->adjust_curves, "caps->adjust_curves"); if (dyesub_feature(caps, DYESUB_FEATURE_FULL_HEIGHT)) { @@ -6804,25 +7544,25 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image) } /* assign private data *after* swaping image dimensions */ - privdata.w_dpi = w_dpi; - privdata.h_dpi = h_dpi; - privdata.w_size = pv.prnw_px; - privdata.h_size = pv.prnh_px; - privdata.print_mode = pv.print_mode; - privdata.bpp = pv.bits_per_ink_channel; + pd->w_dpi = w_dpi; + pd->h_dpi = h_dpi; + pd->w_size = pv.prnw_px; + pd->h_size = pv.prnh_px; + pd->print_mode = pv.print_mode; + pd->bpp = pv.bits_per_ink_channel; /* printer init */ dyesub_exec(v, caps->printer_init_func, "caps->printer_init"); for (pl = 0; pl < (pv.plane_interlacing ? pv.ink_channels : 1); pl++) { - privdata.plane = pv.ink_order[pl]; - stp_deprintf(STP_DBG_DYESUB, "dyesub: plane %d\n", privdata.plane); + pd->plane = pv.ink_order[pl]; + stp_deprintf(STP_DBG_DYESUB, "dyesub: plane %d\n", pd->plane); /* plane init */ dyesub_exec(v, caps->plane_init_func, "caps->plane_init"); - dyesub_print_plane(v, &pv, caps, (int) pv.ink_order[pl] - 1); + dyesub_print_plane(v, &pv, pd, caps, (int) pv.ink_order[pl] - 1); /* plane end */ dyesub_exec(v, caps->plane_end_func, "caps->plane_end"); @@ -6831,8 +7571,13 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image) /* printer end */ dyesub_exec(v, caps->printer_end_func, "caps->printer_end"); - dyesub_free_image(&pv, image); + if (pv.image_data) { + dyesub_free_image(&pv, image); + } + stp_image_conclude(image); + stp_free(pd); + return status; } @@ -6879,6 +7624,21 @@ dyesub_job_end(const stp_vars_t *v, stp_image_t *image) return 1; } + +static int dyesub_verify_printer_params(stp_vars_t *v) +{ + const int model = stp_get_model_id(v); + const dyesub_cap_t *caps = dyesub_get_model_capabilities(model); + int result; + result = stp_verify_printer_params(v); + if (result != 1) + return result; + + /* Sanity-check printer-specific parameters if a function exists */ + result = dyesub_exec_check(v, caps->parse_parameters, "caps->parse_parameters"); + return result; +} + static const stp_printfuncs_t print_dyesub_printfuncs = { dyesub_list_parameters, @@ -6890,22 +7650,18 @@ static const stp_printfuncs_t print_dyesub_printfuncs = dyesub_print, dyesub_describe_resolution, dyesub_describe_output, - stp_verify_printer_params, + dyesub_verify_printer_params, dyesub_job_start, dyesub_job_end, NULL }; - - - static stp_family_t print_dyesub_module_data = { &print_dyesub_printfuncs, NULL }; - static int print_dyesub_module_init(void) { |