diff options
Diffstat (limited to 'src/main/print-escp2.c')
-rw-r--r-- | src/main/print-escp2.c | 202 |
1 files changed, 146 insertions, 56 deletions
diff --git a/src/main/print-escp2.c b/src/main/print-escp2.c index 42b7c62..d97634b 100644 --- a/src/main/print-escp2.c +++ b/src/main/print-escp2.c @@ -1,5 +1,5 @@ /* - * "$Id: print-escp2.c,v 1.350 2006/04/30 21:29:53 rlk Exp $" + * "$Id: print-escp2.c,v 1.354 2006/07/22 20:28:14 rlk Exp $" * * Print plug-in EPSON ESC/P2 driver for the GIMP. * @@ -386,6 +386,7 @@ static const stp_parameter_t the_parameters[] = PARAMETER_INT(zero_margin_offset), PARAMETER_INT(extra_720dpi_separation), PARAMETER_INT(horizontal_position_alignment), + PARAMETER_INT(bidirectional_upper_limit), PARAMETER_INT(physical_channels), PARAMETER_INT(left_margin), PARAMETER_INT(right_margin), @@ -399,6 +400,7 @@ static const stp_parameter_t the_parameters[] = PARAMETER_INT(cd_y_offset), PARAMETER_INT(cd_page_width), PARAMETER_INT(cd_page_height), + PARAMETER_INT(page_extra_height), PARAMETER_RAW(preinit_sequence), PARAMETER_RAW(postinit_remote_sequence) }; @@ -498,6 +500,14 @@ static const float_param_t float_parameters[] = }, { { + "DarkGrayTransition", N_("Gray Transition"), N_("Advanced Ink Adjustment"), + N_("Gray Transition"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { "LightGrayTransition", N_("Light Gray Transition"), N_("Advanced Ink Adjustment"), N_("Light Gray Transition"), STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, @@ -657,6 +667,7 @@ DEF_SIMPLE_ACCESSOR(cd_x_offset, int) DEF_SIMPLE_ACCESSOR(cd_y_offset, int) DEF_SIMPLE_ACCESSOR(cd_page_width, int) DEF_SIMPLE_ACCESSOR(cd_page_height, int) +DEF_SIMPLE_ACCESSOR(page_extra_height, int) DEF_SIMPLE_ACCESSOR(extra_feed, unsigned) DEF_SIMPLE_ACCESSOR(pseudo_separation_rows, int) DEF_SIMPLE_ACCESSOR(base_separation, int) @@ -667,6 +678,7 @@ DEF_SIMPLE_ACCESSOR(max_black_resolution, int) DEF_SIMPLE_ACCESSOR(zero_margin_offset, int) DEF_SIMPLE_ACCESSOR(extra_720dpi_separation, int) DEF_SIMPLE_ACCESSOR(horizontal_position_alignment, unsigned) +DEF_SIMPLE_ACCESSOR(bidirectional_upper_limit, int) DEF_SIMPLE_ACCESSOR(physical_channels, int) DEF_SIMPLE_ACCESSOR(alignment_passes, int) DEF_SIMPLE_ACCESSOR(alignment_choices, int) @@ -970,44 +982,40 @@ get_resolution_bounds_by_paper_type(const stp_vars_t *v, *max_y = 720; break; } + stp_dprintf(STP_DBG_ESCP2, v, + "Paper %s class %d: min_x %d min_y %d max_x %d max_y %d\n", + paper->text, paper->paper_class, *min_x, *min_y, + *max_x, *max_y); } } static int verify_resolution_by_paper_type(const stp_vars_t *v, const res_t *res) { - const paper_t *paper = get_media_type(v); - if (paper) + unsigned min_x = 0; + unsigned min_y = 0; + unsigned max_x = 0; + unsigned max_y = 0; + get_resolution_bounds_by_paper_type(v, &max_x, &max_y, &min_x, &min_y); + if ((max_x == 0 || res->printed_hres <= max_x) && + (max_y == 0 || res->printed_vres <= max_y) && + (min_x == 0 || res->printed_hres >= min_x) && + (min_y == 0 || res->printed_vres >= min_y)) + { + stp_dprintf(STP_DBG_ESCP2, v, + "Resolution %s (%d, %d) GOOD (%d, %d, %d, %d)\n", + res->name, res->printed_hres, res->printed_vres, + min_x, min_y, max_x, max_y); + return 1; + } + else { - switch (paper->paper_class) - { - case PAPER_PLAIN: - if (res->printed_vres > 720 || res->hres > 720) - return 0; - break; - case PAPER_GOOD: - if (res->printed_vres < 180 || res->hres < 360 || - res->printed_vres > 720 || res->hres > 1440) - return 0; - break; - case PAPER_PHOTO: - if (res->printed_vres < 360 || - (res->hres < 720 && res->hres < escp2_max_hres(v))) - return 0; - break; - case PAPER_PREMIUM_PHOTO: - if (res->printed_vres < 720 || - (res->hres < 720 && res->hres < escp2_max_hres(v))) - return 0; - break; - case PAPER_TRANSPARENCY: - if (res->printed_vres < 360 || res->hres < 360 || - res->printed_vres > 720 || res->hres > 720) - return 0; - break; - } + stp_dprintf(STP_DBG_ESCP2, v, + "Resolution %s (%d, %d) BAD (%d, %d, %d, %d)\n", + res->name, res->printed_hres, res->printed_vres, + min_x, min_y, max_x, max_y); + return 0; } - return 1; } static int @@ -1042,6 +1050,37 @@ verify_resolution(const stp_vars_t *v, const res_t *res) return 0; } +static void +get_printer_resolution_bounds(const stp_vars_t *v, + unsigned *max_x, unsigned *max_y, + unsigned *min_x, unsigned *min_y) +{ + int i = 0; + const res_t *const *res = escp2_reslist(v); + *max_x = 0; + *max_y = 0; + *min_x = 0; + *min_y = 0; + while (res[i]) + { + if (verify_resolution(v, res[i])) + { + if (res[i]->printed_hres * res[i]->vertical_passes > *max_x) + *max_x = res[i]->printed_hres * res[i]->vertical_passes; + if (res[i]->printed_vres > *max_y) + *max_y = res[i]->printed_vres; + if (*min_x == 0 || + res[i]->printed_hres * res[i]->vertical_passes < *min_x) + *min_x = res[i]->printed_hres * res[i]->vertical_passes; + if (*min_y == 0 || res[i]->printed_vres < *min_y) + *min_y = res[i]->printed_vres; + } + i++; + } + stp_dprintf(STP_DBG_ESCP2, v, + "Printer bounds: %d %d %d %d\n", *min_x, *min_y, *max_x, *max_y); +} + static int printer_supports_rollfeed(const stp_vars_t *v) { @@ -1300,6 +1339,8 @@ find_default_resolution(const stp_vars_t *v, const quality_t *q, i--; while (i >= 0) { + stp_dprintf(STP_DBG_ESCP2, v, "Checking resolution %s %d...", + res[i]->name, i); if (verify_resolution(v, res[i]) && verify_resolution_by_paper_type(v, res[i])) return res[i]; @@ -1346,7 +1387,28 @@ find_default_resolution(const stp_vars_t *v, const quality_t *q, if (verify_resolution(v, res[i]) && res[i]->printed_vres == desired_vres && res[i]->printed_hres == desired_hres) - return res[i]; + { + stp_dprintf(STP_DBG_ESCP2, v, + "Found desired resolution w/o oversample: %s %d: %d * %d, %d\n", + res[i]->name, i, res[i]->printed_hres, + res[i]->vertical_passes, res[i]->printed_vres); + return res[i]; + } + i++; + } + i = 0; + while (res[i]) + { + if (verify_resolution(v, res[i]) && + res[i]->printed_vres == desired_vres && + res[i]->printed_hres * res[i]->vertical_passes == desired_hres) + { + stp_dprintf(STP_DBG_ESCP2, v, + "Found desired resolution: %s %d: %d * %d, %d\n", + res[i]->name, i, res[i]->printed_hres, + res[i]->vertical_passes, res[i]->printed_vres); + return res[i]; + } i++; } i = 0; @@ -1355,9 +1417,17 @@ find_default_resolution(const stp_vars_t *v, const quality_t *q, if (verify_resolution(v, res[i]) && (q->min_vres == 0 || res[i]->printed_vres >= q->min_vres) && (q->max_vres == 0 || res[i]->printed_vres <= q->max_vres) && - (q->min_hres == 0 || res[i]->printed_hres >= q->min_hres) && - (q->max_hres == 0 || res[i]->printed_hres <= q->max_hres)) - return res[i]; + (q->min_hres == 0 || + res[i]->printed_hres * res[i]->vertical_passes >=q->min_hres) && + (q->max_hres == 0 || + res[i]->printed_hres * res[i]->vertical_passes <= q->max_hres)) + { + stp_dprintf(STP_DBG_ESCP2, v, + "Found acceptable resolution: %s %d: %d * %d, %d\n", + res[i]->name, i, res[i]->printed_hres, + res[i]->vertical_passes, res[i]->printed_vres); + return res[i]; + } i++; } } @@ -1368,10 +1438,10 @@ find_default_resolution(const stp_vars_t *v, const quality_t *q, while (res[i]) { if (verify_resolution(v, res[i]) && - res[i]->vres >= desired_vres && - res[i]->hres >= desired_hres && - res[i]->vres <= 2 * desired_vres && - res[i]->hres <= 2 * desired_hres) + res[i]->printed_vres >= desired_vres && + res[i]->printed_hres * res[i]->vertical_passes >= desired_hres && + res[i]->printed_vres <= 2 * desired_vres && + res[i]->printed_hres * res[i]->vertical_passes <= 2 * desired_hres) return res[i]; i++; } @@ -1383,13 +1453,23 @@ find_default_resolution(const stp_vars_t *v, const quality_t *q, static int verify_quality(const stp_vars_t *v, const quality_t *q) { - if ((q->max_vres == 0 || escp2_min_vres(v) <= q->max_vres) && - (q->max_hres == 0 || escp2_min_hres(v) <= q->max_hres) && - (q->min_vres == 0 || escp2_max_vres(v) >= q->min_vres) && - (q->min_hres == 0 || escp2_max_hres(v) >= q->min_hres)) - return 1; + unsigned max_x, max_y, min_x, min_y; + get_printer_resolution_bounds(v, &max_x, &max_y, &min_x, &min_y); + if ((q->max_vres == 0 || min_y <= q->max_vres) && + (q->min_vres == 0 || max_y >= q->min_vres) && + (q->max_hres == 0 || min_x <= q->max_hres) && + (q->min_hres == 0 || max_x >= q->min_hres)) + { + stp_dprintf(STP_DBG_ESCP2, v, "Quality %s OK: %d %d %d %d\n", + q->text, q->min_hres, q->min_vres, q->max_hres, q->max_vres); + return 1; + } else - return 0; + { + stp_dprintf(STP_DBG_ESCP2, v, "Quality %s not OK: %d %d %d %d\n", + q->text, q->min_hres, q->min_vres, q->max_hres, q->max_vres); + return 0; + } } static const res_t * @@ -1466,7 +1546,7 @@ escp2_parameters(const stp_vars_t *v, const char *name, const stp_papersize_t *pt = stp_get_papersize_by_index(i); if (verify_papersize(v, pt)) stp_string_list_add_string(description->bounds.str, - pt->name, pt->text); + pt->name, gettext(pt->text)); } } description->deflt.str = @@ -1512,7 +1592,7 @@ escp2_parameters(const stp_vars_t *v, const char *name, const quality_t *q = &(quals->qualities[i]); if (verify_quality(v, q)) stp_string_list_add_string(description->bounds.str, q->name, - _(q->text)); + gettext(q->text)); if (strcmp(q->name, "Standard") == 0) has_standard_quality = 1; } @@ -1533,7 +1613,7 @@ escp2_parameters(const stp_vars_t *v, const char *name, { if (verify_resolution(v, res[i])) stp_string_list_add_string(description->bounds.str, - res[i]->name, _(res[i]->text)); + res[i]->name, gettext(res[i]->text)); i++; } } @@ -1550,7 +1630,7 @@ escp2_parameters(const stp_vars_t *v, const char *name, if (verify_inktype(v, inks->inknames[i])) stp_string_list_add_string(description->bounds.str, inks->inknames[i]->name, - _(inks->inknames[i]->text)); + gettext(inks->inknames[i]->text)); description->deflt.str = "None"; } else @@ -1568,7 +1648,7 @@ escp2_parameters(const stp_vars_t *v, const char *name, { stp_string_list_add_string(description->bounds.str, inks->inklists[i]->name, - _(inks->inklists[i]->text)); + gettext(inks->inklists[i]->text)); if (strcmp(inks->inklists[i]->name, "None") == 0) has_default_choice = 1; } @@ -1588,7 +1668,7 @@ escp2_parameters(const stp_vars_t *v, const char *name, for (i = 0; i < nmediatypes; i++) stp_string_list_add_string(description->bounds.str, p->papers[i].name, - _(p->papers[i].text)); + gettext(p->papers[i].text)); description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name; } @@ -1605,7 +1685,7 @@ escp2_parameters(const stp_vars_t *v, const char *name, for (i = 0; i < ninputslots; i++) stp_string_list_add_string(description->bounds.str, slots->slots[i].name, - _(slots->slots[i].text)); + gettext(slots->slots[i].text)); description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name; } @@ -1641,7 +1721,7 @@ escp2_parameters(const stp_vars_t *v, const char *name, for (i = 0; i < nprinter_weaves; i++) stp_string_list_add_string(description->bounds.str, printer_weaves->printer_weaves[i].name, - _(printer_weaves->printer_weaves[i].text)); + gettext(printer_weaves->printer_weaves[i].text)); } else description->is_active = 0; @@ -1724,8 +1804,9 @@ escp2_parameters(const stp_vars_t *v, const char *name, } else if (strcmp(name, "GrayTransition") == 0) set_gray_transition_parameter(v, description, 2); - else if (strcmp(name, "LightGrayTransition") == 0) - set_gray_transition_parameter(v, description, 2); + else if (strcmp(name, "DarkGrayTransition") == 0 || + strcmp(name, "LightGrayTransition") == 0) + set_gray_transition_parameter(v, description, 3); else if (strcmp(name, "Gray1Transition") == 0 || strcmp(name, "Gray2Transition") == 0 || strcmp(name, "Gray3Transition") == 0) @@ -1769,7 +1850,7 @@ escp2_parameters(const stp_vars_t *v, const char *name, for (i = 0; i < channel_names->count; i++) stp_string_list_add_string (description->bounds.str, - channel_names->names[i], channel_names->names[i]); + channel_names->names[i], gettext(channel_names->names[i])); description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name; } @@ -2733,6 +2814,7 @@ setup_head_parameters(stp_vars_t *v) pd->separation_rows = escp2_separation_rows(v); pd->pseudo_separation_rows = escp2_pseudo_separation_rows(v); pd->extra_720dpi_separation = escp2_extra_720dpi_separation(v); + pd->bidirectional_upper_limit = escp2_bidirectional_upper_limit(v); if (pd->horizontal_passes == 0) pd->horizontal_passes = 1; @@ -2776,6 +2858,13 @@ setup_page(stp_vars_t *v) safe and print 16 mm */ stp_default_media_size(v, &n, &(pd->page_true_height)); + pd->page_extra_height = escp2_page_extra_height(v); + if (pd->page_extra_height > 0 && + escp2_has_cap(v, MODEL_XZEROMARGIN, MODEL_XZEROMARGIN_YES) && + (!(input_slot->is_cd) && stp_get_boolean_parameter(v, "FullBleed"))) + pd->page_extra_height += + escp2_nozzles(v) * escp2_nozzle_separation(v) * 72 / + escp2_base_separation(v); internal_imageable_area(v, 0, 0, &pd->page_left, &pd->page_right, &pd->page_bottom, &pd->page_top); /* Don't use full bleed mode if the paper itself has a margin */ @@ -2789,6 +2878,7 @@ setup_page(stp_vars_t *v) int top_center = escp2_cd_y_offset(v) + stp_get_dimension_parameter(v, "CDYAdjustment"); pd->page_true_height = pd->page_bottom - pd->page_top; + pd->page_extra_height = 0; stp_set_left(v, stp_get_left(v) - pd->page_left); stp_set_top(v, stp_get_top(v) - pd->page_top); pd->page_right -= pd->page_left; |