| 1 | /* |
| 2 | * Print plug-in EPSON ESC/P2 driver for the GIMP. |
| 3 | * |
| 4 | * Copyright 1997-2000 Michael Sweet ([email protected]) and |
| 5 | * Robert Krawitz ([email protected]) |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the Free |
| 9 | * Software Foundation; either version 2 of the License, or (at your option) |
| 10 | * any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 15 | * for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #ifndef GUTENPRINT_INTERNAL_ESCP2_H |
| 22 | #define GUTENPRINT_INTERNAL_ESCP2_H |
| 23 | |
| 24 | /* |
| 25 | * Maximum number of channels in a printer. If Epson comes out with an |
| 26 | * 8-head printer, this needs to be increased. |
| 27 | */ |
| 28 | #define MAX_DROP_SIZES 3 |
| 29 | #define PHYSICAL_CHANNEL_LIMIT ((STP_CHANNEL_LIMIT) / ((MAX_DROP_SIZES)+1)) |
| 30 | |
| 31 | #define XCOLOR_R (STP_NCOLORS + 0) |
| 32 | #define XCOLOR_B (STP_NCOLORS + 1) |
| 33 | #define XCOLOR_GLOSS (STP_NCOLORS + 2) |
| 34 | |
| 35 | /* |
| 36 | * Printer capabilities. |
| 37 | * |
| 38 | * Various classes of printer capabilities are represented by bitmasks. |
| 39 | */ |
| 40 | |
| 41 | typedef unsigned long model_cap_t; |
| 42 | typedef unsigned long model_featureset_t; |
| 43 | |
| 44 | /* |
| 45 | **************************************************************** |
| 46 | * * |
| 47 | * PAPERS * |
| 48 | * * |
| 49 | **************************************************************** |
| 50 | */ |
| 51 | |
| 52 | typedef enum |
| 53 | { |
| 54 | PAPER_PLAIN = 0x01, |
| 55 | PAPER_GOOD = 0x02, |
| 56 | PAPER_PHOTO = 0x04, |
| 57 | PAPER_PREMIUM_PHOTO = 0x08, |
| 58 | PAPER_TRANSPARENCY = 0x10 |
| 59 | } paper_class_t; |
| 60 | |
| 61 | typedef struct |
| 62 | { |
| 63 | const char *cname; |
| 64 | const char *name; |
| 65 | const char *text; |
| 66 | paper_class_t paper_class; |
| 67 | const char *preferred_ink_type; |
| 68 | const char *preferred_ink_set; |
| 69 | stp_vars_t *v; |
| 70 | } paper_t; |
| 71 | |
| 72 | |
| 73 | /* |
| 74 | **************************************************************** |
| 75 | * * |
| 76 | * RESOLUTIONS * |
| 77 | * * |
| 78 | **************************************************************** |
| 79 | */ |
| 80 | |
| 81 | /* Drop sizes are grouped under resolution because each resolution |
| 82 | has different drop sizes. */ |
| 83 | typedef struct |
| 84 | { |
| 85 | short numdropsizes; |
| 86 | double dropsizes[MAX_DROP_SIZES]; |
| 87 | } escp2_dropsize_t; |
| 88 | |
| 89 | typedef struct |
| 90 | { |
| 91 | const char *name; |
| 92 | const char *text; |
| 93 | unsigned short hres; |
| 94 | unsigned short vres; |
| 95 | unsigned short printed_hres; |
| 96 | unsigned short printed_vres; |
| 97 | unsigned short vertical_passes; |
| 98 | stp_raw_t *command; |
| 99 | stp_vars_t *v; |
| 100 | } res_t; |
| 101 | |
| 102 | typedef struct |
| 103 | { |
| 104 | char *name; |
| 105 | res_t *resolutions; |
| 106 | size_t n_resolutions; |
| 107 | } resolution_list_t; |
| 108 | |
| 109 | typedef struct |
| 110 | { |
| 111 | char *name; |
| 112 | char *text; |
| 113 | unsigned short min_hres; |
| 114 | unsigned short min_vres; |
| 115 | unsigned short max_hres; |
| 116 | unsigned short max_vres; |
| 117 | short desired_hres; |
| 118 | short desired_vres; |
| 119 | } quality_t; |
| 120 | |
| 121 | typedef struct |
| 122 | { |
| 123 | char *name; |
| 124 | quality_t *qualities; |
| 125 | size_t n_quals; |
| 126 | } quality_list_t; |
| 127 | |
| 128 | typedef struct |
| 129 | { |
| 130 | char *name; |
| 131 | char *text; |
| 132 | stp_raw_t *command; |
| 133 | } printer_weave_t; |
| 134 | |
| 135 | typedef struct |
| 136 | { |
| 137 | char *name; |
| 138 | size_t n_printer_weaves; |
| 139 | printer_weave_t *printer_weaves; |
| 140 | } printer_weave_list_t; |
| 141 | |
| 142 | |
| 143 | /* |
| 144 | **************************************************************** |
| 145 | * * |
| 146 | * INKS * |
| 147 | * * |
| 148 | **************************************************************** |
| 149 | */ |
| 150 | |
| 151 | typedef struct |
| 152 | { |
| 153 | short color; |
| 154 | short subchannel; |
| 155 | short head_offset; |
| 156 | short split_channel_count; |
| 157 | const char *channel_density; |
| 158 | const char *subchannel_transition; |
| 159 | const char *subchannel_value; |
| 160 | const char *subchannel_scale; |
| 161 | const char *name; |
| 162 | const char *text; |
| 163 | short *split_channels; |
| 164 | } physical_subchannel_t; |
| 165 | |
| 166 | typedef struct |
| 167 | { |
| 168 | const char *name; |
| 169 | unsigned short n_subchannels; |
| 170 | physical_subchannel_t *subchannels; |
| 171 | const char *hue_curve_name; |
| 172 | stp_curve_t *hue_curve; |
| 173 | } ink_channel_t; |
| 174 | |
| 175 | typedef enum |
| 176 | { |
| 177 | INKSET_CMYK = 0, |
| 178 | INKSET_CcMmYK = 1, |
| 179 | INKSET_CcMmYyK = 2, |
| 180 | INKSET_CcMmYKk = 3, |
| 181 | INKSET_QUADTONE = 4, |
| 182 | INKSET_HEXTONE = 5, |
| 183 | INKSET_OTHER = 6, |
| 184 | INKSET_EXTENDED = 7 |
| 185 | } inkset_id_t; |
| 186 | |
| 187 | typedef struct |
| 188 | { |
| 189 | const char *name; |
| 190 | const char *text; |
| 191 | unsigned short channel_count; |
| 192 | unsigned short aux_channel_count; |
| 193 | inkset_id_t inkset; |
| 194 | const stp_raw_t *init_sequence; |
| 195 | const stp_raw_t *deinit_sequence; |
| 196 | ink_channel_t *channels; |
| 197 | ink_channel_t *aux_channels; |
| 198 | } inkname_t; |
| 199 | |
| 200 | typedef struct |
| 201 | { |
| 202 | unsigned int n_shades; |
| 203 | double *shades; |
| 204 | } shade_t; |
| 205 | |
| 206 | typedef struct |
| 207 | { |
| 208 | const char *name; |
| 209 | const char *text; |
| 210 | unsigned short n_shades; |
| 211 | unsigned short n_inks; |
| 212 | const stp_raw_t *init_sequence; |
| 213 | const stp_raw_t *deinit_sequence; |
| 214 | shade_t *shades; |
| 215 | inkname_t *inknames; |
| 216 | } inklist_t; |
| 217 | |
| 218 | typedef struct |
| 219 | { |
| 220 | const char *name; |
| 221 | unsigned short n_inklists; |
| 222 | inklist_t *inklists; |
| 223 | } inkgroup_t; |
| 224 | |
| 225 | |
| 226 | /* |
| 227 | **************************************************************** |
| 228 | * * |
| 229 | * INPUT SLOTS * |
| 230 | * * |
| 231 | **************************************************************** |
| 232 | */ |
| 233 | |
| 234 | #define ROLL_FEED_CUT_ALL (1) |
| 235 | #define ROLL_FEED_CUT_LAST (2) |
| 236 | #define ROLL_FEED_DONT_EJECT (4) |
| 237 | |
| 238 | #define DUPLEX_NO_TUMBLE (1) |
| 239 | #define DUPLEX_TUMBLE (2) |
| 240 | |
| 241 | typedef struct |
| 242 | { |
| 243 | const char *name; |
| 244 | const char *text; |
| 245 | short is_cd; |
| 246 | short is_roll_feed; |
| 247 | short duplex; |
| 248 | short extra_height; |
| 249 | unsigned roll_feed_cut_flags; |
| 250 | const stp_raw_t *init_sequence; |
| 251 | const stp_raw_t *deinit_sequence; |
| 252 | } input_slot_t; |
| 253 | |
| 254 | /* |
| 255 | **************************************************************** |
| 256 | * * |
| 257 | * FLAGS * |
| 258 | * * |
| 259 | **************************************************************** |
| 260 | */ |
| 261 | |
| 262 | #define MODEL_COMMAND_MASK 0xful /* What general command set does */ |
| 263 | #define MODEL_COMMAND_1998 0x0ul /* Old (ESC .) printers */ |
| 264 | #define MODEL_COMMAND_1999 0x1ul /* ESC i printers w/o extended ESC(c */ |
| 265 | #define MODEL_COMMAND_2000 0x2ul /* ESC i printers with extended ESC(c */ |
| 266 | #define MODEL_COMMAND_PRO 0x3ul /* Stylus Pro printers */ |
| 267 | |
| 268 | #define MODEL_ZEROMARGIN_MASK 0x70ul /* Does this printer support */ |
| 269 | #define MODEL_ZEROMARGIN_NO 0x00ul /* zero margin mode? */ |
| 270 | #define MODEL_ZEROMARGIN_YES 0x10ul /* (print beyond bottom of page) */ |
| 271 | #define MODEL_ZEROMARGIN_FULL 0x20ul /* (do not print beyond bottom) */ |
| 272 | #define MODEL_ZEROMARGIN_RESTR 0x30ul /* (no special treatment for vertical) */ |
| 273 | #define MODEL_ZEROMARGIN_H_ONLY 0x40ul /* (borderless only horizontal) */ |
| 274 | |
| 275 | #define MODEL_VARIABLE_DOT_MASK 0x80ul /* Does this printer support var */ |
| 276 | #define MODEL_VARIABLE_NO 0x00ul /* dot size printing? The newest */ |
| 277 | #define MODEL_VARIABLE_YES 0x80ul /* printers support multiple modes */ |
| 278 | |
| 279 | #define MODEL_GRAYMODE_MASK 0x100ul /* Does this printer support special */ |
| 280 | #define MODEL_GRAYMODE_NO 0x000ul /* fast black printing? */ |
| 281 | #define MODEL_GRAYMODE_YES 0x100ul |
| 282 | |
| 283 | #define MODEL_FAST_360_MASK 0x200ul |
| 284 | #define MODEL_FAST_360_NO 0x000ul |
| 285 | #define MODEL_FAST_360_YES 0x200ul |
| 286 | |
| 287 | #define MODEL_SEND_ZERO_ADVANCE_MASK 0x400ul |
| 288 | #define MODEL_SEND_ZERO_ADVANCE_NO 0x000ul |
| 289 | #define MODEL_SEND_ZERO_ADVANCE_YES 0x400ul |
| 290 | |
| 291 | #define MODEL_SUPPORTS_INK_CHANGE_MASK 0x800ul |
| 292 | #define MODEL_SUPPORTS_INK_CHANGE_NO 0x000ul |
| 293 | #define MODEL_SUPPORTS_INK_CHANGE_YES 0x800ul |
| 294 | |
| 295 | #define MODEL_PACKET_MODE_MASK 0x1000ul |
| 296 | #define MODEL_PACKET_MODE_NO 0x0000ul |
| 297 | #define MODEL_PACKET_MODE_YES 0x1000ul |
| 298 | |
| 299 | #define MODEL_INTERCHANGEABLE_INK_MASK 0x2000ul |
| 300 | #define MODEL_INTERCHANGEABLE_INK_NO 0x0000ul |
| 301 | #define MODEL_INTERCHANGEABLE_INK_YES 0x2000ul |
| 302 | |
| 303 | #define MODEL_ENVELOPE_LANDSCAPE_MASK 0x4000ul |
| 304 | #define MODEL_ENVELOPE_LANDSCAPE_NO 0x0000ul |
| 305 | #define MODEL_ENVELOPE_LANDSCAPE_YES 0x4000ul |
| 306 | |
| 307 | #define MODEL_ROLL_ONLY_MASK 0x8000ul /* Only supports roll-feed */ |
| 308 | #define MODEL_ROLL_ONLY_NO 0x0000ul |
| 309 | #define MODEL_ROLL_ONLY_YES 0x8000ul |
| 310 | |
| 311 | typedef enum |
| 312 | { |
| 313 | MODEL_COMMAND, |
| 314 | MODEL_ZEROMARGIN, |
| 315 | MODEL_VARIABLE_DOT, |
| 316 | MODEL_GRAYMODE, |
| 317 | MODEL_FAST_360, |
| 318 | MODEL_SEND_ZERO_ADVANCE, |
| 319 | MODEL_SUPPORTS_INK_CHANGE, |
| 320 | MODEL_PACKET_MODE, |
| 321 | MODEL_INTERCHANGEABLE_INK, |
| 322 | MODEL_ENVELOPE_LANDSCAPE, |
| 323 | MODEL_ROLL_ONLY, |
| 324 | MODEL_LIMIT |
| 325 | } escp2_model_option_t; |
| 326 | |
| 327 | typedef struct escp2_printer |
| 328 | { |
| 329 | int active; |
| 330 | /*****************************************************************************/ |
| 331 | model_cap_t flags; /* Bitmask of flags, see above */ |
| 332 | /*****************************************************************************/ |
| 333 | /* Basic head configuration */ |
| 334 | short nozzles; /* Number of nozzles per color */ |
| 335 | short min_nozzles; /* Minimum number of nozzles per color */ |
| 336 | short nozzle_start; /* Starting usable nozzle */ |
| 337 | short nozzle_separation; /* Separation between rows, in 1/360" */ |
| 338 | short black_nozzles; /* Number of black nozzles (may be extra) */ |
| 339 | short min_black_nozzles; /* # of black nozzles (may be extra) */ |
| 340 | short black_nozzle_start; /* Starting usable nozzle */ |
| 341 | short black_nozzle_separation; /* Separation between rows */ |
| 342 | short fast_nozzles; /* Number of fast nozzles */ |
| 343 | short min_fast_nozzles; /* # of fast nozzles (may be extra) */ |
| 344 | short fast_nozzle_start; /* Starting usable nozzle */ |
| 345 | short fast_nozzle_separation; /* Separation between rows */ |
| 346 | short physical_channels; /* Number of ink channels */ |
| 347 | /*****************************************************************************/ |
| 348 | /* Print head resolution */ |
| 349 | short base_separation; /* Basic unit of row separation */ |
| 350 | short resolution_scale; /* Scaling factor for ESC(D command */ |
| 351 | short max_black_resolution; /* Above this resolution, we */ |
| 352 | /* must use color parameters */ |
| 353 | /* rather than (faster) black */ |
| 354 | /* only parameters*/ |
| 355 | unsigned short max_hres; |
| 356 | unsigned short max_vres; |
| 357 | unsigned short min_hres; |
| 358 | unsigned short min_vres; |
| 359 | /*****************************************************************************/ |
| 360 | /* Miscellaneous printer-specific data */ |
| 361 | short extra_feed; /* Extra distance the paper can be spaced */ |
| 362 | /* beyond the bottom margin, in 1/360". */ |
| 363 | /* (maximum useful value is */ |
| 364 | /* nozzles * nozzle_separation) */ |
| 365 | short separation_rows; /* Some printers require funky spacing */ |
| 366 | /* arguments in softweave mode. */ |
| 367 | short pseudo_separation_rows;/* Some printers require funky */ |
| 368 | /* spacing arguments in printer_weave mode */ |
| 369 | |
| 370 | short zero_margin_offset; /* Offset to use to achieve */ |
| 371 | /* zero-margin printing */ |
| 372 | short micro_left_margin; /* Precise left margin (base separation) */ |
| 373 | short initial_vertical_offset; |
| 374 | short black_initial_vertical_offset; |
| 375 | short printing_initial_vertical_offset; |
| 376 | short extra_720dpi_separation; |
| 377 | short min_horizontal_position_alignment; /* Horizontal alignment */ |
| 378 | /* for good performance */ |
| 379 | short base_horizontal_position_alignment; /* Horizontal alignment */ |
| 380 | /* for good performance */ |
| 381 | int bidirectional_upper_limit; /* Highest total resolution */ |
| 382 | /* for bidirectional printing */ |
| 383 | /* in auto mode */ |
| 384 | /*****************************************************************************/ |
| 385 | /* Paper size limits */ |
| 386 | stp_dimension_t max_paper_width; /* Maximum paper width, in points */ |
| 387 | stp_dimension_t max_paper_height; /* Maximum paper height, in points */ |
| 388 | stp_dimension_t min_paper_width; /* Maximum paper width, in points */ |
| 389 | stp_dimension_t min_paper_height; /* Maximum paper height, in points */ |
| 390 | stp_dimension_t max_imageable_width; /* Maximum imageable area, in points */ |
| 391 | stp_dimension_t max_imageable_height; /* Maximum imageable area, in points */ |
| 392 | /*****************************************************************************/ |
| 393 | /* Borders */ |
| 394 | /* SHEET FED: */ |
| 395 | /* Softweave: */ |
| 396 | stp_dimension_t left_margin; /* Left margin, points */ |
| 397 | stp_dimension_t right_margin; /* Right margin, points */ |
| 398 | stp_dimension_t top_margin; /* Absolute top margin, points */ |
| 399 | stp_dimension_t bottom_margin; /* Absolute bottom margin, points */ |
| 400 | /* Printer weave: */ |
| 401 | stp_dimension_t m_left_margin; /* Left margin, points */ |
| 402 | stp_dimension_t m_right_margin; /* Right margin, points */ |
| 403 | stp_dimension_t m_top_margin; /* Absolute top margin, points */ |
| 404 | stp_dimension_t m_bottom_margin; /* Absolute bottom margin, points */ |
| 405 | /* ROLL FEED: */ |
| 406 | /* Softweave: */ |
| 407 | stp_dimension_t roll_left_margin; /* Left margin, points */ |
| 408 | stp_dimension_t roll_right_margin; /* Right margin, points */ |
| 409 | stp_dimension_t roll_top_margin; /* Absolute top margin, points */ |
| 410 | stp_dimension_t roll_bottom_margin; /* Absolute bottom margin, points */ |
| 411 | /* Printer weave: */ |
| 412 | stp_dimension_t m_roll_left_margin; /* Left margin, points */ |
| 413 | stp_dimension_t m_roll_right_margin; /* Right margin, points */ |
| 414 | stp_dimension_t m_roll_top_margin; /* Absolute top margin, points */ |
| 415 | stp_dimension_t m_roll_bottom_margin; /* Absolute bottom margin, points */ |
| 416 | /* Duplex margin limit (SHRT_MIN = no limit): */ |
| 417 | stp_dimension_t duplex_left_margin; /* Left margin, points */ |
| 418 | stp_dimension_t duplex_right_margin; /* Right margin, points */ |
| 419 | stp_dimension_t duplex_top_margin; /* Absolute top margin, points */ |
| 420 | stp_dimension_t duplex_bottom_margin; /* Absolute bottom margin, points */ |
| 421 | /* Print directly to CD */ |
| 422 | stp_dimension_t cd_x_offset; /* Center of CD (horizontal offset) */ |
| 423 | stp_dimension_t cd_y_offset; /* Center of CD (vertical offset) */ |
| 424 | stp_dimension_t cd_page_width; /* Width of "page" when printing to CD */ |
| 425 | stp_dimension_t cd_page_height; /* Height of "page" when printing to CD */ |
| 426 | /* Extra height for form factor command */ |
| 427 | stp_dimension_t paper_extra_bottom; /* Extra space on the bottom of the page */ |
| 428 | /*****************************************************************************/ |
| 429 | /* Parameters for escputil */ |
| 430 | short alignment_passes; |
| 431 | short alignment_choices; |
| 432 | short alternate_alignment_passes; |
| 433 | short alternate_alignment_choices; |
| 434 | /*****************************************************************************/ |
| 435 | stp_raw_t *preinit_sequence; |
| 436 | stp_raw_t *preinit_remote_sequence; |
| 437 | stp_raw_t *postinit_sequence; |
| 438 | stp_raw_t *postinit_remote_sequence; |
| 439 | stp_raw_t *vertical_borderless_sequence; |
| 440 | /*****************/ |
| 441 | stp_mxml_node_t *media; |
| 442 | stp_list_t *media_cache; |
| 443 | stp_string_list_t *papers; |
| 444 | /*****************/ |
| 445 | stp_mxml_node_t *slots; |
| 446 | stp_list_t *slots_cache; |
| 447 | stp_string_list_t *input_slots; |
| 448 | /*****************/ |
| 449 | stp_mxml_node_t *media_sizes; |
| 450 | /*****************/ |
| 451 | stp_string_list_t *channel_names; |
| 452 | /*****************/ |
| 453 | resolution_list_t *resolutions; |
| 454 | /*****************/ |
| 455 | printer_weave_list_t *printer_weaves; |
| 456 | /*****************/ |
| 457 | quality_list_t *quality_list; |
| 458 | /*****************/ |
| 459 | inkgroup_t *inkgroup; |
| 460 | } stpi_escp2_printer_t; |
| 461 | |
| 462 | /* From escp2-channels.c: */ |
| 463 | |
| 464 | extern const inkname_t *stpi_escp2_get_default_black_inkset(void); |
| 465 | extern int stpi_escp2_load_inkgroup(const stp_vars_t *v, const char *name); |
| 466 | |
| 467 | /* From escp2-papers.c: */ |
| 468 | extern int stpi_escp2_load_media(const stp_vars_t *v, const char *name); |
| 469 | extern int stpi_escp2_has_media_feature(const stp_vars_t *v, const char *name); |
| 470 | extern const paper_t *stpi_escp2_get_default_media_type(const stp_vars_t *v); |
| 471 | extern const paper_t *stpi_escp2_get_media_type(const stp_vars_t *v, int ignore_res); |
| 472 | extern int stpi_escp2_printer_supports_rollfeed(const stp_vars_t *v); |
| 473 | extern int stpi_escp2_printer_supports_print_to_cd(const stp_vars_t *v); |
| 474 | extern int stpi_escp2_printer_supports_duplex(const stp_vars_t *v); |
| 475 | |
| 476 | extern int stpi_escp2_load_input_slots(const stp_vars_t *v, const char *name); |
| 477 | extern const input_slot_t *stpi_escp2_get_input_slot(const stp_vars_t *v); |
| 478 | |
| 479 | extern int stpi_escp2_load_media_sizes(const stp_vars_t *v, const char *name); |
| 480 | extern void stpi_escp2_set_media_size(stp_vars_t *v, const stp_vars_t *src); |
| 481 | |
| 482 | /* From escp2-resolutions.c: */ |
| 483 | extern int stpi_escp2_load_resolutions(const stp_vars_t *v, const char *name, |
| 484 | stp_mxml_node_t *node); |
| 485 | extern int stpi_escp2_load_printer_weaves(const stp_vars_t *v, const char *name); |
| 486 | extern int stpi_escp2_load_quality_presets(const stp_vars_t *v, const char *name); |
| 487 | |
| 488 | /* From print-escp2.c: */ |
| 489 | extern const res_t *stpi_escp2_find_resolution(const stp_vars_t *v); |
| 490 | extern const inklist_t *stpi_escp2_inklist(const stp_vars_t *v); |
| 491 | |
| 492 | /* From print-escp2-data.c: */ |
| 493 | extern void stpi_escp2_load_model(const stp_vars_t *v, int model); |
| 494 | extern stpi_escp2_printer_t *stpi_escp2_get_printer(const stp_vars_t *v); |
| 495 | extern model_featureset_t stpi_escp2_get_cap(const stp_vars_t *v, |
| 496 | escp2_model_option_t feature); |
| 497 | extern int stpi_escp2_has_cap(const stp_vars_t *v, escp2_model_option_t feature, |
| 498 | model_featureset_t class); |
| 499 | |
| 500 | |
| 501 | typedef struct |
| 502 | { |
| 503 | /* Basic print head parameters */ |
| 504 | int nozzles; /* Number of nozzles */ |
| 505 | int min_nozzles; /* Fewest nozzles we're allowed to use */ |
| 506 | int nozzle_separation; /* Nozzle separation, in dots */ |
| 507 | int nozzle_start; /* First usable nozzle */ |
| 508 | int *head_offset; /* Head offset (for C80-type printers) */ |
| 509 | int max_head_offset; /* Largest head offset */ |
| 510 | int page_management_units; /* Page management units (dpi) */ |
| 511 | int vertical_units; /* Vertical units (dpi) */ |
| 512 | int horizontal_units; /* Horizontal units (dpi) */ |
| 513 | int micro_units; /* Micro-units for horizontal positioning */ |
| 514 | int unit_scale; /* Scale factor for units */ |
| 515 | int send_zero_pass_advance; /* Send explicit command for zero advance */ |
| 516 | int zero_margin_offset; /* Zero margin offset */ |
| 517 | int split_channel_count; /* For split channels, like C120 */ |
| 518 | int split_channel_width; /* Linewidth for split channels */ |
| 519 | short *split_channels; |
| 520 | |
| 521 | /* Ink parameters */ |
| 522 | int bitwidth; /* Number of bits per ink drop */ |
| 523 | int drop_size; /* ID of the drop size we're using */ |
| 524 | const inkname_t *inkname; /* Description of the ink set */ |
| 525 | int use_aux_channels; /* Use gloss channel */ |
| 526 | |
| 527 | /* Ink channels */ |
| 528 | int logical_channels; /* Number of logical ink channels (e.g.CMYK) */ |
| 529 | int physical_channels; /* Number of physical channels (e.g. CcMmYK) */ |
| 530 | int channels_in_use; /* Number of channels we're using |
| 531 | FIXME merge with physical_channels! */ |
| 532 | unsigned char **cols; /* Output dithered data */ |
| 533 | const physical_subchannel_t **channels; /* Description of each channel */ |
| 534 | |
| 535 | /* Miscellaneous printer control */ |
| 536 | int use_black_parameters; /* Can we use (faster) black head parameters */ |
| 537 | int use_fast_360; /* Can we use fast 360 DPI 4 color mode */ |
| 538 | int advanced_command_set; /* Uses one of the advanced command sets */ |
| 539 | int use_extended_commands; /* Do we use the extended commands? */ |
| 540 | const input_slot_t *input_slot; /* Input slot description */ |
| 541 | const paper_t *paper_type; /* Paper type */ |
| 542 | stp_vars_t *media_settings; /* Hardware media settings */ |
| 543 | const inkgroup_t *ink_group; /* Which set of inks */ |
| 544 | const stp_raw_t *preinit_sequence; /* Initialization sequence */ |
| 545 | const stp_raw_t *preinit_remote_sequence; /* Initialization sequence */ |
| 546 | const stp_raw_t *deinit_sequence; /* De-initialization sequence */ |
| 547 | const stp_raw_t *deinit_remote_sequence; /* De-initialization sequence */ |
| 548 | const stp_raw_t *borderless_sequence; /* Vertical borderless sequence */ |
| 549 | model_featureset_t command_set; /* Which command set this printer supports */ |
| 550 | int variable_dots; /* Print supports variable dot sizes */ |
| 551 | int has_graymode; /* Printer supports fast grayscale mode */ |
| 552 | int roll_only; /* Printer only supports roll-fed media */ |
| 553 | int base_separation; /* Basic unit of separation */ |
| 554 | int resolution_scale; /* Scale factor for ESC(D command */ |
| 555 | int separation_rows; /* Row separation scaling */ |
| 556 | int pseudo_separation_rows; /* Special row separation for some printers */ |
| 557 | int extra_720dpi_separation; /* Special separation needed at 720 DPI */ |
| 558 | int bidirectional_upper_limit; /* Max total resolution for auto-bidi */ |
| 559 | int duplex; |
| 560 | int extra_vertical_feed; /* Extra vertical feed */ |
| 561 | |
| 562 | /* weave parameters */ |
| 563 | int horizontal_passes; /* Number of horizontal passes required |
| 564 | to print a complete row */ |
| 565 | int physical_xdpi; /* Horizontal distance between dots in pass */ |
| 566 | const res_t *res; /* Description of the printing resolution */ |
| 567 | const stp_raw_t *printer_weave; /* Printer weave parameters */ |
| 568 | int use_printer_weave; /* Use the printer weaving mechanism */ |
| 569 | int extra_vertical_passes; /* Quality enhancement */ |
| 570 | |
| 571 | /* page parameters */ /* Indexed from top left */ |
| 572 | stp_dimension_t page_left; /* Left edge of page (points) */ |
| 573 | stp_dimension_t page_right; /* Right edge of page (points) */ |
| 574 | stp_dimension_t page_top; /* Top edge of page (points) */ |
| 575 | stp_dimension_t page_bottom; /* Bottom edge of page (points) */ |
| 576 | stp_dimension_t page_width; /* Page width (points) */ |
| 577 | stp_dimension_t page_height; /* Page height (points) */ |
| 578 | stp_dimension_t page_true_height; /* Physical page height (points) */ |
| 579 | stp_dimension_t page_true_width; /* Physical page height (points) */ |
| 580 | stp_dimension_t cd_x_offset; /* CD X offset (micro units) */ |
| 581 | stp_dimension_t cd_y_offset; /* CD Y offset (micro units) */ |
| 582 | stp_dimension_t cd_outer_radius; /* CD radius (micro units) */ |
| 583 | stp_dimension_t cd_inner_radius; /* CD radius (micro units) */ |
| 584 | int page_extra_height; /* Extra height for set_form_factor (rows) */ |
| 585 | int paper_extra_bottom; /* Extra bottom for set_page_size (rows) */ |
| 586 | |
| 587 | /* Image parameters */ /* Indexed from top left */ |
| 588 | stp_dimension_t image_height; /* Height of printed region (points) */ |
| 589 | stp_dimension_t image_width; /* Width of printed region (points) */ |
| 590 | stp_dimension_t image_top; /* First printed row (points) */ |
| 591 | stp_dimension_t image_left; /* Left edge of image (points) */ |
| 592 | int image_scaled_width; /* Width of physical printed region (dots) */ |
| 593 | int image_printed_width; /* Width of printed region (dots) */ |
| 594 | int image_scaled_height; /* Height of physical printed region (dots) */ |
| 595 | int image_printed_height; /* Height of printed region (dots) */ |
| 596 | int image_left_position; /* Left dot position of image */ |
| 597 | |
| 598 | /* Transitory state */ |
| 599 | int printed_something; /* Have we actually printed anything? */ |
| 600 | int initial_vertical_offset; /* Vertical offset for C80-type printers */ |
| 601 | int printing_initial_vertical_offset; /* Vertical offset, for print cmd */ |
| 602 | int last_color; /* Last color we printed */ |
| 603 | int last_pass_offset; /* Starting row of last pass we printed */ |
| 604 | int last_pass; /* Last pass printed */ |
| 605 | unsigned char *comp_buf; /* Compression buffer for C120-type printers */ |
| 606 | |
| 607 | } escp2_privdata_t; |
| 608 | |
| 609 | extern void stpi_escp2_init_printer(stp_vars_t *v); |
| 610 | extern void stpi_escp2_deinit_printer(stp_vars_t *v); |
| 611 | extern void stpi_escp2_flush_pass(stp_vars_t *v, int passno, |
| 612 | int vertical_subpass); |
| 613 | extern void stpi_escp2_terminate_page(stp_vars_t *v); |
| 614 | |
| 615 | #ifdef TEST_UNCOMPRESSED |
| 616 | #define COMPRESSION (0) |
| 617 | #define FILLFUNC stp_fill_uncompressed |
| 618 | #define COMPUTEFUNC stp_compute_uncompressed_linewidth |
| 619 | #define PACKFUNC stp_pack_uncompressed |
| 620 | #else |
| 621 | #define COMPRESSION (1) |
| 622 | #define FILLFUNC pd->split_channel_count > 0 ? stp_fill_uncompressed : stp_fill_tiff |
| 623 | #define COMPUTEFUNC pd->split_channel_count > 0 ? stp_compute_uncompressed_linewidth : stp_compute_tiff_linewidth |
| 624 | #define PACKFUNC pd->split_channel_count > 0 ? stp_pack_uncompressed : stp_pack_tiff |
| 625 | #endif |
| 626 | |
| 627 | #endif /* GUTENPRINT_INTERNAL_ESCP2_H */ |