Debian Codegraph @

src/main/print-dyesub.c

raw symbols SCIP
1 /*
2 *
3 * Print plug-in DyeSub driver (formerly Olympus driver) for Gutenprint
4 *
5 * Copyright 2003-2006 Michael Mraka ([email protected])
6 *
7 * Copyright 2007-2024 Solomon Peachy ([email protected])
8 *
9 * The plug-in is based on the code of the RAW plugin for the GIMP of
10 * Michael Sweet ([email protected]) and Robert Krawitz ([email protected])
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 */
25
26 /*
27 * This file must include only standard C header files. The core code must
28 * compile on generic platforms that don't support glib, gimp, gtk, etc.
29 */
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif
33
34 #define _POSIX_THREAD_SAFE_FUNCTIONS /* For mingw and localtime_r */
35
36 #include <gutenprint/gutenprint.h>
37 #include "gutenprint-internal.h"
38 #include <gutenprint/gutenprint-intl-internal.h>
39 #include <string.h>
40 #include <stdio.h>
41 #include <limits.h>
42 #include <time.h> /* For strftime() and localtime_r() */
43 #ifdef __GNUC__
44 #define inline __inline__
45 #endif
46
47 #define S6145_YMC /* Generate YMC data for S6145 family */
48 //#define S2245_YMC /* Generate YMC data for S2245 family */
49
50 //#define USE_WRONG_APPGAMMA_BY_DEFAULT
51
52 #define DYESUB_FEATURE_NONE 0x00000000
53 #define DYESUB_FEATURE_FULL_WIDTH 0x00000001 /* Data for nonprinted HORIZONTAL margins must be sent */
54 #define DYESUB_FEATURE_FULL_HEIGHT 0x00000002 /* Data for nonprinted VERTICAL margins must be sent */
55 #define DYESUB_FEATURE_BLOCK_ALIGN 0x00000004 /* Data is sent in BLOCKSIZE chunks */
56 #define DYESUB_FEATURE_BORDERLESS 0x00000008 /* Margins include printable area */
57 #define DYESUB_FEATURE_WHITE_BORDER 0x00000010 /* Margins include printable area, driver filled */
58 #define DYESUB_FEATURE_PLANE_INTERLACE 0x00000020 /* Color info sent one complete plane at a time */
59 #define DYESUB_FEATURE_PLANE_LEFTTORIGHT 0x00000040 /* Data is LTR instead of RTL */
60 #define DYESUB_FEATURE_ROW_INTERLACE 0x00000080 /* Color info sent one complete row at a time */
61 #define DYESUB_FEATURE_DUPLEX 0x00000800 /* Printer supports duplexing */
62 #define DYESUB_FEATURE_MONOCHROME 0x00001000 /* Printer is monochromatic only */
63 #define DYESUB_FEATURE_NATIVECOPIES 0x00002000 /* Copy count is embedded in the data stream */
64 #define DYESUB_FEATURE_HASBACKEND 0x00004000 /* Printer uses an intelligent backend */
65
66 #define DYESUB_PORTRAIT 0 /* Long dimension is Y axis */
67 #define DYESUB_LANDSCAPE 1 /* Long dimension is X asis */
68
69 #define OP_JOB_START 1
70 #define OP_JOB_PRINT 2
71 #define OP_JOB_END 4
72
73 #ifndef MIN
74 # define MIN(a,b) (((a) < (b)) ? (a) : (b))
75 #endif /* !MIN */
76 #ifndef MAX
77 # define MAX(a, b) (((a) > (b)) ? (a) : (b))
78 #endif /* !MAX */
79
80 #define PX(pt,dpi) (int)(((stp_dimension_t)(pt) * (stp_resolution_t)(dpi) / (stp_resolution_t)72) + 0.5f)
81 #define PT(px,dpi) ((stp_resolution_t)(px) * (stp_resolution_t)72 / (stp_dimension_t)(dpi))
82
83 #define PT1(px,dpi) (PT(px,dpi)+2)
84 #define PT2(px,dpi) (PT(px,dpi)+4)
85 #define PT3(px,dpi) (PT(px,dpi)+6)
86 #define PT4(px,dpi) (PT(px,dpi)+8)
87
88 #define LIST(list_t, list_name, items_t, items_name) \
89 static const list_t list_name = \
90 { \
91 items_name, sizeof(items_name) / sizeof(items_t) \
92 }
93
94 #define MAX_INK_CHANNELS 3 /* typically RGB or CMY, revisit if we ever do CMYK */
95 #define SIZE_THRESHOLD 6 /* We skip scaling when dimensions are below this */
96
97 typedef struct
98 {
99 const char *output_type;
100 int output_channels;
101 const char *name;
102 const char *channel_order;
103 } ink_t;
104
105 typedef struct {
106 const ink_t *item;
107 size_t n_items;
108 } ink_list_t;
109
110 typedef struct {
111 const char* name;
112 stp_resolution_t w_dpi;
113 stp_resolution_t h_dpi;
114 } dyesub_resolution_t;
115
116 typedef struct {
117 const dyesub_resolution_t *item;
118 size_t n_items;
119 } dyesub_resolution_list_t;
120
121 typedef struct {
122 stp_papersize_t psize;
123 int print_mode;
124 } dyesub_pagesize_t;
125
126 #define DEFINE_PAPER(__n, __t, __w, __h, __bl, __br, __bt, __bb, __pm) \
127 { \
128 .psize = { \
129 .name = __n, \
130 .text = N_(__t), \
131 .width = __w, \
132 .height = __h, \
133 .top = __bt, \
134 .left = __bl, \
135 .bottom = __bb, \
136 .right = __br, \
137 .paper_unit = PAPERSIZE_ENGLISH_STANDARD, \
138 .paper_size_type = PAPERSIZE_TYPE_STANDARD, \
139 }, \
140 .print_mode = __pm, \
141 }
142
143 #define DEFINE_PAPER_SIMPLE(__n, __t, __w, __h, __pm) \
144 DEFINE_PAPER(__n, __t, __w, __h, 0, 0, 0, 0, __pm)
145
146 typedef struct {
147 const dyesub_pagesize_t *item;
148 size_t n_items;
149 } dyesub_pagesize_list_t;
150
151 typedef struct {
152 const char* res_name;
153 const char* pagesize_name;
154 int width_px;
155 int height_px;
156 } dyesub_printsize_t;
157
158 typedef struct {
159 const dyesub_printsize_t *item;
160 size_t n_items;
161 } dyesub_printsize_list_t;
162
163 typedef struct {
164 const char *name;
165 const char *text;
166 const stp_raw_t seq;
167 } overcoat_t;
168
169 typedef struct {
170 const overcoat_t *item;
171 size_t n_items;
172 } overcoat_list_t;
173
174 typedef struct {
175 const char* name;
176 const char* text;
177 const stp_raw_t seq;
178 } dyesub_media_t;
179
180 typedef struct {
181 const dyesub_media_t *item;
182 size_t n_items;
183 } dyesub_media_list_t;
184
185 typedef struct {
186 const char* name;
187 const char *text;
188 } dyesub_stringitem_t;
189
190 typedef struct {
191 const dyesub_stringitem_t *item;
192 size_t n_items;
193 } dyesub_stringlist_t;
194
195 /* Private data for some of the major dyesub driver families */
196 typedef struct
197 {
198 int multicut;
199 int nocutwaste;
200 int decurl; /* QW410 only */
201 const char *print_speed; /* DS820 & QW410 only */
202 } dnp_privdata_t;
203
204 typedef struct
205 {
206 int quality;
207 int finedeep;
208 int contrast;
209 } mitsu9550_privdata_t;
210
211 typedef struct
212 {
213 int gamma;
214 int unk_gg;
215 int dark;
216 int light;
217 int advance;
218 int sharp;
219 int tone;
220 int printinfo;
221 int longfeed;
222 int papertype;
223 } sonymd_privdata_t;
224
225 typedef struct
226 {
227 int quality;
228 int overcoat_offset;
229 int use_lut;
230 int sharpen;
231 int delay;
232 int deck;
233 int margincutoff;
234 int backfinish;
235 } mitsu70x_privdata_t;
236
237 typedef struct
238 {
239 int use_lut;
240 int quality;
241 int mediaver;
242 int mediatype;
243 } hiti_privdata_t;
244
245 typedef struct
246 {
247 int sharpen;
248 } kodak9810_privdata_t;
249
250 typedef struct
251 {
252 int quality;
253 } kodak6900_privdata_t;
254
255 typedef struct
256 {
257 int sharpen;
258 int matte_intensity;
259 } kodak8500_privdata_t;
260
261 typedef struct
262 {
263 int matte_intensity;
264 int dust_removal;
265 } shinko1245_privdata_t;
266
267 typedef struct
268 {
269 int clear_mem;
270 int cont_print;
271 int gamma;
272 int flags;
273 int comment;
274 int contrast;
275 int sharpen;
276 int brightness;
277 char userlut[34];
278 char usercomment[40];
279 char commentbuf[19]; /* With one extra byte for null termination */
280 } mitsu_p95d_privdata_t;
281
282 typedef struct
283 {
284 int resin_k;
285 int reject;
286 int colorsure;
287 int holokote;
288 int holokote_custom;
289 int holopatch;
290 int overcoat;
291 int overcoat_dpx;
292 const char *overcoat_hole; /* XXX TODO: add custom option? */
293 const char *overcoat_hole_dpx; /* XXX TODO: add custom option? */
294 int align_start;
295 int align_end;
296 int power_color;
297 int power_resin;
298 int power_overcoat;
299 int gamma;
300 int duplex;
301 char mag1[79]; /* Mag stripe row 1, 78 alphanumeric */
302 char mag2[40]; /* Mag stripe row 2, 39 numeric */
303 char mag3[107]; /* Mag stripe row 3, 106 numeric */
304 int mag_coer; /* 1 = high, 0 = low */
305 } magicard_privdata_t;
306
307 /* Private data for dyesub driver as a whole */
308 typedef struct
309 {
310 stp_resolution_t w_dpi, h_dpi;
311 stp_dimension_t w_size, h_size;
312 char plane;
313 int block_min_w, block_min_h;
314 int block_max_w, block_max_h;
315 const char* pagesize;
316 const overcoat_t* overcoat;
317 const dyesub_media_t* media;
318 const char* slot;
319 int print_mode;
320 const char* duplex_mode;
321 int page_number;
322 int copies;
323 int horiz_offset;
324 union {
325 dnp_privdata_t dnp;
326 mitsu9550_privdata_t m9550;
327 mitsu70x_privdata_t m70x;
328 kodak6900_privdata_t k6900;
329 kodak9810_privdata_t k9810;
330 kodak8500_privdata_t k8500;
331 shinko1245_privdata_t s1245;
332 mitsu_p95d_privdata_t m95d;
333 magicard_privdata_t magicard;
334 sonymd_privdata_t sonymd;
335 hiti_privdata_t hiti;
336 } privdata;
337 } dyesub_privdata_t;
338
339 typedef struct {
340 int out_channels;
341 int ink_channels;
342 const char *ink_order;
343 int byteswap;
344 int plane_interlacing;
345 int row_interlacing;
346 unsigned char empty_byte[MAX_INK_CHANNELS]; /* one for each color plane */
347 unsigned short **image_data;
348 int outh_px, outw_px, outt_px, outb_px, outl_px, outr_px;
349 int imgh_px, imgw_px;
350 int prnh_px, prnw_px, prnt_px, prnb_px, prnl_px, prnr_px;
351 int print_mode; /* portrait or landscape */
352 int image_rows;
353 int plane_lefttoright;
354 } dyesub_print_vars_t;
355
356 typedef struct /* printer specific parameters */
357 {
358 int model; /* printer model number from printers.xml*/
359 const ink_list_t *inks;
360 const dyesub_resolution_list_t *resolution;
361 const dyesub_pagesize_list_t *pages;
362 const dyesub_printsize_list_t *printsize;
363 int block_size; /* Really # of rows in a block */
364 int features; /* DYESUB_FEATURE_* */
365 void (*printer_init_func)(stp_vars_t *);
366 void (*printer_end_func)(stp_vars_t *);
367 void (*plane_init_func)(stp_vars_t *);
368 void (*plane_end_func)(stp_vars_t *);
369 void (*block_init_func)(stp_vars_t *);
370 void (*block_end_func)(stp_vars_t *);
371 const overcoat_list_t *overcoat;
372 const dyesub_media_list_t *media;
373 void (*job_start_func)(stp_vars_t *);
374 void (*job_end_func)(stp_vars_t *);
375 const stp_parameter_t *parameters;
376 unsigned int parameter_count;
377 int (*load_parameters)(const stp_vars_t *, const char *name, stp_parameter_t *);
378 int (*parse_parameters)(stp_vars_t *);
379 } dyesub_cap_t;
380
381 static int dyesub_feature(const dyesub_cap_t *caps, int feature);
382 static const dyesub_cap_t* dyesub_get_model_capabilities(const stp_vars_t *v, int model);
383 static const overcoat_t* dyesub_get_overcoat_pattern(stp_vars_t *v);
384 static const dyesub_media_t* dyesub_get_mediatype(stp_vars_t *v);
385 static void dyesub_nputc(stp_vars_t *v, char byte, int count);
386
387 static dyesub_privdata_t *
388 get_privdata(stp_vars_t *v)
389 {
390 return (dyesub_privdata_t *) stp_get_component_data(v, "Driver");
391 }
392
393 /****************** Common ink sets *******************/
394 static const ink_t cmy_inks[] =
395 {
396 { "CMY", 3, "CMY", "\1\2\3" },
397 };
398 LIST(ink_list_t, cmy_ink_list, ink_t, cmy_inks);
399
400 static const ink_t ymc_inks[] =
401 {
402 { "CMY", 3, "CMY", "\3\2\1" },
403 };
404 LIST(ink_list_t, ymc_ink_list, ink_t, ymc_inks);
405
406 static const ink_t rgb_inks[] =
407 {
408 { "RGB", 3, "RGB", "\1\2\3" },
409 };
410 LIST(ink_list_t, rgb_ink_list, ink_t, rgb_inks);
411
412 static const ink_t bgr_inks[] =
413 {
414 { "RGB", 3, "RGB", "\3\2\1" },
415 };
416 LIST(ink_list_t, bgr_ink_list, ink_t, bgr_inks);
417
418 static const ink_t w_inks[] =
419 {
420 { "Whitescale", 1, "BW", "\1" },
421 };
422 LIST(ink_list_t, w_ink_list, ink_t, w_inks);
423
424 /****************** Common Resolutions *******************/
425 static const dyesub_resolution_t res_300dpi[] =
426 {
427 { "300x300", 300, 300},
428 };
429 LIST(dyesub_resolution_list_t, res_300dpi_list, dyesub_resolution_t, res_300dpi);
430
431 static const dyesub_resolution_t res_301dpi[] =
432 {
433 { "301x301", 301, 301},
434 };
435 LIST(dyesub_resolution_list_t, res_301dpi_list, dyesub_resolution_t, res_301dpi);
436
437 static const dyesub_resolution_t res_306dpi[] =
438 {
439 { "306x306", 306, 306},
440 };
441 LIST(dyesub_resolution_list_t, res_306dpi_list, dyesub_resolution_t, res_306dpi);
442
443 static const dyesub_resolution_t res_310dpi[] =
444 {
445 { "310x310", 310, 310},
446 };
447 LIST(dyesub_resolution_list_t, res_310dpi_list, dyesub_resolution_t, res_310dpi);
448
449 static const dyesub_resolution_t res_320dpi[] =
450 {
451 { "320x320", 320, 320},
452 };
453 LIST(dyesub_resolution_list_t, res_320dpi_list, dyesub_resolution_t, res_320dpi);
454
455 static const dyesub_resolution_t res_314dpi[] =
456 {
457 { "314x314", 314, 314},
458 };
459 LIST(dyesub_resolution_list_t, res_314dpi_list, dyesub_resolution_t, res_314dpi);
460
461 static const dyesub_resolution_t res_325dpi[] =
462 {
463 { "325x325", 325, 325},
464 };
465 LIST(dyesub_resolution_list_t, res_325dpi_list, dyesub_resolution_t, res_325dpi);
466
467 static const dyesub_resolution_t res_334dpi[] =
468 {
469 { "334x334", 334, 334},
470 };
471 LIST(dyesub_resolution_list_t, res_334dpi_list, dyesub_resolution_t, res_334dpi);
472
473 static const dyesub_resolution_t res_346dpi[] =
474 {
475 { "346x346", 346, 346},
476 };
477 LIST(dyesub_resolution_list_t, res_346dpi_list, dyesub_resolution_t, res_346dpi);
478
479 static const dyesub_resolution_t res_403dpi[] =
480 {
481 { "403x403", 403, 403},
482 };
483 LIST(dyesub_resolution_list_t, res_403dpi_list, dyesub_resolution_t, res_403dpi);
484
485 static const dyesub_resolution_t res_423dpi[] =
486 {
487 { "423x423", 423, 423},
488 };
489 LIST(dyesub_resolution_list_t, res_423dpi_list, dyesub_resolution_t, res_423dpi);
490
491 /****************** Printer definitions *******************/
492
493 /* Olympus P-10 */
494 static const dyesub_pagesize_t p10_page[] =
495 {
496 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1280,310), PT(1848,310), DYESUB_PORTRAIT),
497 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1144,310), PT(1591,310), DYESUB_PORTRAIT),
498 };
499 LIST(dyesub_pagesize_list_t, p10_page_list, dyesub_pagesize_t, p10_page);
500
501 static const dyesub_printsize_t p10_printsize[] =
502 {
503 { "310x310", "w288h432", 1280, 1848},
504 { "310x310", "B7", 1144, 1591},
505 };
506 LIST(dyesub_printsize_list_t, p10_printsize_list, dyesub_printsize_t, p10_printsize);
507
508 static void p10_printer_init_func(stp_vars_t *v)
509 {
510 dyesub_privdata_t *pd = get_privdata(v);
511
512 stp_zfwrite("\033R\033M\033S\2\033N\1\033D\1\033Y", 1, 15, v);
513 stp_write_raw(&(pd->overcoat->seq), v); /* overcoat */
514 stp_zfwrite("\033Z\0", 1, 3, v);
515 }
516
517 static void p10_printer_end_func(stp_vars_t *v)
518 {
519 stp_zfwrite("\033P", 1, 2, v);
520 }
521
522 static void p10_block_init_func(stp_vars_t *v)
523 {
524 dyesub_privdata_t *pd = get_privdata(v);
525
526 stp_zprintf(v, "\033T%c", pd->plane);
527 stp_put16_le(pd->block_min_w, v);
528 stp_put16_le(pd->block_min_h, v);
529 stp_put16_le(pd->block_max_w + 1, v);
530 stp_put16_le(pd->block_max_h + 1, v);
531 }
532
533 static const overcoat_t p10_overcoat[] =
534 {
535 {"Coated", N_("Coated"), {1, "\x00"}},
536 {"None", N_("None"), {1, "\x02"}},
537 };
538 LIST(overcoat_list_t, p10_overcoat_list, overcoat_t, p10_overcoat);
539
540 /* Olympus P-200 series */
541 static const dyesub_pagesize_t p200_page[] =
542 {
543 DEFINE_PAPER( "ISOB7", "80x125mm", PT(960,320), PT(1280,320), 16, 17, 33, 33, DYESUB_PORTRAIT),
544 };
545 LIST(dyesub_pagesize_list_t, p200_page_list, dyesub_pagesize_t, p200_page);
546
547 static const dyesub_printsize_t p200_printsize[] =
548 {
549 { "320x320", "ISOB7", 960, 1280},
550 };
551 LIST(dyesub_printsize_list_t, p200_printsize_list, dyesub_printsize_t, p200_printsize);
552
553 static void p200_printer_init_func(stp_vars_t *v)
554 {
555 stp_zfwrite("S000001\0S010001\1", 1, 16, v);
556 }
557
558 static void p200_plane_init_func(stp_vars_t *v)
559 {
560 dyesub_privdata_t *pd = get_privdata(v);
561
562 stp_zprintf(v, "P0%d9999", 3 - pd->plane+1 );
563 stp_put32_be(pd->w_size * pd->h_size, v);
564 }
565
566 static void p200_printer_end_func(stp_vars_t *v)
567 {
568 stp_zprintf(v, "P000001\1");
569 }
570
571 /* Olympus P-300 series */
572 static const dyesub_resolution_t p300_res[] =
573 {
574 { "306x306", 306, 306},
575 { "153x153", 153, 153},
576 };
577
578 LIST(dyesub_resolution_list_t, p300_res_list, dyesub_resolution_t, p300_res);
579
580 static const dyesub_pagesize_t p300_page[] =
581 {
582 DEFINE_PAPER( "A6", "A6", PT(1024,306), PT(1376,306), 28, 28, 48, 48, DYESUB_PORTRAIT),
583 };
584
585 LIST(dyesub_pagesize_list_t, p300_page_list, dyesub_pagesize_t, p300_page);
586
587 static const dyesub_printsize_t p300_printsize[] =
588 {
589 { "306x306", "A6", 1024, 1376},
590 { "153x153", "A6", 512, 688},
591 };
592
593 LIST(dyesub_printsize_list_t, p300_printsize_list, dyesub_printsize_t, p300_printsize);
594
595 static void p300_printer_init_func(stp_vars_t *v)
596 {
597 dyesub_privdata_t *pd = get_privdata(v);
598
599 stp_zfwrite("\033\033\033C\033N\1\033F\0\1\033MS\xff\xff\xff"
600 "\033Z", 1, 19, v);
601 stp_put16_be(pd->w_dpi, v);
602 stp_put16_be(pd->h_dpi, v);
603 }
604
605 static void p300_plane_end_func(stp_vars_t *v)
606 {
607 const char *c = "CMY";
608 dyesub_privdata_t *pd = get_privdata(v);
609
610 stp_zprintf(v, "\033\033\033P%cS", c[pd->plane-1]);
611 stp_dprintf(STP_DBG_DYESUB, v, "dyesub: p300_plane_end_func: %c\n",
612 c[pd->plane-1]);
613 }
614
615 static void p300_block_init_func(stp_vars_t *v)
616 {
617 const char *c = "CMY";
618 dyesub_privdata_t *pd = get_privdata(v);
619
620 stp_zprintf(v, "\033\033\033W%c", c[pd->plane-1]);
621 stp_put16_be(pd->block_min_h, v);
622 stp_put16_be(pd->block_min_w, v);
623 stp_put16_be(pd->block_max_h, v);
624 stp_put16_be(pd->block_max_w, v);
625
626 stp_dprintf(STP_DBG_DYESUB, v, "dyesub: p300_block_init_func: %d-%dx%d-%d\n",
627 pd->block_min_w, pd->block_max_w,
628 pd->block_min_h, pd->block_max_h);
629 }
630
631 /* Olympus P-400 series */
632 static const dyesub_pagesize_t p400_page[] =
633 {
634 DEFINE_PAPER( "A4", "A4", PT(2400,314), PT(3200,314), 22, 22, 54, 54, DYESUB_PORTRAIT),
635 DEFINE_PAPER( "c8x10", "A5 wide", PT(2000,314), PT(2400,314), 58, 59, 84, 85, DYESUB_PORTRAIT),
636 DEFINE_PAPER( "C6", "2 Postcards (A4)", PT(1328,314), PT(1920,314), 9, 9, 9, 9, DYESUB_PORTRAIT),
637 };
638
639 LIST(dyesub_pagesize_list_t, p400_page_list, dyesub_pagesize_t, p400_page);
640
641 static const dyesub_printsize_t p400_printsize[] =
642 {
643 { "314x314", "A4", 2400, 3200},
644 { "314x314", "c8x10", 2000, 2400},
645 { "314x314", "C6", 1328, 1920},
646 };
647
648 LIST(dyesub_printsize_list_t, p400_printsize_list, dyesub_printsize_t, p400_printsize);
649
650 static void p400_printer_init_func(stp_vars_t *v)
651 {
652 dyesub_privdata_t *pd = get_privdata(v);
653 int wide = (strcmp(pd->pagesize, "c8x10") == 0
654 || strcmp(pd->pagesize, "C6") == 0);
655
656 stp_zprintf(v, "\033ZQ"); dyesub_nputc(v, '\0', 61);
657 stp_zprintf(v, "\033FP"); dyesub_nputc(v, '\0', 61);
658 stp_zprintf(v, "\033ZF");
659 stp_putc((wide ? '\x40' : '\x00'), v); dyesub_nputc(v, '\0', 60);
660 stp_zprintf(v, "\033ZS");
661 if (wide)
662 {
663 stp_put16_be(pd->h_size, v);
664 stp_put16_be(pd->w_size, v);
665 }
666 else
667 {
668 stp_put16_be(pd->w_size, v);
669 stp_put16_be(pd->h_size, v);
670 }
671 dyesub_nputc(v, '\0', 57);
672 stp_zprintf(v, "\033ZP"); dyesub_nputc(v, '\0', 61);
673 }
674
675 static void p400_plane_init_func(stp_vars_t *v)
676 {
677 stp_zprintf(v, "\033ZC"); dyesub_nputc(v, '\0', 61);
678 }
679
680 static void p400_plane_end_func(stp_vars_t *v)
681 {
682 stp_zprintf(v, "\033P"); dyesub_nputc(v, '\0', 62);
683 }
684
685 static void p400_block_init_func(stp_vars_t *v)
686 {
687 dyesub_privdata_t *pd = get_privdata(v);
688 int wide = (strcmp(pd->pagesize, "c8x10") == 0
689 || strcmp(pd->pagesize, "C6") == 0);
690
691 stp_zprintf(v, "\033Z%c", '3' - pd->plane + 1);
692 if (wide)
693 {
694 stp_put16_be(pd->h_size - pd->block_max_h - 1, v);
695 stp_put16_be(pd->w_size - pd->block_max_w - 1, v);
696 stp_put16_be(pd->block_max_h - pd->block_min_h + 1, v);
697 stp_put16_be(pd->block_max_w - pd->block_min_w + 1, v);
698 }
699 else
700 {
701 stp_put16_be(pd->block_min_w, v);
702 stp_put16_be(pd->block_min_h, v);
703 stp_put16_be(pd->block_max_w - pd->block_min_w + 1, v);
704 stp_put16_be(pd->block_max_h - pd->block_min_h + 1, v);
705 }
706 dyesub_nputc(v, '\0', 53);
707 }
708
709 /* Olympus P-440 series */
710 static const dyesub_pagesize_t p440_page[] =
711 {
712 DEFINE_PAPER( "A4", "A4", PT(2508,314), PT(3200,314), 10, 9, 54, 54, DYESUB_PORTRAIT),
713 DEFINE_PAPER( "c8x10", "A5 wide", PT(2000,314), PT(2508,314), 58, 59, 72, 72, DYESUB_PORTRAIT),
714 DEFINE_PAPER( "C6", "2 Postcards (A4)", PT(1328,314), PT(1920,314), 9, 9, 9, 9, DYESUB_PORTRAIT),
715 DEFINE_PAPER( "w255h581", "A6 wide", PT(892,314), PT(2320,314), 25, 25, 25, 24, DYESUB_PORTRAIT),
716 };
717
718 LIST(dyesub_pagesize_list_t, p440_page_list, dyesub_pagesize_t, p440_page);
719
720 static const dyesub_printsize_t p440_printsize[] =
721 {
722 { "314x314", "A4", 2508, 3200},
723 { "314x314", "c8x10", 2000, 2508},
724 { "314x314", "C6", 1328, 1920},
725 { "314x314", "w255h581", 892, 2320},
726 };
727
728 LIST(dyesub_printsize_list_t, p440_printsize_list, dyesub_printsize_t, p440_printsize);
729
730 static void p440_printer_init_func(stp_vars_t *v)
731 {
732 dyesub_privdata_t *pd = get_privdata(v);
733 int wide = strcmp(pd->pagesize, "A4") != 0;
734
735 stp_zprintf(v, "\033FP"); dyesub_nputc(v, '\0', 61);
736 stp_zprintf(v, "\033Y");
737 stp_write_raw(&(pd->overcoat->seq), v); /* overcoat */
738 dyesub_nputc(v, '\0', 61);
739 stp_zprintf(v, "\033FC"); dyesub_nputc(v, '\0', 61);
740 stp_zprintf(v, "\033ZF");
741 stp_putc((wide ? '\x40' : '\x00'), v); dyesub_nputc(v, '\0', 60);
742 stp_zprintf(v, "\033N\1"); dyesub_nputc(v, '\0', 61);
743 stp_zprintf(v, "\033ZS");
744 if (wide)
745 {
746 stp_put16_be(pd->h_size, v);
747 stp_put16_be(pd->w_size, v);
748 }
749 else
750 {
751 stp_put16_be(pd->w_size, v);
752 stp_put16_be(pd->h_size, v);
753 }
754 dyesub_nputc(v, '\0', 57);
755 if (strcmp(pd->pagesize, "C6") == 0)
756 {
757 stp_zprintf(v, "\033ZC"); dyesub_nputc(v, '\0', 61);
758 }
759 }
760
761 static void p440_printer_end_func(stp_vars_t *v)
762 {
763 stp_zprintf(v, "\033P"); dyesub_nputc(v, '\0', 62);
764 }
765
766 static void p440_block_init_func(stp_vars_t *v)
767 {
768 dyesub_privdata_t *pd = get_privdata(v);
769 int wide = strcmp(pd->pagesize, "A4") != 0;
770
771 stp_zprintf(v, "\033ZT");
772 if (wide)
773 {
774 stp_put16_be(pd->h_size - pd->block_max_h - 1, v);
775 stp_put16_be(pd->w_size - pd->block_max_w - 1, v);
776 stp_put16_be(pd->block_max_h - pd->block_min_h + 1, v);
777 stp_put16_be(pd->block_max_w - pd->block_min_w + 1, v);
778 }
779 else
780 {
781 stp_put16_be(pd->block_min_w, v);
782 stp_put16_be(pd->block_min_h, v);
783 stp_put16_be(pd->block_max_w - pd->block_min_w + 1, v);
784 stp_put16_be(pd->block_max_h - pd->block_min_h + 1, v);
785 }
786 dyesub_nputc(v, '\0', 53);
787 }
788
789 static void p440_block_end_func(stp_vars_t *v)
790 {
791 dyesub_privdata_t *pd = get_privdata(v);
792 int pad = (64 - (((pd->block_max_w - pd->block_min_w + 1)
793 * (pd->block_max_h - pd->block_min_h + 1) * 3) % 64)) % 64;
794 stp_dprintf(STP_DBG_DYESUB, v,
795 "dyesub: max_x %d min_x %d max_y %d min_y %d\n",
796 pd->block_max_w, pd->block_min_w,
797 pd->block_max_h, pd->block_min_h);
798 stp_dprintf(STP_DBG_DYESUB, v, "dyesub: olympus-p440 padding=%d\n", pad);
799 dyesub_nputc(v, '\0', pad);
800 }
801
802
803 /* Olympus P-S100 */
804 static const dyesub_pagesize_t ps100_page[] =
805 {
806 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1254,306), PT(1808,306), DYESUB_PORTRAIT),
807 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1120,306), PT(1554,306), DYESUB_PORTRAIT),
808 };
809
810 LIST(dyesub_pagesize_list_t, ps100_page_list, dyesub_pagesize_t, ps100_page);
811
812 static const dyesub_printsize_t ps100_printsize[] =
813 {
814 { "306x306", "w288h432", 1254, 1808},
815 { "306x306", "B7", 1120, 1554},
816 };
817
818 LIST(dyesub_printsize_list_t, ps100_printsize_list, dyesub_printsize_t, ps100_printsize);
819
820 static void ps100_printer_init_func(stp_vars_t *v)
821 {
822 dyesub_privdata_t *pd = get_privdata(v);
823
824 stp_zprintf(v, "\033U"); dyesub_nputc(v, '\0', 62);
825
826 /* stp_zprintf(v, "\033ZC"); dyesub_nputc(v, '\0', 61); */
827
828 stp_zprintf(v, "\033W"); dyesub_nputc(v, '\0', 62);
829
830 stp_zfwrite("\x30\x2e\x00\xa2\x00\xa0\x00\xa0", 1, 8, v);
831 stp_put16_be(pd->h_size, v); /* paper height (px) */
832 stp_put16_be(pd->w_size, v); /* paper width (px) */
833 dyesub_nputc(v, '\0', 3);
834 stp_putc(pd->copies, v); /* number of copies */
835 dyesub_nputc(v, '\0', 8);
836 stp_putc('\1', v);
837 dyesub_nputc(v, '\0', 15);
838 stp_putc('\6', v);
839 dyesub_nputc(v, '\0', 23);
840
841 stp_zfwrite("\033ZT\0", 1, 4, v);
842 stp_put16_be(0, v); /* image width offset (px) */
843 stp_put16_be(0, v); /* image height offset (px) */
844 stp_put16_be(pd->w_size, v); /* image width (px) */
845 stp_put16_be(pd->h_size, v); /* image height (px) */
846 dyesub_nputc(v, '\0', 52);
847 }
848
849 static void ps100_printer_end_func(stp_vars_t *v)
850 {
851 dyesub_privdata_t *pd = get_privdata(v);
852 int pad = (64 - (((pd->block_max_w - pd->block_min_w + 1)
853 * (pd->block_max_h - pd->block_min_h + 1) * 3) % 64)) % 64;
854 stp_dprintf(STP_DBG_DYESUB, v,
855 "dyesub: max_x %d min_x %d max_y %d min_y %d\n",
856 pd->block_max_w, pd->block_min_w,
857 pd->block_max_h, pd->block_min_h);
858 stp_dprintf(STP_DBG_DYESUB, v, "dyesub: olympus-ps100 padding=%d\n", pad);
859 dyesub_nputc(v, '\0', pad); /* padding to 64B blocks */
860
861 stp_zprintf(v, "\033PY"); dyesub_nputc(v, '\0', 61);
862 stp_zprintf(v, "\033u"); dyesub_nputc(v, '\0', 62);
863 }
864
865
866 /* Canon CP-10 */
867 static const dyesub_pagesize_t cp10_page[] =
868 {
869 DEFINE_PAPER( "w155h244", "Card 54x86mm", PT(662,300), PT(1040,300), 6, 6, 29, 29, DYESUB_PORTRAIT),
870 };
871
872 LIST(dyesub_pagesize_list_t, cp10_page_list, dyesub_pagesize_t, cp10_page);
873
874 static const dyesub_printsize_t cp10_printsize[] =
875 {
876 { "300x300", "w155h244", 662, 1040},
877 };
878
879 LIST(dyesub_printsize_list_t, cp10_printsize_list, dyesub_printsize_t, cp10_printsize);
880
881 /* Canon CP-100 series */
882 static const dyesub_pagesize_t cpx00_page[] =
883 {
884 DEFINE_PAPER( "Postcard", "Postcard 100x148mm", PT(1232,300), PT(1808,300), 13, 13, 16, 19, DYESUB_PORTRAIT),
885 DEFINE_PAPER( "w253h337", "CP_L 89x119mm", PT(1100,300), PT(1456,300), 13, 13, 15, 15, DYESUB_PORTRAIT),
886 DEFINE_PAPER( "w155h244", "Card 54x86mm", PT(672,300), PT(1040,300), 13, 13, 15, 15, DYESUB_LANDSCAPE),
887 };
888
889 LIST(dyesub_pagesize_list_t, cpx00_page_list, dyesub_pagesize_t, cpx00_page);
890
891 static const dyesub_printsize_t cpx00_printsize[] =
892 {
893 { "300x300", "Postcard", 1232, 1808},
894 { "300x300", "w253h337", 1100, 1456},
895 { "300x300", "w155h244", 672, 1040},
896 };
897
898 LIST(dyesub_printsize_list_t, cpx00_printsize_list, dyesub_printsize_t, cpx00_printsize);
899
900 static void cp10_printer_init_func(stp_vars_t *v)
901 {
902 stp_put16_be(0x4000, v);
903 dyesub_nputc(v, '\0', 10);
904 }
905
906 static void cpx00_printer_init_func(stp_vars_t *v)
907 {
908 dyesub_privdata_t *pd = get_privdata(v);
909
910 char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? '\1' :
911 (strcmp(pd->pagesize, "w253h337") == 0 ? '\2' :
912 (strcmp(pd->pagesize, "w155h244") == 0 ?
913 (strcmp(stp_get_driver(v),"canon-cp10") == 0 ?
914 '\0' : '\3' ) :
915 (strcmp(pd->pagesize, "w283h566") == 0 ? '\4' :
916 '\1' ))));
917
918 stp_put16_be(0x4000, v);
919 stp_putc('\0', v);
920 stp_putc(pg, v);
921 dyesub_nputc(v, '\0', 8);
922 }
923
924 static void cpx00_plane_init_func(stp_vars_t *v)
925 {
926 dyesub_privdata_t *pd = get_privdata(v);
927
928 stp_put16_be(0x4001, v);
929 stp_putc(3 - pd->plane, v);
930 stp_putc('\0', v);
931 stp_put32_le(pd->w_size * pd->h_size, v);
932 dyesub_nputc(v, '\0', 4);
933 }
934
935 /* Canon CP-220 series */
936 static const dyesub_pagesize_t cp220_page[] =
937 {
938 DEFINE_PAPER( "Postcard", "Postcard 100x148mm", PT(1232,300), PT(1808,300), 13, 13, 16, 19, DYESUB_PORTRAIT),
939 DEFINE_PAPER( "w253h337", "CP_L 89x119mm", PT(1100,300), PT(1456,300), 13, 13, 15, 15, DYESUB_PORTRAIT),
940 DEFINE_PAPER( "w155h244", "Card 54x86mm", PT(672,300), PT(1040,300), 13, 13, 15, 15, DYESUB_LANDSCAPE),
941 DEFINE_PAPER( "w283h566", "Wide 100x200mm", PT(1232,300), PT(2416,300), 13, 13, 20, 20, DYESUB_PORTRAIT),
942 };
943
944 LIST(dyesub_pagesize_list_t, cp220_page_list, dyesub_pagesize_t, cp220_page);
945
946 static const dyesub_printsize_t cp220_printsize[] =
947 {
948 { "300x300", "Postcard", 1232, 1808},
949 { "300x300", "w253h337", 1100, 1456},
950 { "300x300", "w155h244", 672, 1040},
951 { "300x300", "w283h566", 1232, 2416},
952 };
953
954 LIST(dyesub_printsize_list_t, cp220_printsize_list, dyesub_printsize_t, cp220_printsize);
955
956 /* Canon SELPHY CP790 */
957 static void cp790_printer_init_func(stp_vars_t *v)
958 {
959 dyesub_privdata_t *pd = get_privdata(v);
960
961 char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? '\0' :
962 (strcmp(pd->pagesize, "w253h337") == 0 ? '\1' :
963 (strcmp(pd->pagesize, "w155h244") == 0 ? '\2' :
964 (strcmp(pd->pagesize, "w283h566") == 0 ? '\3' :
965 '\0' ))));
966
967 stp_put16_be(0x4000, v);
968 stp_putc(pg, v);
969 stp_putc('\0', v);
970 dyesub_nputc(v, '\0', 8);
971 stp_put32_le(pd->w_size * pd->h_size, v);
972 }
973
974 /* Canon SELPHY ES series */
975 static void es1_printer_init_func(stp_vars_t *v)
976 {
977 dyesub_privdata_t *pd = get_privdata(v);
978
979 char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x11 :
980 (strcmp(pd->pagesize, "w253h337") == 0 ? 0x12 :
981 (strcmp(pd->pagesize, "w155h244") == 0 ? 0x13 : 0x11)));
982
983 stp_put16_be(0x4000, v);
984 stp_putc(0x10, v); /* 0x20 for P-BW */
985 stp_putc(pg, v);
986 dyesub_nputc(v, '\0', 8);
987 }
988
989 static void es1_plane_init_func(stp_vars_t *v)
990 {
991 dyesub_privdata_t *pd = get_privdata(v);
992
993 unsigned char plane = 0;
994
995 switch (pd->plane) {
996 case 3: /* Y */
997 plane = 0x01;
998 break;
999 case 2: /* M */
1000 plane = 0x03;
1001 break;
1002 case 1: /* C */
1003 plane = 0x07;
1004 break;
1005 }
1006
1007 stp_put16_be(0x4001, v);
1008 stp_putc(0x1, v); /* 0x02 for P-BW */
1009 stp_putc(plane, v);
1010 stp_put32_le(pd->w_size * pd->h_size, v);
1011 dyesub_nputc(v, '\0', 4);
1012 }
1013
1014 static void es2_printer_init_func(stp_vars_t *v)
1015 {
1016 dyesub_privdata_t *pd = get_privdata(v);
1017
1018 char pg2 = 0x0;
1019 char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x1:
1020 (strcmp(pd->pagesize, "w253h337") == 0 ? 0x2 :
1021 (strcmp(pd->pagesize, "w155h244") == 0 ? 0x3 : 0x1)));
1022
1023 if (pg == 0x03)
1024 pg2 = 0x01;
1025
1026 stp_put16_be(0x4000, v);
1027 stp_putc(pg, v);
1028 stp_putc(0x0, v);
1029
1030 stp_putc(0x2, v);
1031 dyesub_nputc(v, 0x0, 2);
1032 stp_putc(0x0, v); /* 0x1 for P-BW */
1033
1034 dyesub_nputc(v, 0x0, 3);
1035 stp_putc(pg2, v);
1036 stp_put32_le(pd->w_size * pd->h_size, v);
1037 }
1038
1039 static void es2_plane_init_func(stp_vars_t *v)
1040 {
1041 dyesub_privdata_t *pd = get_privdata(v);
1042
1043 stp_put16_be(0x4001, v);
1044 stp_putc(4 - pd->plane, v);
1045 stp_putc(0x0, v);
1046 dyesub_nputc(v, '\0', 8);
1047 }
1048
1049 static void es3_printer_init_func(stp_vars_t *v)
1050 {
1051 dyesub_privdata_t *pd = get_privdata(v);
1052
1053 char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x1:
1054 (strcmp(pd->pagesize, "w253h337") == 0 ? 0x2 :
1055 (strcmp(pd->pagesize, "w155h244") == 0 ? 0x3 : 0x1)));
1056
1057 /* We also have Pg and Ps (Gold/Silver) papers on the ES3/30/40 */
1058
1059 stp_put16_be(0x4000, v);
1060 stp_putc(pg, v);
1061 stp_putc(0x0, v); /* 0x1 for P-BW */
1062 dyesub_nputc(v, 0x0, 8);
1063 stp_put32_le(pd->w_size * pd->h_size, v);
1064 }
1065
1066 static void es3_printer_end_func(stp_vars_t *v)
1067 {
1068 stp_put16_be(0x4020, v);
1069 dyesub_nputc(v, 0x0, 10);
1070 }
1071
1072 static void es40_printer_init_func(stp_vars_t *v)
1073 {
1074 dyesub_privdata_t *pd = get_privdata(v);
1075
1076 char pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x0:
1077 (strcmp(pd->pagesize, "w253h337") == 0 ? 0x1 :
1078 (strcmp(pd->pagesize, "w155h244") == 0 ? 0x2 : 0x0)));
1079
1080 /* We also have Pg and Ps (Gold/Silver) papers on the ES3/30/40 */
1081
1082 stp_put16_be(0x4000, v);
1083 stp_putc(pg, v);
1084 stp_putc(0x0, v); /* 0x1 for P-BW */
1085 dyesub_nputc(v, 0x0, 8);
1086
1087 stp_put32_le(pd->w_size * pd->h_size, v);
1088 }
1089
1090 /* Canon SELPHY CP900 */
1091 static void cp900_printer_end_func(stp_vars_t *v)
1092 {
1093 dyesub_nputc(v, 0x0, 4);
1094 }
1095
1096 /* Canon CP820/CP910/CP1000/CP1200 and beynod */
1097 static const dyesub_pagesize_t cp910_page[] =
1098 {
1099 DEFINE_PAPER( "Postcard", "Postcard 100x148mm", PT(1248,300), PT(1872,300), 13, 13, 16, 19, DYESUB_PORTRAIT),
1100 DEFINE_PAPER( "w253h337", "CP_L 89x119mm", PT(1152,300), PT(1472,300), 13, 13, 15, 15, DYESUB_PORTRAIT),
1101 DEFINE_PAPER( "w155h244", "Card 54x86mm", PT(668,300), PT(1088,300), 13, 13, 15, 15, DYESUB_LANDSCAPE),
1102 };
1103
1104 LIST(dyesub_pagesize_list_t, cp910_page_list, dyesub_pagesize_t, cp910_page);
1105
1106 static const dyesub_printsize_t cp910_printsize[] =
1107 {
1108 { "300x300", "Postcard", 1248, 1872},
1109 { "300x300", "w253h337", 1152, 1472},
1110 { "300x300", "w155h244", 668, 1088},
1111 };
1112
1113 LIST(dyesub_printsize_list_t, cp910_printsize_list, dyesub_printsize_t, cp910_printsize);
1114
1115 static void cp910_printer_init_func(stp_vars_t *v)
1116 {
1117 dyesub_privdata_t *pd = get_privdata(v);
1118
1119 char pg;
1120
1121 stp_zfwrite("\x0f\x00\x00\x40\x00\x00\x00\x00", 1, 8, v);
1122 stp_zfwrite("\x00\x00\x00\x00\x00\x00\x01\x00", 1, 8, v);
1123 stp_putc(0x01, v);
1124 stp_putc(0x00, v);
1125
1126 pg = (strcmp(pd->pagesize, "Postcard") == 0 ? 0x50 :
1127 (strcmp(pd->pagesize, "w253h337") == 0 ? 0x4c :
1128 (strcmp(pd->pagesize, "w155h244") == 0 ? 0x43 :
1129 0x50 )));
1130 stp_putc(pg, v);
1131
1132 dyesub_nputc(v, '\0', 4);
1133 stp_putc(0x01, v);
1134
1135 stp_put32_le(pd->w_size, v);
1136 stp_put32_le(pd->h_size, v);
1137 }
1138
1139 /* Sony DPP-EX5, DPP-EX7 */
1140
1141 /* only Postcard pagesize is supported */
1142 static const dyesub_pagesize_t dppex5_page[] =
1143 {
1144 DEFINE_PAPER( "w288h432", "Postcard", PT(1664,403), PT(2466,403), 13, 14, 18, 17, DYESUB_PORTRAIT),
1145 };
1146
1147 LIST(dyesub_pagesize_list_t, dppex5_page_list, dyesub_pagesize_t, dppex5_page);
1148
1149 static const dyesub_printsize_t dppex5_printsize[] =
1150 {
1151 { "403x403", "w288h432", 1664, 2466},
1152 };
1153
1154 LIST(dyesub_printsize_list_t, dppex5_printsize_list, dyesub_printsize_t, dppex5_printsize);
1155
1156 static void dppex5_printer_init(stp_vars_t *v)
1157 {
1158 dyesub_privdata_t *pd = get_privdata(v);
1159
1160 stp_zfwrite("DPEX\0\0\0\x80", 1, 8, v);
1161 stp_zfwrite("DPEX\0\0\0\x82", 1, 8, v);
1162 stp_zfwrite("DPEX\0\0\0\x84", 1, 8, v);
1163 stp_put32_be(pd->w_size, v);
1164 stp_put32_be(pd->h_size, v);
1165 stp_zfwrite("S\0o\0n\0y\0 \0D\0P\0P\0-\0E\0X\0\x35\0", 1, 24, v);
1166 dyesub_nputc(v, '\0', 40);
1167 stp_zfwrite("\1\4\0\4\xdc\0\x24\0\3\3\1\0\1\0\x82\0", 1, 16, v);
1168 stp_zfwrite("\xf4\5\xf8\3\x64\0\1\0\x0e\0\x93\1\2\0\1\0", 1, 16, v);
1169 stp_zfwrite("\x93\1\1\0\0\0", 1, 6, v);
1170 stp_zfwrite("P\0o\0s\0t\0 \0c\0a\0r\0d\0", 1, 18, v);
1171 dyesub_nputc(v, '\0', 46);
1172 stp_zfwrite("\x93\1\x18", 1, 3, v);
1173 dyesub_nputc(v, '\0', 19);
1174 stp_zfwrite("\2\0\0\0\3\0\0\0\1\0\0\0\1", 1, 13, v);
1175 dyesub_nputc(v, '\0', 19);
1176 stp_zprintf(v, "5EPD");
1177 dyesub_nputc(v, '\0', 4);
1178 stp_zfwrite((pd->overcoat->seq).data, 1,
1179 (pd->overcoat->seq).bytes, v); /*overcoat pattern*/
1180 stp_zfwrite("\0d\0d\0d", 1, 6, v);
1181 dyesub_nputc(v, '\0', 21);
1182 }
1183
1184 static void dppex5_block_init(stp_vars_t *v)
1185 {
1186 dyesub_privdata_t *pd = get_privdata(v);
1187
1188 stp_zfwrite("DPEX\0\0\0\x85", 1, 8, v);
1189 stp_put32_be((pd->block_max_w - pd->block_min_w + 1)
1190 * (pd->block_max_h - pd->block_min_h + 1) * 3, v);
1191 }
1192
1193 static void dppex5_printer_end(stp_vars_t *v)
1194 {
1195 stp_zfwrite("DPEX\0\0\0\x83", 1, 8, v);
1196 stp_zfwrite("DPEX\0\0\0\x81", 1, 8, v);
1197 }
1198
1199 static const overcoat_t dppex5_overcoat[] =
1200 {
1201 {"Glossy", N_("Glossy"), {1, "\x00"}},
1202 {"Texture", N_("Texture"), {1, "\x01"}},
1203 };
1204
1205 LIST(overcoat_list_t, dppex5_overcoat_list, overcoat_t, dppex5_overcoat);
1206
1207
1208 /* Sony UP-DP10 */
1209 static const dyesub_pagesize_t updp10_page[] =
1210 {
1211 DEFINE_PAPER( "w288h432", "UPC-10P23 (4x6)", PT(1200,300), PT(1800,300), 12, 12, 18, 18, DYESUB_LANDSCAPE),
1212 DEFINE_PAPER( "w288h387", "UPC-10P34 (4x5)", PT(1200,300), PT(1600,300), 12, 12, 16, 16, DYESUB_LANDSCAPE),
1213 };
1214
1215 LIST(dyesub_pagesize_list_t, updp10_page_list, dyesub_pagesize_t, updp10_page);
1216
1217 static const dyesub_printsize_t updp10_printsize[] =
1218 {
1219 { "300x300", "w288h432", 1200, 1800},
1220 { "300x300", "w288h387", 1200, 1600},
1221 };
1222
1223 LIST(dyesub_printsize_list_t, updp10_printsize_list, dyesub_printsize_t, updp10_printsize);
1224
1225 static void updp10_printer_init_func(stp_vars_t *v)
1226 {
1227 dyesub_privdata_t *pd = get_privdata(v);
1228
1229 stp_zfwrite("\x98\xff\xff\xff"
1230 "\xff\xff\xff\xff"
1231 "\x09\x00\x00\x00"
1232 "\x1b\xee\x00\x00"
1233 "\x00\x02\x00", 1, 19, v);
1234 stp_put16_be(pd->copies, v);
1235 stp_zfwrite("\x12\x00\x00\x00"
1236 "\x1b\xe1\x00\x00\x00\x0b\x00\x00\x04", 1, 13, v);
1237 stp_zfwrite((pd->overcoat->seq).data, 1,
1238 (pd->overcoat->seq).bytes, v); /*overcoat pattern*/
1239 stp_zfwrite("\x00\x00\x00\x00", 1, 4, v);
1240 stp_put16_be(pd->w_size, v);
1241 stp_put16_be(pd->h_size, v);
1242 stp_zfwrite("\x14\x00\x00\x00"
1243 "\x1b\x15\x00\x00\x00\x0d\x00\x00"
1244 "\x00\x00\x00\x07\x00\x00\x00\x00", 1, 20, v);
1245 stp_put16_be(pd->w_size, v);
1246 stp_put16_be(pd->h_size, v);
1247 stp_put32_le(pd->w_size*pd->h_size*3+11, v);
1248 stp_zfwrite("\x1b\xea\x00\x00\x00\x00", 1, 6, v);
1249 stp_put32_be(pd->w_size*pd->h_size*3, v);
1250 stp_zfwrite("\x00", 1, 1, v);
1251 }
1252
1253 static void updp10_printer_end_func(stp_vars_t *v)
1254 {
1255 stp_zfwrite("\xff\xff\xff\xff"
1256 "\x07\x00\x00\x00"
1257 "\x1b\x0a\x00\x00\x00\x00\x00"
1258 "\xfd\xff\xff\xff"
1259 "\xff\xff\xff\xff", 1, 23, v);
1260 }
1261
1262 static const overcoat_t updp10_overcoat[] =
1263 {
1264 {"Glossy", N_("Glossy"), {1, "\x00"}},
1265 {"Texture", N_("Texture"), {1, "\x08"}},
1266 {"Matte", N_("Matte"), {1, "\x0c"}},
1267 };
1268
1269 LIST(overcoat_list_t, updp10_overcoat_list, overcoat_t, updp10_overcoat);
1270
1271 /* Sony UP-DR100 */
1272 static const dyesub_pagesize_t updr100_page[] =
1273 {
1274 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1382,334), PT(2048,334), DYESUB_LANDSCAPE),
1275 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1210,334), PT(1710,334), DYESUB_LANDSCAPE),
1276 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1710,334), PT(2380,334), DYESUB_PORTRAIT),
1277 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(2048,334), PT(2724,334), DYESUB_PORTRAIT),
1278 };
1279
1280 LIST(dyesub_pagesize_list_t, updr100_page_list, dyesub_pagesize_t, updr100_page);
1281
1282 static const dyesub_printsize_t updr100_printsize[] =
1283 {
1284 { "334x334", "w288h432", 1382, 2048},
1285 { "334x334", "B7", 1210, 1710},
1286 { "334x334", "w360h504", 1710, 2380},
1287 { "334x334", "w432h576", 2048, 2724},
1288 };
1289
1290 LIST(dyesub_printsize_list_t, updr100_printsize_list, dyesub_printsize_t, updr100_printsize);
1291
1292 static void updr100_printer_init_func(stp_vars_t *v)
1293 {
1294 dyesub_privdata_t *pd = get_privdata(v);
1295
1296 stp_zfwrite("UPD8D\x00\x00\x00\x10\x03\x00\x00", 1, 12, v);
1297 stp_put32_le(pd->w_size, v);
1298 stp_put32_le(pd->h_size, v);
1299 stp_zfwrite("\x1e\x00\x03\x00\x01\x00\x4e\x01\x00\x00", 1, 10, v);
1300 stp_write_raw(&(pd->overcoat->seq), v); /* overcoat pattern */
1301 dyesub_nputc(v, '\0', 13);
1302 stp_zfwrite("\x01\x00\x01\x00\x03", 1, 5, v);
1303 dyesub_nputc(v, '\0', 19);
1304 }
1305
1306 static void updr100_printer_end_func(stp_vars_t *v)
1307 {
1308 stp_zfwrite("UPD8D\x00\x00\x00\x02", 1, 9, v);
1309 dyesub_nputc(v, '\0', 25);
1310 stp_zfwrite("\x9d\x02\x00\x04\x00\x00\xc0\xe7"
1311 "\x9d\x02\x54\xe9\x9d\x02\x9d\x71"
1312 "\x00\x73\xfa\x71\x00\x73\xf4\xea"
1313 "\x9d\x02\xa8\x3e\x00\x73\x9c\xeb\x9d\x02"
1314 , 1, 34, v);
1315 }
1316
1317 static const overcoat_t updr100_overcoat[] =
1318 {
1319 {"Glossy", N_("Glossy"), {1, "\x01"}},
1320 {"Texture", N_("Texture"), {1, "\x03"}},
1321 {"Matte", N_("Matte"), {1, "\x04"}},
1322 };
1323
1324 LIST(overcoat_list_t, updr100_overcoat_list, overcoat_t, updr100_overcoat);
1325
1326 /* Sony UP-DR150 */
1327 static const dyesub_pagesize_t updr150_page[] =
1328 {
1329 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1382,334), PT(2048,334), DYESUB_LANDSCAPE),
1330 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1210,334), PT(1728,334), DYESUB_LANDSCAPE),
1331 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1728,334), PT(2380,334), DYESUB_PORTRAIT),
1332 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(2048,334), PT(2724,334), DYESUB_PORTRAIT),
1333 };
1334
1335 LIST(dyesub_pagesize_list_t, updr150_page_list, dyesub_pagesize_t, updr150_page);
1336
1337 static const dyesub_printsize_t updr150_printsize[] =
1338 {
1339 { "334x334", "w288h432", 1382, 2048},
1340 { "334x334", "B7", 1210, 1728},
1341 { "334x334", "w360h504", 1728, 2380},
1342 { "334x334", "w432h576", 2048, 2724},
1343 };
1344
1345 LIST(dyesub_printsize_list_t, updr150_printsize_list, dyesub_printsize_t, updr150_printsize);
1346
1347 static void updr150_200_printer_init_func(stp_vars_t *v, int updr200)
1348 {
1349 dyesub_privdata_t *pd = get_privdata(v);
1350
1351 char pg;
1352
1353 stp_zfwrite("\x6a\xff\xff\xff"
1354 "\xef\xff\xff\xff", 1, 8, v);
1355
1356 if (strcmp(pd->pagesize,"B7") == 0)
1357 pg = '\x01';
1358 else if (strcmp(pd->pagesize,"w288h432") == 0)
1359 pg = '\x02';
1360 else if (updr200 && strcmp(pd->pagesize,"w288h432-div2") == 0)
1361 pg = '\x02';
1362 else if (strcmp(pd->pagesize,"w360h504") == 0)
1363 pg = '\x03';
1364 else if (updr200 && strcmp(pd->pagesize,"w360h504-div2") == 0)
1365 pg = '\x03';
1366 else if (strcmp(pd->pagesize,"w432h576") == 0)
1367 pg = '\x04';
1368 else if (updr200 && strcmp(pd->pagesize,"w432h576-div2") == 0)
1369 pg = '\x04';
1370 else
1371 pg = 0;
1372
1373 stp_put32_le(pg, v);
1374
1375 stp_zfwrite("\xfc\xff\xff\xff"
1376 "\xfb\xff\xff\xff"
1377 "\xf4\xff\xff\xff"
1378 "\xf5\xff\xff\xff",
1379 1, 16, v);
1380
1381 /* Multicut mode */
1382 if (updr200) {
1383 if (!strcmp(pd->pagesize,"w288h432-div2") ||
1384 !strcmp(pd->pagesize,"w360h504-div2") ||
1385 !strcmp(pd->pagesize,"w432h576-div2"))
1386 pg = 0x01;
1387 else
1388 pg = 0x02;
1389 } else {
1390 pg = 0x01;
1391 }
1392
1393 stp_put32_le(pg, v);
1394
1395 stp_zfwrite("\x07\x00\x00\x00"
1396 "\x1b\xe5\x00\x00\x00\x08\x00"
1397 "\x08\x00\x00\x00"
1398 "\x00\x00\x00\x00\x00\x00\x01\x00"
1399 "\xed\xff\xff\xff"
1400 "\x07\x00\x00\x00"
1401 "\x1b\xee\x00\x00\x00\x02\x00"
1402 "\x02\x00\x00\x00", 1, 42, v);
1403 stp_put16_be(pd->copies, v);
1404
1405 if (updr200) { /* UP-DR200-specific! */
1406 stp_zfwrite("\x07\x00\x00\x00"
1407 "\x1b\xc0\x00\x03\x00\x05\x00", 1, 11, v);
1408 stp_zfwrite("\x05\x00\x00\x00"
1409 "\x02\x03\x00\x01", 1, 8, v);
1410
1411 if (!strcmp(pd->pagesize,"w288h432-div2") ||
1412 !strcmp(pd->pagesize,"w360h504-div2") ||
1413 !strcmp(pd->pagesize,"w432h576-div2"))
1414 stp_putc(0x02, v);
1415 else
1416 stp_putc(0x00, v);
1417 }
1418
1419 stp_zfwrite("\x07\x00\x00\x00"
1420 "\x1b\x15\x00\x00\x00\x0d\x00"
1421 "\x0d\x00\x00\x00"
1422 "\x00\x00\x00\x00\x07\x00\x00\x00\x00", 1, 24, v);
1423
1424 stp_put16_be(pd->w_size, v);
1425 stp_put16_be(pd->h_size, v);
1426
1427 stp_zfwrite("\xf9\xff\xff\xff",
1428 1, 4, v);
1429 stp_zfwrite("\x07\x00\x00\x00"
1430 "\x1b\xe1\x00\x00\x00\x0b\x00"
1431 "\x0b\x00\x00\x00\x00\x80", 1, 17, v);
1432 stp_zfwrite((pd->overcoat->seq).data, 1,
1433 (pd->overcoat->seq).bytes, v); /*overcoat pattern*/
1434
1435 stp_zfwrite("\x00\x00\x00\x00", 1, 4, v);
1436 stp_put16_be(pd->w_size, v);
1437 stp_put16_be(pd->h_size, v);
1438 stp_zfwrite("\xf8\xff\xff\xff", 1, 4, v);
1439
1440 /* Each data block has this header. Can actually have multiple blocks! */
1441 stp_zfwrite("\xec\xff\xff\xff", 1, 4, v);
1442 stp_zfwrite("\x0b\x00\x00\x00\x1b\xea"
1443 "\x00\x00\x00\x00", 1, 10, v);
1444 stp_put32_be(pd->w_size*pd->h_size*3, v);
1445 stp_zfwrite("\x00", 1, 1, v);
1446 stp_put32_le(pd->w_size*pd->h_size*3, v);
1447 }
1448
1449 static void updr150_printer_init_func(stp_vars_t *v)
1450 {
1451 updr150_200_printer_init_func(v, 0);
1452 }
1453
1454 static void updr150_200_printer_end_func(stp_vars_t *v, int updr200)
1455 {
1456 dyesub_privdata_t *pd = get_privdata(v);
1457
1458 stp_zfwrite("\xeb\xff\xff\xff"
1459 "\xfc\xff\xff\xff"
1460 "\xfa\xff\xff\xff",
1461 1, 12, v);
1462 stp_zfwrite("\x07\x00\x00\x00"
1463 "\x1b\x0a\x00\x00\x00\x00\x00"
1464 "\x07\x00\x00\x00"
1465 "\x1b\x17\x00\x00\x00\x00\x00",
1466 1, 22, v);
1467
1468 /* Multicut mode */
1469 if (updr200) {
1470 if (!strcmp(pd->pagesize,"w288h432-div2") ||
1471 !strcmp(pd->pagesize,"w360h504-div2") ||
1472 !strcmp(pd->pagesize,"w432h576-div2")) {
1473 stp_zfwrite("\x07\x00\x00\x00"
1474 "\x1b\xc0\x00\x03\x00\x05\x00", 1, 11, v);
1475 stp_zfwrite("\x05\x00\x00\x00"
1476 "\x02\x03\x00\x01\x01", 1, 9, v);
1477 }
1478 }
1479 stp_zfwrite("\xf3\xff\xff\xff",
1480 1, 4, v);
1481 }
1482
1483 static void updr150_printer_end_func(stp_vars_t *v)
1484 {
1485 updr150_200_printer_end_func(v, 0);
1486 }
1487
1488 static void updr200_printer_end_func(stp_vars_t *v)
1489 {
1490 updr150_200_printer_end_func(v, 1);
1491 }
1492
1493 /* Sony UP-DR200 */
1494 static const dyesub_pagesize_t updr200_page[] =
1495 {
1496 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1382,334), PT(2048,334), DYESUB_LANDSCAPE),
1497 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1382,334), PT(2048,334), 0, PT1(0,334), 0, 0, DYESUB_LANDSCAPE),
1498 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1210,334), PT(1728,334), DYESUB_LANDSCAPE),
1499 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1728,334), PT(2380,334), DYESUB_PORTRAIT),
1500 DEFINE_PAPER_SIMPLE( "w360h504-div2", "3.5x5*2", PT(1728,334), PT(2420,334), DYESUB_PORTRAIT),
1501 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(2048,334), PT(2724,334), DYESUB_PORTRAIT),
1502 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(2048,334), PT(2764,334), DYESUB_PORTRAIT),
1503 };
1504
1505 LIST(dyesub_pagesize_list_t, updr200_page_list, dyesub_pagesize_t, updr200_page);
1506
1507 static const dyesub_printsize_t updr200_printsize[] =
1508 {
1509 { "334x334", "w288h432", 1382, 2048},
1510 { "334x334", "w288h432-div2", 1382, 2048},
1511 { "334x334", "B7", 1210, 1728},
1512 { "334x334", "w360h504", 1728, 2380},
1513 { "334x334", "w360h504-div2", 1728, 2420},
1514 { "334x334", "w432h576", 2048, 2724},
1515 { "334x334", "w432h576-div2", 2048, 2764},
1516 };
1517
1518 LIST(dyesub_printsize_list_t, updr200_printsize_list, dyesub_printsize_t, updr200_printsize);
1519
1520 static const overcoat_t updr200_overcoat[] =
1521 {
1522 {"Glossy", N_("Glossy"), {1, "\x00"}},
1523 {"Matte", N_("Matte"), {1, "\x0c"}},
1524 {"Glossy_NoCorr", N_("Glossy_NoCorr"), {1, "\x10"}},
1525 {"Matte_NoCorr", N_("Matte_NoCorr"), {1, "\x1c"}},
1526 };
1527
1528 LIST(overcoat_list_t, updr200_overcoat_list, overcoat_t, updr200_overcoat);
1529
1530 static void updr200_printer_init_func(stp_vars_t *v)
1531 {
1532 updr150_200_printer_init_func(v, 1);
1533 }
1534
1535 /* Sony UP-CR10L / DNP SL10 */
1536 static const dyesub_pagesize_t upcr10_page[] =
1537 {
1538 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1248,300), PT(1848,300), DYESUB_PORTRAIT),
1539 DEFINE_PAPER_SIMPLE( "B7", "5x3.5", PT(1536,300), PT(1100,300), DYESUB_LANDSCAPE),
1540 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1536,300), PT(2148,300), DYESUB_PORTRAIT),
1541 DEFINE_PAPER_SIMPLE( "w288h576", "4x8", PT(1248,300), PT(2448,300), DYESUB_PORTRAIT),
1542 };
1543
1544 LIST(dyesub_pagesize_list_t, upcr10_page_list, dyesub_pagesize_t, upcr10_page);
1545
1546 static const dyesub_printsize_t upcr10_printsize[] =
1547 {
1548 { "300x300", "w288h432", 1248, 1848},
1549 { "300x300", "B7", 1536, 1100},
1550 { "300x300", "w360h504", 1536, 2148},
1551 { "300x300", "w288h576", 1248, 2448},
1552 };
1553
1554 LIST(dyesub_printsize_list_t, upcr10_printsize_list, dyesub_printsize_t, upcr10_printsize);
1555
1556 static void upcr10_cx1_printer_init_func(stp_vars_t *v, int cx1)
1557 {
1558 dyesub_privdata_t *pd = get_privdata(v);
1559
1560 char pg = 0;
1561
1562 stp_zfwrite("\x60\xff\xff\xff"
1563 "\xf8\xff\xff\xff", 1, 8, v);
1564
1565 if (cx1)
1566 stp_zfwrite("\xf0\xff\xff\xff", 1, 4, v);
1567 if (strcmp(pd->pagesize,"B7") == 0)
1568 pg = '\xff';
1569 else if (strcmp(pd->pagesize,"w288h432") == 0)
1570 pg = '\xfe';
1571 else if (strcmp(pd->pagesize,"w360h504") == 0)
1572 pg = '\xfd';
1573 else if (strcmp(pd->pagesize,"w288h576") == 0)
1574 pg = '\xf1';
1575
1576 stp_putc(pg, v);
1577 stp_zfwrite("\xff\xff\xff"
1578 "\x14\x00\x00\x00"
1579 "\x1b\x15\x00\x00\x00\x0d\x00\x00"
1580 "\x00\x00\x00\x07\x00\x00\x00\x00", 1, 23, v);
1581 stp_put16_be(pd->w_size, v);
1582 stp_put16_be(pd->h_size, v);
1583 stp_zfwrite("\xfb\xff\xff\xff"
1584 "\xf4\xff\xff\xff\x0b\x00\x00\x00"
1585 "\x1b\xea\x00\x00\x00\x00", 1, 18, v);
1586 stp_put32_be(pd->w_size * pd->h_size * 3, v);
1587 stp_putc(0, v);
1588 stp_put32_le(pd->w_size * pd->h_size * 3, v);
1589 }
1590
1591 static void upcr10_cx1_printer_end_func(stp_vars_t *v, int overcoat, int code2)
1592 {
1593 dyesub_privdata_t *pd = get_privdata(v);
1594
1595 stp_zfwrite("\xf3\xff\xff\xff"
1596 "\x0f\x00\x00\x00"
1597 "\x1b\xe5\x00\x00\x00\x08\x00\x00"
1598 "\x00\x00\x00\x00\x00\x00\x00", 1, 23, v);
1599 stp_zfwrite("\x12\x00\x00\x00\x1b\xe1\x00\x00"
1600 "\x00\x0b\x00\x00\x80", 1, 13, v);
1601
1602 stp_putc(overcoat, v);
1603 dyesub_nputc(v, 0x00, 2);
1604 stp_putc(code2, v);
1605 stp_putc(0, v);
1606 stp_put16_be(pd->w_size, v);
1607 stp_put16_be(pd->h_size, v);
1608 stp_zfwrite("\xfa\xff\xff\xff"
1609 "\x09\x00\x00\x00"
1610 "\x1b\xee\x00\x00\x00\x02\x00", 1, 15, v);
1611 stp_put16_be(pd->copies, v);
1612 stp_zfwrite("\x07\x00\x00\x00"
1613 "\x1b\x0a\x00\x00\x00\x00\x00", 1, 11, v);
1614 stp_zfwrite("\xf9\xff\xff\xff"
1615 "\xfc\xff\xff\xff"
1616 "\x07\x00\x00\x00"
1617 "\x1b\x17\x00\x00\x00\x00\x00", 1, 19, v);
1618 stp_zfwrite("\xf7\xff\xff\xff", 1, 4, v);
1619 }
1620
1621 static void upcr10_printer_init_func(stp_vars_t *v)
1622 {
1623 upcr10_cx1_printer_init_func(v, 0);
1624 }
1625
1626 static void upcr10_printer_end_func(stp_vars_t *v)
1627 {
1628 upcr10_cx1_printer_end_func(v, 0, 0);
1629 }
1630
1631 /* UP-CX1 */
1632 static const overcoat_t upcx1_overcoat[] =
1633 {
1634 {"Glossy", N_("Glossy"), {1, "\x00"}},
1635 {"Matte", N_("Matte"), {1, "\x0c"}},
1636 };
1637 LIST(overcoat_list_t, upcx1_overcoat_list, overcoat_t, upcx1_overcoat);
1638
1639 static void upcx1_printer_end_func(stp_vars_t *v)
1640 {
1641 dyesub_privdata_t *pd = get_privdata(v);
1642
1643 upcr10_cx1_printer_end_func(v, *(const char*)((pd->overcoat->seq).data), 6);
1644 }
1645 static void upcx1_printer_init_func(stp_vars_t *v)
1646 {
1647 upcr10_cx1_printer_init_func(v, 1);
1648 }
1649
1650 /* Sony UP-D895/897MD */
1651 /* Note: These printers reverse the traditional X and Y axes. 1280 is _always_ the Y axis. */
1652 static const dyesub_pagesize_t sony_d89x_page[] =
1653 {
1654 DEFINE_PAPER_SIMPLE( "w213h284", "960x1280", PT(960,325), PT(1280,325), DYESUB_PORTRAIT),
1655 DEFINE_PAPER_SIMPLE( "w284h284", "1280x1280", PT(1280,325), PT(1280,325), DYESUB_PORTRAIT),
1656 DEFINE_PAPER_SIMPLE( "w426h284", "1920x1280", PT(1920,325), PT(1280,325), DYESUB_PORTRAIT),
1657 DEFINE_PAPER_SIMPLE( "w852h284", "3840x1280", PT(3840,325), PT(1280,325), DYESUB_PORTRAIT),
1658 DEFINE_PAPER_SIMPLE( "w907h284", "4096x1280", PT(4096,325), PT(1280,325), DYESUB_PORTRAIT),
1659 /* A true "custom" size, printer will cut at the image boundary */
1660 DEFINE_PAPER_SIMPLE( "Custom", "Custom", -1, PT(1280,325), DYESUB_PORTRAIT),
1661 };
1662
1663 LIST(dyesub_pagesize_list_t, sony_d89x_page_list, dyesub_pagesize_t, sony_d89x_page);
1664
1665 static const dyesub_printsize_t sony_d89x_printsize[] =
1666 {
1667 { "325x325", "w213h284", 960, 1280},
1668 { "325x325", "w284h284", 1280, 1280},
1669 { "325x325", "w426h284", 1920, 1280},
1670 { "325x325", "w852h284", 3840, 1280},
1671 { "325x325", "w907h284", 4096, 1280},
1672 { "325x325", "Custom", 4096, 1280}, /* Maximum */
1673 };
1674
1675 LIST(dyesub_printsize_list_t, sony_d89x_printsize_list, dyesub_printsize_t, sony_d89x_printsize);
1676
1677 static const dyesub_stringitem_t sony_upd895_gammas[] =
1678 {
1679 { "Soft", N_ ("Soft") },
1680 { "Normal", N_ ("Normal") },
1681 { "Hard", N_ ("Hard") },
1682 };
1683 LIST(dyesub_stringlist_t, sony_upd895_gamma_list, dyesub_stringitem_t, sony_upd895_gammas);
1684
1685 static const stp_parameter_t sony_upd895_parameters[] =
1686 {
1687 {
1688 "SonyGamma", N_("Printer Gamma Correction"), "Color=No,Category=Advanced Printer Setup",
1689 N_("Printer Gamma Correction"),
1690 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
1691 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
1692 },
1693 };
1694 #define sony_upd895_parameter_count (sizeof(sony_upd895_parameters) / sizeof(const stp_parameter_t))
1695
1696 static int
1697 sony_upd895_load_parameters(const stp_vars_t *v, const char *name,
1698 stp_parameter_t *description)
1699 {
1700 unsigned int i;
1701 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
1702 stp_get_model_id(v));
1703
1704 if (caps->parameter_count && caps->parameters)
1705 {
1706 for (i = 0; i < caps->parameter_count; i++)
1707 if (strcmp(name, caps->parameters[i].name) == 0)
1708 {
1709 stp_fill_parameter_settings(description, &(caps->parameters[i]));
1710 break;
1711 }
1712 }
1713
1714 if (strcmp(name, "SonyGamma") == 0)
1715 {
1716 description->bounds.str = stp_string_list_create();
1717
1718 const dyesub_stringlist_t *mlist = &sony_upd895_gamma_list;
1719 for (i = 0; i < mlist->n_items; i++)
1720 {
1721 const dyesub_stringitem_t *m = &(mlist->item[i]);
1722 stp_string_list_add_string(description->bounds.str,
1723 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
1724 }
1725 description->deflt.str = stp_string_list_param(description->bounds.str, 2)->name;
1726 description->is_active = 1;
1727 }
1728 else
1729 {
1730 return 0;
1731 }
1732 return 1;
1733 }
1734
1735 static int sony_upd895_parse_parameters(stp_vars_t *v)
1736 {
1737 dyesub_privdata_t *pd = get_privdata(v);
1738 const char *gamma = stp_get_string_parameter(v, "SonyGamma");
1739
1740 /* No need to set global params if there's no privdata yet */
1741 if (!pd)
1742 return 1;
1743
1744 pd->privdata.sonymd.unk_gg = 0x0; // XXX Likely it is "empty rows"
1745
1746 pd->privdata.sonymd.dark = 0;
1747 pd->privdata.sonymd.light = 0;
1748 pd->privdata.sonymd.advance = 0;
1749 pd->privdata.sonymd.sharp = 0;
1750
1751 if (!strcmp(gamma, "Hard")) {
1752 pd->privdata.sonymd.gamma = 0x03;
1753 } else if (!strcmp(gamma, "Normal")) {
1754 pd->privdata.sonymd.gamma = 0x02;
1755 } else if (!strcmp(gamma, "Soft")) {
1756 pd->privdata.sonymd.gamma = 0x01;
1757 } else {
1758 pd->privdata.sonymd.gamma = 0x00;
1759 }
1760
1761 return 1;
1762 }
1763
1764 static void sony_upd89x_printer_init_func(stp_vars_t *v, int is_897)
1765 {
1766 dyesub_privdata_t *pd = get_privdata(v);
1767
1768 if (is_897)
1769 {
1770 stp_zfwrite("\x8e\xff\xff\xff\xfc\xff\xff\xff"
1771 "\xfb\xff\xff\xff\xf5\xff\xff\xff"
1772 "\xf1\xff\xff\xff\xf0\xff\xff\xff"
1773 "\xef\xff\xff\xff", 1, 28, v);
1774 }
1775 else
1776 {
1777 stp_zfwrite("\x9c\xff\xff\xff"
1778 "\x97\xff\xff\xff", 1, 8, v);
1779 dyesub_nputc(v, 0x0, 12);
1780 stp_put32_be(0xffffffff, v);
1781 }
1782
1783 stp_put32_le(20, v);
1784 stp_zfwrite("\x1b\x15\x00\x00\x00\x0d\x00\x00"
1785 "\x00\x00\x00\x01\x00\x00", 1, 14, v);
1786 stp_put16_be(pd->privdata.sonymd.unk_gg, v);
1787 stp_put16_be(pd->w_size, v);
1788 stp_put16_be(pd->h_size, v);
1789
1790 stp_put32_le(11, v);
1791 stp_zfwrite("\x1b\xea\x00\x00\x00\x00", 1, 6, v);
1792 stp_put32_be(pd->h_size * pd->w_size, v);
1793 stp_putc(0x00, v);
1794 stp_put32_le(pd->h_size * pd->w_size, v);
1795 }
1796
1797 static void sony_upd895_printer_init_func(stp_vars_t *v)
1798 {
1799 sony_upd89x_printer_init_func(v, 0);
1800 }
1801
1802 static void sony_upd897_printer_init_func(stp_vars_t *v)
1803 {
1804 sony_upd89x_printer_init_func(v, 1);
1805 }
1806
1807 static void sony_upd89x_printer_end_func(stp_vars_t *v, int is_897)
1808 {
1809 dyesub_privdata_t *pd = get_privdata(v);
1810
1811 if (is_897)
1812 {
1813 stp_put32_be(0xeaffffff, v);
1814 }
1815 else
1816 {
1817 stp_put32_be(0xffffffff, v);
1818 }
1819
1820 stp_put32_le(9, v);
1821 stp_zfwrite("\x1b\xee\x00\x00\x00\x02\x00", 1, 7, v);
1822 stp_put16_be(pd->copies, v);
1823
1824 if (is_897)
1825 {
1826 stp_put32_be(0xeeffffff, v);
1827 stp_put32_be(1, v);
1828 }
1829
1830 stp_put32_le(15, v);
1831 stp_zfwrite("\x1b\xe5\x00\x00\x00\x08\x00\x00\x00\x00\x00", 1, 11, v);
1832 stp_putc(pd->privdata.sonymd.dark, v);
1833 stp_putc(pd->privdata.sonymd.light, v);
1834 stp_putc(pd->privdata.sonymd.sharp, v);
1835 stp_putc(pd->privdata.sonymd.advance, v);
1836
1837 if (is_897)
1838 {
1839 stp_put32_be(0xebffffff, v);
1840 stp_put32_be(2, v); // Sharpness? 02 and 05 seen
1841 }
1842
1843 stp_put32_le(12, v);
1844 stp_zfwrite("\x1b\xc0\x00\x00\x00\x05\x00\x02", 1, 8, v);
1845 stp_zfwrite("\x00\x00\x01", 1, 3, v);
1846 stp_putc(pd->privdata.sonymd.gamma, v);
1847
1848 if (is_897)
1849 {
1850 stp_put32_be(0xecffffff, v);
1851 stp_put32_be(1, v); // 00 01 02 seen
1852 }
1853
1854 stp_put32_le(17, v);
1855 stp_zfwrite("\x1b\xc0\x00\x01\x00\x0a\x00\x02", 1, 8, v);
1856 stp_zfwrite("\x01\x00\x06", 1, 3, v);
1857 dyesub_nputc(v, 0x0, 6);
1858
1859 if (is_897)
1860 {
1861 stp_put32_be(0xedffffff, v);
1862 stp_put32_be(0, v);
1863 }
1864
1865 stp_put32_le(18, v);
1866 stp_zfwrite("\x1b\xe1\x00\x00\x00\x0b\x00\x00\x08\00", 1, 10, v);
1867 stp_put16_be(0x00, v); // XXX GG GG, based on print size.
1868 dyesub_nputc(v, 0x0, 2);
1869 stp_put16_be(pd->w_size, v);
1870 stp_put16_be(pd->h_size, v);
1871
1872 if (is_897)
1873 {
1874 stp_put32_be(0xfaffffff, v);
1875 }
1876
1877 stp_put32_le(7, v);
1878 stp_zfwrite("\x1b\x0a\x00\x00\x00\x00\x00", 1, 7, v);
1879
1880 if (is_897)
1881 {
1882 stp_zfwrite("\xfc\xff\xff\xff"
1883 "\xfd\xff\xff\xff"
1884 "\xff\xff\xff\xff", 1, 12, v);
1885 stp_put32_le(7, v);
1886 stp_zfwrite("\x1b\x17\x00\x00\x00\x00\x00", 1, 7, v);
1887 stp_put32_be(0xf4ffffff, v);
1888 }
1889 else
1890 {
1891 stp_zfwrite("\xfd\xff\xff\xff"
1892 "\xf7\xff\xff\xff"
1893 "\xf8\xff\xff\xff", 1, 12, v);
1894 }
1895
1896 }
1897
1898 static void sony_upd895_printer_end_func(stp_vars_t *v)
1899 {
1900 sony_upd89x_printer_end_func(v, 0);
1901 }
1902
1903 static void sony_upd897_printer_end_func(stp_vars_t *v)
1904 {
1905 sony_upd89x_printer_end_func(v, 1);
1906 }
1907
1908 static const dyesub_stringitem_t sony_upd897_gammas[] =
1909 {
1910 { "Softest", N_ ("Softest") },
1911 { "Soft", N_ ("Soft") },
1912 { "Normal", N_ ("Normal") },
1913 { "Hard", N_ ("Hard") },
1914 };
1915 LIST(dyesub_stringlist_t, sony_upd897_gamma_list, dyesub_stringitem_t, sony_upd897_gammas);
1916
1917 static const stp_parameter_t sony_upd897_parameters[] =
1918 {
1919 {
1920 "SonyGamma", N_("Printer Gamma Correction"), "Color=No,Category=Advanced Printer Setup",
1921 N_("Printer Gamma Correction"),
1922 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
1923 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
1924 },
1925 {
1926 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
1927 N_("Sharpening to apply to image (0 is off, 14 is max"),
1928 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
1929 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
1930 },
1931 {
1932 "Darkness", N_("Darkness"), "Color=No,Category=Advanced Printer Setup",
1933 N_("Printer Image Darkness Adjustment"),
1934 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
1935 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
1936 },
1937 {
1938 "Lightness", N_("Lightness"), "Color=No,Category=Advanced Printer Setup",
1939 N_("Printer Image Lightness Adjustment"),
1940 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
1941 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
1942 },
1943 {
1944 "Advance", N_("Advance"), "Color=No,Category=Advanced Printer Setup",
1945 N_("Printer Image Advance Adjustment"),
1946 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
1947 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
1948 },
1949
1950 };
1951 #define sony_upd897_parameter_count (sizeof(sony_upd897_parameters) / sizeof(const stp_parameter_t))
1952
1953 static int
1954 sony_upd897_load_parameters(const stp_vars_t *v, const char *name,
1955 stp_parameter_t *description)
1956 {
1957 unsigned int i;
1958 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
1959 stp_get_model_id(v));
1960
1961 if (caps->parameter_count && caps->parameters)
1962 {
1963 for (i = 0; i < caps->parameter_count; i++)
1964 if (strcmp(name, caps->parameters[i].name) == 0)
1965 {
1966 stp_fill_parameter_settings(description, &(caps->parameters[i]));
1967 break;
1968 }
1969 }
1970
1971 if (strcmp(name, "SonyGamma") == 0)
1972 {
1973 description->bounds.str = stp_string_list_create();
1974
1975 const dyesub_stringlist_t *mlist = &sony_upd897_gamma_list;
1976 for (i = 0; i < mlist->n_items; i++)
1977 {
1978 const dyesub_stringitem_t *m = &(mlist->item[i]);
1979 stp_string_list_add_string(description->bounds.str,
1980 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
1981 }
1982 description->deflt.str = stp_string_list_param(description->bounds.str, 3)->name;
1983 description->is_active = 1;
1984 }
1985 else if (strcmp(name, "Darkness") == 0)
1986 {
1987 description->deflt.integer = 0;
1988 description->bounds.integer.lower = -64;
1989 description->bounds.integer.upper = 64;
1990 description->is_active = 1;
1991 }
1992 else if (strcmp(name, "Lightness") == 0)
1993 {
1994 description->deflt.integer = 0;
1995 description->bounds.integer.lower = -64;
1996 description->bounds.integer.upper = 64;
1997 description->is_active = 1;
1998 }
1999 else if (strcmp(name, "Advance") == 0)
2000 {
2001 description->deflt.integer = 0;
2002 description->bounds.integer.lower = -32;
2003 description->bounds.integer.upper = 32;
2004 description->is_active = 1;
2005 }
2006 else if (strcmp(name, "Sharpen") == 0)
2007 {
2008 description->deflt.integer = 2;
2009 description->bounds.integer.lower = 0;
2010 description->bounds.integer.upper = 14;
2011 description->is_active = 1;
2012 }
2013 else
2014 {
2015 return 0;
2016 }
2017 return 1;
2018 }
2019
2020 static int sony_upd897_parse_parameters(stp_vars_t *v)
2021 {
2022 dyesub_privdata_t *pd = get_privdata(v);
2023 const char *gamma = stp_get_string_parameter(v, "SonyGamma");
2024
2025 /* No need to set global params if there's no privdata yet */
2026 if (!pd)
2027 return 1;
2028
2029 pd->privdata.sonymd.unk_gg = 0xa2; // XXX Suspect it's empty rows
2030 pd->privdata.sonymd.dark = stp_get_int_parameter(v, "Darkness");
2031 pd->privdata.sonymd.light = stp_get_int_parameter(v, "Lightness");
2032 pd->privdata.sonymd.advance = stp_get_int_parameter(v, "Advance");
2033 pd->privdata.sonymd.sharp = stp_get_int_parameter(v, "Sharpen");
2034
2035 if (!strcmp(gamma, "Hard")) {
2036 pd->privdata.sonymd.gamma = 0x03;
2037 } else if (!strcmp(gamma, "Normal")) {
2038 pd->privdata.sonymd.gamma = 0x02;
2039 } else if (!strcmp(gamma, "Soft")) {
2040 pd->privdata.sonymd.gamma = 0x01;
2041 } else if (!strcmp(gamma, "Softer")) {
2042 pd->privdata.sonymd.gamma = 0x04;
2043 } else {
2044 pd->privdata.sonymd.gamma = 0x00;
2045 }
2046
2047 return 1;
2048 }
2049
2050 /* Sony UP-D898 family */
2051 static const dyesub_pagesize_t sony_d898_page[] =
2052 {
2053 DEFINE_PAPER_SIMPLE( "w213h284", "960x1280", PT(960,325), PT(1280,325), DYESUB_LANDSCAPE),
2054 DEFINE_PAPER_SIMPLE( "w284h284", "1280x1280", PT(1280,325), PT(1280,325), DYESUB_PORTRAIT),
2055 DEFINE_PAPER_SIMPLE( "w426h284", "1920x1280", PT(1280,325), PT(1920,325), DYESUB_PORTRAIT),
2056 DEFINE_PAPER_SIMPLE( "w852h284", "3840x1280", PT(1280,325), PT(3840,325), DYESUB_PORTRAIT),
2057 DEFINE_PAPER_SIMPLE( "w907h284", "4096x1280", PT(1280,325), PT(4096,325), DYESUB_PORTRAIT),
2058 /* A true "custom" size, printer will cut at the image boundary */
2059 DEFINE_PAPER_SIMPLE( "Custom", "Custom", PT(1280,325), -1, DYESUB_PORTRAIT),
2060 };
2061
2062 LIST(dyesub_pagesize_list_t, sony_d898_page_list, dyesub_pagesize_t, sony_d898_page);
2063
2064 static const dyesub_printsize_t sony_d898_printsize[] =
2065 {
2066 { "325x325", "w213h284", 960, 1280},
2067 { "325x325", "w284h284", 1280, 1280},
2068 { "325x325", "w426h284", 1280, 1920},
2069 { "325x325", "w852h284", 1280, 3840},
2070 { "325x325", "w907h284", 1280, 4096},
2071 { "325x325", "Custom", 1280, 4096}, /* Maximum */
2072 };
2073
2074 LIST(dyesub_printsize_list_t, sony_d898_printsize_list, dyesub_printsize_t, sony_d898_printsize);
2075
2076 static const stp_parameter_t sony_upd898_parameters[] =
2077 {
2078 {
2079 "SonyGamma", N_("Printer Gamma Correction"), "Color=No,Category=Advanced Printer Setup",
2080 N_("Printer Gamma Correction"),
2081 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
2082 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
2083 },
2084 {
2085 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
2086 N_("Sharpening to apply to image (0 is off, 14 is max"),
2087 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
2088 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
2089 },
2090 {
2091 "Tone", N_("Tone Curve"), "Color=No,Category=Advanced Printer Setup",
2092 N_("Tone curve adjustment to apply to image (-32..+32, 0 is off)"),
2093 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
2094 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
2095 },
2096 };
2097 #define sony_upd898_parameter_count (sizeof(sony_upd898_parameters) / sizeof(const stp_parameter_t))
2098
2099 static int
2100 sony_upd898_load_parameters(const stp_vars_t *v, const char *name,
2101 stp_parameter_t *description)
2102 {
2103 unsigned int i;
2104 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
2105 stp_get_model_id(v));
2106
2107 if (caps->parameter_count && caps->parameters)
2108 {
2109 for (i = 0; i < caps->parameter_count; i++)
2110 if (strcmp(name, caps->parameters[i].name) == 0)
2111 {
2112 stp_fill_parameter_settings(description, &(caps->parameters[i]));
2113 break;
2114 }
2115 }
2116
2117 if (strcmp(name, "SonyGamma") == 0)
2118 {
2119 description->bounds.str = stp_string_list_create();
2120
2121 const dyesub_stringlist_t *mlist = &sony_upd895_gamma_list;
2122 for (i = 0; i < mlist->n_items; i++)
2123 {
2124 const dyesub_stringitem_t *m = &(mlist->item[i]);
2125 stp_string_list_add_string(description->bounds.str,
2126 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
2127 }
2128 description->deflt.str = stp_string_list_param(description->bounds.str, 2)->name;
2129 description->is_active = 1;
2130 }
2131 else if (strcmp(name, "Sharpen") == 0)
2132 {
2133 description->deflt.integer = 2;
2134 description->bounds.integer.lower = 0;
2135 description->bounds.integer.upper = 14;
2136 description->is_active = 1;
2137 }
2138 else if (strcmp(name, "Tone") == 0)
2139 {
2140 description->deflt.integer = 0;
2141 description->bounds.integer.lower = -32;
2142 description->bounds.integer.upper = 32;
2143 description->is_active = 1;
2144 }
2145 else
2146 {
2147 return 0;
2148 }
2149 return 1;
2150 }
2151
2152 static int sony_upd898_parse_parameters(stp_vars_t *v)
2153 {
2154 dyesub_privdata_t *pd = get_privdata(v);
2155 const char *gamma = stp_get_string_parameter(v, "SonyGamma");
2156
2157 /* No need to set global params if there's no privdata yet */
2158 if (!pd)
2159 return 1;
2160
2161 pd->privdata.sonymd.sharp = stp_get_int_parameter(v, "Sharpen");
2162 pd->privdata.sonymd.tone = stp_get_int_parameter(v, "Tone");
2163
2164 if (!strcmp(gamma, "Hard")) {
2165 pd->privdata.sonymd.gamma = 0x03;
2166 } else if (!strcmp(gamma, "Normal")) {
2167 pd->privdata.sonymd.gamma = 0x02;
2168 } else if (!strcmp(gamma, "Soft")) {
2169 pd->privdata.sonymd.gamma = 0x01;
2170 } else {
2171 pd->privdata.sonymd.gamma = 0x00;
2172 }
2173
2174 return 1;
2175 }
2176
2177 static void sony_updneo_mono_init_func(stp_vars_t *v, unsigned short magic1, unsigned short magic2)
2178 {
2179 char hdrbuf[256];
2180 char buf[256];
2181
2182 dyesub_privdata_t *pd = get_privdata(v);
2183
2184 int hdrlen;
2185
2186 /* Generate PJL header */
2187 memset(buf, 0, sizeof(buf));
2188 hdrlen = snprintf(buf, sizeof(buf),
2189 "\x1b%%-12345X\r\n"
2190 "@PJL JOB NAME=\"Gutenprint\" \r\n"
2191 "@PJL ENTER LANGUAGE=SONY-PDL-DS2\r\n");
2192 buf[255] = 0;
2193
2194 /* Generate block header */
2195 memset(hdrbuf, 0, sizeof(hdrbuf));
2196 snprintf(hdrbuf, sizeof(hdrbuf), "JOBSIZE=PJL-H,%d,%s,6,0,0,0",
2197 hdrlen, pd->pagesize);
2198
2199 /* Write block header */
2200 stp_zfwrite(hdrbuf, 1, sizeof(hdrbuf), v);
2201 /* Write PJL header */
2202 stp_zfwrite(buf, 1, hdrlen, v);
2203
2204 /* Generate payload header */
2205 hdrlen = pd->w_size * pd->h_size + 274 + 23;
2206 memset(hdrbuf, 0, sizeof(hdrbuf));
2207 snprintf(hdrbuf, sizeof(hdrbuf), "JOBSIZE=PDL,%d",
2208 hdrlen);
2209 /* Write block header */
2210 stp_zfwrite(hdrbuf, 1, sizeof(hdrbuf), v);
2211
2212 /* Write 290 bytes of payload header */
2213 stp_putc(0x00, v);
2214 stp_putc(0x00, v);
2215 stp_putc(0x01, v);
2216 stp_putc(0x00, v);
2217 stp_putc(0x00, v);
2218 stp_putc(0x10, v);
2219 stp_putc(0x0f, v);
2220 stp_putc(0x00, v);
2221 stp_putc(0x1c, v);
2222 dyesub_nputc(v, 0, 11);
2223 stp_putc(pd->privdata.sonymd.sharp, v);
2224 stp_put16_be(pd->privdata.sonymd.tone, v);
2225 stp_putc(pd->privdata.sonymd.gamma, v);
2226 stp_putc(0x02, v);
2227 stp_putc(0x00, v);
2228 stp_putc(0x09, v);
2229 stp_putc(0x00, v);
2230 stp_putc(pd->copies, v);
2231 stp_putc(0x01, v);
2232 stp_putc(0x00, v);
2233 stp_putc(0x11, v);
2234
2235 stp_putc(0x01, v);
2236 stp_putc(0x08, v);
2237 stp_putc(0x00, v);
2238 stp_putc(0x1a, v);
2239 dyesub_nputc(v, 0, 4);
2240 stp_put16_be(pd->w_size, v); // fixed
2241 stp_put16_be(pd->h_size, v);
2242 stp_putc(0x09, v);
2243 stp_putc(0x00, v);
2244 stp_putc(0x28, v);
2245 stp_putc(0x01, v);
2246
2247 stp_put16_be(magic1, v);
2248 stp_putc(0x00, v);
2249 stp_putc(0x00, v);
2250 stp_put16_be(magic2, v);
2251 stp_put16_be(pd->h_size, v); // ie "rows"
2252 stp_putc(0x00, v);
2253 stp_putc(0x00, v);
2254 stp_putc(0x13, v);
2255 stp_putc(0x01, v);
2256 stp_putc(0x00, v);
2257 stp_putc(0x04, v);
2258 stp_putc(0x00, v);
2259 stp_putc(0x80, v);
2260
2261 stp_putc(0x00, v);
2262 stp_putc(0x23, v);
2263 stp_putc(0x00, v);
2264 stp_putc(0x0c, v);
2265 stp_putc(0x01, v);
2266 stp_putc(0x09, v);
2267 stp_put16_be(pd->w_size, v); // fixed
2268 stp_put16_be(pd->h_size, v);
2269 dyesub_nputc(v, 0, 4);
2270 stp_putc(0x08, v);
2271 stp_putc(0xff, v);
2272
2273 stp_putc(0x08, v);
2274 stp_putc(0x00, v);
2275 stp_putc(0x19, v);
2276 dyesub_nputc(v, 0, 4);
2277 stp_put16_be(pd->w_size, v); // fixed
2278 stp_put16_be(pd->h_size, v);
2279 stp_putc(0x00, v);
2280 stp_putc(0x00, v);
2281 stp_putc(0x81, v);
2282 stp_putc(0x80, v);
2283 stp_putc(0x00, v);
2284
2285 stp_putc(0x8f, v);
2286 stp_putc(0x00, v);
2287 stp_putc(0xb8, v);
2288 dyesub_nputc(v, 0, 0xb8);
2289 stp_putc(0xc0, v);
2290 stp_putc(0x00, v);
2291 stp_putc(0x82, v);
2292 stp_put32_be(pd->w_size * pd->h_size, v);
2293 }
2294
2295 static void sony_upd898_printer_init_func(stp_vars_t *v)
2296 {
2297 sony_updneo_mono_init_func(v, 0x00d4, 0x0358);
2298 }
2299
2300 static void sony_updneo_printer_end_func(stp_vars_t *v)
2301 {
2302 /* write post-payload trailing stuff. */
2303 stp_putc(0x00, v);
2304 stp_putc(0x00, v);
2305 stp_putc(0x14, v);
2306 stp_putc(0x01, v);
2307 stp_putc(0x00, v);
2308 stp_putc(0x12, v);
2309 stp_putc(0x00, v);
2310
2311 /* Write block header */
2312 stp_zfwrite("JOBSIZE=PJL-T,302", 1, 17, v);
2313 dyesub_nputc(v, 0, 256-17);
2314
2315 /* Write block */
2316 stp_putc(0x80, v);
2317 stp_putc(0x00, v);
2318 stp_putc(0x8f, v);
2319 stp_putc(0x01, v);
2320 stp_putc(0x11, v);
2321 dyesub_nputc(v, 0, 275);
2322
2323 /* And finally, the PJL footer */
2324 stp_zfwrite("@PJL EOJ\r\n\x1b%%-12345X\r\n", 1, 22, v);
2325 }
2326
2327 /* Sony UP-971AD */
2328 static const dyesub_pagesize_t sony_up971_page[] =
2329 {
2330 DEFINE_PAPER_SIMPLE( "w426h576", "1920x2560", PT(1920,325), PT(2560,325), DYESUB_LANDSCAPE),
2331 DEFINE_PAPER_SIMPLE( "w576h576", "2560x2560", PT(2560,325), PT(2560,325), DYESUB_PORTRAIT),
2332 DEFINE_PAPER_SIMPLE( "w756h576", "3414x2560", PT(2560,325), PT(3414,325), DYESUB_PORTRAIT),
2333 DEFINE_PAPER_SIMPLE( "w1701h576", "7680x2560", PT(2560,325), PT(7680,325), DYESUB_PORTRAIT),
2334 /* A true "custom" size, printer will cut at the image boundary */
2335 DEFINE_PAPER_SIMPLE( "Custom", "Custom", PT(2560,325), -1, DYESUB_PORTRAIT),
2336 };
2337
2338 LIST(dyesub_pagesize_list_t, sony_up971_page_list, dyesub_pagesize_t, sony_up971_page);
2339
2340 static const dyesub_printsize_t sony_up971_printsize[] =
2341 {
2342 { "325x325", "w426h576", 1920, 2560},
2343 { "325x325", "w576h576", 2560, 2560},
2344 { "325x325", "w756h576", 2560, 3414},
2345 { "325x325", "w1701h576", 2560, 7680},
2346 { "325x325", "Custom", 2560, 7680}, /* Maximum */
2347 };
2348
2349 LIST(dyesub_printsize_list_t, sony_up971_printsize_list, dyesub_printsize_t, sony_up971_printsize);
2350
2351 static void sony_up971_printer_init_func(stp_vars_t *v)
2352 {
2353 sony_updneo_mono_init_func(v, 0x0126, 0x07b3);
2354 }
2355
2356 /* Sony UP-D711MD */
2357 static const dyesub_pagesize_t sony_d711_page[] =
2358 {
2359 DEFINE_PAPER_SIMPLE( "w215h143", "596x896", PT(596,300), PT(896,300), DYESUB_LANDSCAPE),
2360 DEFINE_PAPER_SIMPLE( "w215h161", "672x896", PT(672,300), PT(896,300), DYESUB_LANDSCAPE),
2361 DEFINE_PAPER_SIMPLE( "w215h215", "896x896", PT(896,300), PT(896,300), DYESUB_PORTRAIT),
2362 DEFINE_PAPER_SIMPLE( "w215h287", "1196x896", PT(896,300), PT(1196,300), DYESUB_PORTRAIT),
2363 DEFINE_PAPER_SIMPLE( "w215h645", "2688x896", PT(896,300), PT(2688,300), DYESUB_PORTRAIT),
2364 /* A true "custom" size, printer will cut at the image boundary */
2365 DEFINE_PAPER_SIMPLE( "Custom", "Custom", PT(896,300), -1, DYESUB_PORTRAIT),
2366 };
2367
2368 LIST(dyesub_pagesize_list_t, sony_d711_page_list, dyesub_pagesize_t, sony_d711_page);
2369
2370 static const dyesub_printsize_t sony_d711_printsize[] =
2371 {
2372 { "300x300", "w215h143", 596, 896},
2373 { "300x300", "w215h161", 672, 896},
2374 { "300x300", "w215h215", 896, 896},
2375 { "300x300", "w215h287", 896, 1196},
2376 { "300x300", "w215h645", 896, 2688},
2377 { "300x300", "Custom", 896, 2688}, /* Maximum */
2378 };
2379
2380 LIST(dyesub_printsize_list_t, sony_d711_printsize_list, dyesub_printsize_t, sony_d711_printsize);
2381
2382
2383 static void sony_upd711_printer_init_func(stp_vars_t *v)
2384 {
2385 dyesub_privdata_t *pd = get_privdata(v);
2386
2387 stp_zfwrite("\x83\xff\xff\xff\xfc\xff\xff\xff"
2388 "\xfb\xff\xff\xff\xf5\xff\xff\xff", 1, 16, v);
2389
2390 stp_put32_le(20, v);
2391 stp_zfwrite("\x1b\x15\x00\x00\x00\x0d\x00"
2392 "\x00\x00\x00\x00\x01\x01\x43", 1, 14, v);
2393 stp_put16_be(0, v);
2394 stp_put16_be(pd->w_size, v);
2395 stp_put16_be(pd->h_size, v);
2396
2397 stp_put32_le(11, v);
2398 stp_zfwrite("\x1b\xea\x00\x00\x00\x00", 1, 6, v);
2399 stp_put32_be(pd->h_size * pd->w_size, v);
2400 stp_putc(0x00, v);
2401 stp_put32_le(pd->h_size * pd->w_size, v);
2402 }
2403
2404 static void sony_upd711_printer_end_func(stp_vars_t *v)
2405 {
2406 dyesub_privdata_t *pd = get_privdata(v);
2407
2408 stp_put32_be(0xeaffffff, v);
2409
2410 stp_put32_le(9, v);
2411 stp_zfwrite("\x1b\xee\x00\x00\x00\x02\x00", 1, 7, v);
2412 stp_put16_be(pd->copies, v);
2413
2414 stp_put32_be(0xeeffffff, v);
2415 stp_put32_be(1, v);
2416
2417 stp_put32_le(15, v);
2418 stp_zfwrite("\x1b\xe5\x00\x00\x00\x08\x00\x00\x00\x00\x00", 1, 11, v);
2419 stp_putc(pd->privdata.sonymd.dark, v);
2420 stp_putc(pd->privdata.sonymd.light, v);
2421 stp_putc(pd->privdata.sonymd.sharp, v);
2422 stp_putc(pd->privdata.sonymd.advance, v);
2423
2424 stp_put32_be(0xecffffff, v);
2425 stp_put32_be(0, v);
2426
2427 stp_put32_le(12, v);
2428 stp_zfwrite("\x1b\xc0\x00\x00\x00\x05\x00\x02", 1, 8, v);
2429 stp_zfwrite("\x00\x00\x01", 1, 3, v);
2430 stp_putc(pd->privdata.sonymd.gamma, v);
2431
2432 stp_put32_be(0xecffffff, v);
2433 stp_put32_be(pd->privdata.sonymd.printinfo, v);
2434
2435 stp_put32_le(17, v);
2436 stp_zfwrite("\x1b\xc0\x00\x01\x00\x0a\x00\x02", 1, 8, v);
2437 stp_zfwrite("\x01\x00\x06", 1, 3, v);
2438 dyesub_nputc(v, 0x0, 6);
2439
2440 stp_put32_be(0xedffffff, v);
2441 stp_put32_be(0, v);
2442
2443 stp_put32_le(12, v);
2444 stp_zfwrite("\x1b\xc0\x00\x01\x00\x05\x00\x02", 1, 8, v);
2445 stp_zfwrite("\x0a\x00\x01", 1, 3, v);
2446 stp_putc(pd->privdata.sonymd.papertype, v);
2447
2448 stp_put32_le(12, v);
2449 stp_zfwrite("\x1b\xc0\x00\x01\x00\x05\x00\x02", 1, 8, v);
2450 stp_zfwrite("\x0c\x00\x01", 1, 3, v);
2451 stp_putc(pd->privdata.sonymd.longfeed, v);
2452
2453 stp_put32_le(12, v);
2454 stp_zfwrite("\x1b\xc0\x00\x01\x00\x05\x00\x02", 1, 8, v);
2455 stp_zfwrite("\x0b\x00\x01", 1, 3, v);
2456 stp_putc(pd->privdata.sonymd.printinfo, v);
2457
2458 stp_put32_le(18, v);
2459 stp_zfwrite("\x1b\xe1\x00\x00\x00\x0b\x00\x00\x08\00", 1, 10, v);
2460 stp_put16_be(0x00, v); // XXX GG GG, based on print size? Blank lines?
2461 dyesub_nputc(v, 0x0, 2);
2462 stp_put16_be(pd->w_size, v);
2463 stp_put16_be(pd->h_size, v);
2464
2465 stp_put32_be(0xfaffffff, v);
2466
2467 stp_put32_le(7, v);
2468 stp_zfwrite("\x1b\x0a\x00\x00\x00\x00\x00", 1, 7, v);
2469
2470 stp_zfwrite("\xfc\xff\xff\xff"
2471 "\xfd\xff\xff\xff"
2472 "\xff\xff\xff\xff", 1, 12, v);
2473 stp_put32_le(7, v);
2474 stp_zfwrite("\x1b\x17\x00\x00\x00\x00\x00", 1, 7, v);
2475 stp_put32_be(0xf4ffffff, v);
2476 }
2477
2478 static const dyesub_stringitem_t sony_upd711_medias[] =
2479 {
2480 { "S", N_ ("Standard") },
2481 { "HG", N_ ("High Grade") },
2482 };
2483 LIST(dyesub_stringlist_t, sony_upd711_media_list, dyesub_stringitem_t, sony_upd711_medias);
2484
2485 static const stp_parameter_t sony_upd711_parameters[] =
2486 {
2487 {
2488 "SonyGamma", N_("Printer Gamma Correction"), "Color=No,Category=Advanced Printer Setup",
2489 N_("Printer Gamma Correction"),
2490 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
2491 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
2492 },
2493 {
2494 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
2495 N_("Sharpening to apply to image (0 is off, 14 is max"),
2496 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
2497 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
2498 },
2499 {
2500 "Darkness", N_("Darkness"), "Color=No,Category=Advanced Printer Setup",
2501 N_("Printer Image Darkness Adjustment"),
2502 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
2503 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
2504 },
2505 {
2506 "Lightness", N_("Lightness"), "Color=No,Category=Advanced Printer Setup",
2507 N_("Printer Image Lightness Adjustment"),
2508 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
2509 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
2510 },
2511 {
2512 "Advance", N_("Advance"), "Color=No,Category=Advanced Printer Setup",
2513 N_("Printer Image Advance Adjustment"),
2514 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
2515 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
2516 },
2517 {
2518 "LongFeedAfter", N_("LongFeedAfter"), "Color=No,Category=Advanced Printer Setup",
2519 N_("Long Feed After N Pages"),
2520 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
2521 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
2522 },
2523 {
2524 "PrintInfo", N_("Print Info"), "Color=No,Category=Advanced Printer Setup",
2525 N_("Print Information"),
2526 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
2527 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
2528 },
2529 {
2530 "SonyMediaType", N_("Roll Type"), "Color=No,Category=Advanced Printer Setup",
2531 N_("Roll Type"),
2532 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
2533 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
2534 },
2535 };
2536 #define sony_upd711_parameter_count (sizeof(sony_upd711_parameters) / sizeof(const stp_parameter_t))
2537
2538 static int
2539 sony_upd711_load_parameters(const stp_vars_t *v, const char *name,
2540 stp_parameter_t *description)
2541 {
2542 unsigned int i;
2543 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
2544 stp_get_model_id(v));
2545
2546 if (caps->parameter_count && caps->parameters)
2547 {
2548 for (i = 0; i < caps->parameter_count; i++)
2549 if (strcmp(name, caps->parameters[i].name) == 0)
2550 {
2551 stp_fill_parameter_settings(description, &(caps->parameters[i]));
2552 break;
2553 }
2554 }
2555
2556 if (strcmp(name, "SonyGamma") == 0)
2557 {
2558 description->bounds.str = stp_string_list_create();
2559
2560 const dyesub_stringlist_t *mlist = &sony_upd897_gamma_list;
2561 for (i = 0; i < mlist->n_items; i++)
2562 {
2563 const dyesub_stringitem_t *m = &(mlist->item[i]);
2564 stp_string_list_add_string(description->bounds.str,
2565 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
2566 }
2567 description->deflt.str = stp_string_list_param(description->bounds.str, 3)->name;
2568 description->is_active = 1;
2569 }
2570 else if (strcmp(name, "Darkness") == 0)
2571 {
2572 description->deflt.integer = 0;
2573 description->bounds.integer.lower = -64;
2574 description->bounds.integer.upper = 64;
2575 description->is_active = 1;
2576 }
2577 else if (strcmp(name, "Lightness") == 0)
2578 {
2579 description->deflt.integer = 0;
2580 description->bounds.integer.lower = -64;
2581 description->bounds.integer.upper = 64;
2582 description->is_active = 1;
2583 }
2584 else if (strcmp(name, "Advance") == 0)
2585 {
2586 description->deflt.integer = 0;
2587 description->bounds.integer.lower = -32;
2588 description->bounds.integer.upper = 32;
2589 description->is_active = 1;
2590 }
2591 else if (strcmp(name, "Sharpen") == 0)
2592 {
2593 description->deflt.integer = 2;
2594 description->bounds.integer.lower = 0;
2595 description->bounds.integer.upper = 14;
2596 description->is_active = 1;
2597 }
2598 else if (strcmp(name, "LongFeedAfter") == 0)
2599 {
2600 description->deflt.integer = 1;
2601 description->bounds.integer.lower = 0;
2602 description->bounds.integer.upper = 255;
2603 description->is_active = 1;
2604 }
2605 else if (strcmp(name, "PrintInfo") == 0)
2606 {
2607 description->is_active = 1;
2608 description->deflt.boolean = 0;
2609 }
2610 else if (strcmp(name, "SonyMediaType") == 0)
2611 {
2612 description->bounds.str = stp_string_list_create();
2613
2614 const dyesub_stringlist_t *mlist = &sony_upd711_media_list;
2615 for (i = 0; i < mlist->n_items; i++)
2616 {
2617 const dyesub_stringitem_t *m = &(mlist->item[i]);
2618 stp_string_list_add_string(description->bounds.str,
2619 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
2620 }
2621 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
2622 description->is_active = 1;
2623 }
2624 else
2625 {
2626 return 0;
2627 }
2628 return 1;
2629 }
2630
2631 static int sony_upd711_parse_parameters(stp_vars_t *v)
2632 {
2633 dyesub_privdata_t *pd = get_privdata(v);
2634 const char *gamma = stp_get_string_parameter(v, "SonyGamma");
2635 const char *media = stp_get_string_parameter(v, "SonyMediaType");
2636
2637 /* No need to set global params if there's no privdata yet */
2638 if (!pd)
2639 return 1;
2640
2641 pd->privdata.sonymd.dark = stp_get_int_parameter(v, "Darkness");
2642 pd->privdata.sonymd.light = stp_get_int_parameter(v, "Lightness");
2643 pd->privdata.sonymd.advance = stp_get_int_parameter(v, "Advance");
2644 pd->privdata.sonymd.sharp = stp_get_int_parameter(v, "Sharpen");
2645 pd->privdata.sonymd.longfeed = stp_get_int_parameter(v, "LongFeedAfter");
2646 pd->privdata.sonymd.printinfo = stp_get_boolean_parameter(v, "PrintInfo");
2647
2648 if (!strcmp(gamma, "Hard")) {
2649 pd->privdata.sonymd.gamma = 0x03;
2650 } else if (!strcmp(gamma, "Normal")) {
2651 pd->privdata.sonymd.gamma = 0x02;
2652 } else if (!strcmp(gamma, "Soft")) {
2653 pd->privdata.sonymd.gamma = 0x01;
2654 } else if (!strcmp(gamma, "Softer")) {
2655 pd->privdata.sonymd.gamma = 0x04;
2656 } else {
2657 pd->privdata.sonymd.gamma = 0x00;
2658 }
2659
2660 if (!strcmp(media, "HG")) {
2661 pd->privdata.sonymd.papertype = 1;
2662 } else {
2663 pd->privdata.sonymd.papertype = 0;
2664 }
2665
2666 return 1;
2667 }
2668
2669 /* Sony UP-CR20 family */
2670 static const dyesub_pagesize_t upcr20_page[] =
2671 {
2672 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1382,334), PT(2048,334), DYESUB_LANDSCAPE),
2673 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1210,334), PT(1728,334), DYESUB_LANDSCAPE),
2674 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1728,334), PT(2380,334), DYESUB_PORTRAIT),
2675 DEFINE_PAPER_SIMPLE( "w360h504-div2", "3.5x5*2", PT(1728,334), PT(2420,334), DYESUB_PORTRAIT),
2676 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(2048,334), PT(2724,334), DYESUB_PORTRAIT),
2677 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(2048,334), PT(2764,334), DYESUB_PORTRAIT),
2678 };
2679
2680 LIST(dyesub_pagesize_list_t, upcr20_page_list, dyesub_pagesize_t, upcr20_page);
2681
2682 static const dyesub_printsize_t upcr20_printsize[] =
2683 {
2684 { "334x334", "w288h432", 1382, 2048},
2685 { "334x334", "B7", 1210, 1728},
2686 { "334x334", "w360h504", 1728, 2380},
2687 { "334x334", "w360h504-div2", 1728, 2420},
2688 { "334x334", "w432h576", 2048, 2724},
2689 { "334x334", "w432h576-div2", 2048, 2764},
2690 };
2691
2692 LIST(dyesub_printsize_list_t, upcr20_printsize_list, dyesub_printsize_t, upcr20_printsize);
2693
2694 static const overcoat_t upcr20_overcoat[] =
2695 {
2696 {"Glossy", N_("Glossy"), {1, "\x01"}},
2697 {"Matte", N_("Matte"), {1, "\x03"}},
2698 };
2699
2700 LIST(overcoat_list_t, upcr20_overcoat_list, overcoat_t, upcr20_overcoat);
2701
2702 static void sony_upcr20_printer_init_func(stp_vars_t *v)
2703 {
2704 char hdrbuf[256];
2705 char buf[256];
2706
2707 dyesub_privdata_t *pd = get_privdata(v);
2708
2709 int hdrlen;
2710
2711 /* Generate PJL header */
2712 memset(buf, 0, sizeof(buf));
2713 hdrlen = snprintf(buf, sizeof(buf),
2714 "\x1b%%-12345X\r\n"
2715 "@PJL JOB NAME=\"Gutenprint\" \r\n"
2716 "@PJL ENTER LANGUAGE=SONY-PDL-DS2\r\n");
2717 buf[255] = 0;
2718
2719 /* Generate block header */
2720 memset(hdrbuf, 0, sizeof(hdrbuf));
2721 snprintf(hdrbuf, sizeof(hdrbuf), "JOBSIZE=PJL-H,%d,%s,64,0,0,0",
2722 hdrlen, pd->pagesize);
2723
2724 /* Write block header */
2725 stp_zfwrite(hdrbuf, 1, sizeof(hdrbuf), v);
2726 /* Write PJL header */
2727 stp_zfwrite(buf, 1, hdrlen, v);
2728
2729 /* Generate payload header */
2730 hdrlen = pd->w_size * pd->h_size * 3 + 274 + 23;
2731 memset(hdrbuf, 0, sizeof(hdrbuf));
2732 snprintf(hdrbuf, sizeof(hdrbuf), "JOBSIZE=PDL,%d",
2733 hdrlen);
2734 /* Write block header */
2735 stp_zfwrite(hdrbuf, 1, sizeof(hdrbuf), v);
2736
2737 char pg = 0;
2738 if (strcmp(pd->pagesize,"B7") == 0)
2739 pg = 0x40;
2740 else if (strcmp(pd->pagesize,"w288h432") == 0)
2741 pg = 0x48;
2742 else if (strcmp(pd->pagesize,"w360h504") == 0)
2743 pg = 0x41;
2744 else if (strcmp(pd->pagesize,"w360h504-div2") == 0)
2745 pg = 0x41;
2746 else if (strcmp(pd->pagesize,"w432h576") == 0)
2747 pg = 0x49;
2748 else if (strcmp(pd->pagesize,"w432h576-div2") == 0)
2749 pg = 0x49;
2750
2751 /* Write 290 bytes of payload header */
2752 stp_putc(0x00, v);
2753 stp_putc(0x00, v);
2754 stp_putc(0x01, v);
2755 stp_putc(0x00, v);
2756 stp_putc(0x00, v);
2757 stp_putc(0x10, v);
2758 stp_putc(0x0f, v);
2759 stp_putc(0x00, v);
2760 stp_putc(0x1c, v);
2761 dyesub_nputc(v, 0, 7);
2762
2763 dyesub_nputc(v, 0, 4);
2764 stp_putc(0x01, v);
2765 stp_putc(0x00, v);
2766 stp_putc(0x00, v);
2767 stp_putc(0x00, v);
2768 stp_putc(0x02, v);
2769 stp_putc(0x00, v);
2770 stp_putc(0x16, v);
2771 stp_putc(0x00, v);
2772 stp_putc(0x00, v);
2773 stp_putc(0x02, v);
2774 stp_putc(0x00, v);
2775 stp_putc(0x09, v);
2776
2777 stp_putc(0x00, v);
2778 stp_putc(pd->copies, v);
2779 stp_putc(0x02, v);
2780 stp_putc(0x00, v);
2781 stp_putc(0x06, v);
2782 stp_putc(0x01, v);
2783 stp_zfwrite((pd->overcoat->seq).data, 1,
2784 (pd->overcoat->seq).bytes, v); /*overcoat pattern, 1 byte */
2785 stp_putc(0x03, v);
2786 stp_putc(0x00, v);
2787 stp_putc(0x1d, v);
2788 stp_putc(0x00, v);
2789 stp_putc(0x00, v);
2790 stp_putc(0x00, v);
2791 if (strcmp(pd->pagesize,"w360h504-div2") == 0 ||
2792 strcmp(pd->pagesize,"w432h576-div2") == 0) {
2793 stp_putc(0x03, v);
2794 stp_putc(0x00, v);
2795 stp_putc(0x1e, v);
2796 stp_putc(0x00, v);
2797 stp_putc(0x01, v);
2798 stp_putc(0x02, v);
2799 }
2800 stp_putc(0x01, v);
2801 stp_putc(0x00, v);
2802 stp_putc(0x20, v);
2803
2804 stp_putc(0x01, v);
2805 stp_putc(0x01, v);
2806 stp_putc(0x00, v);
2807 stp_putc(0x27, v);
2808 stp_putc(pg, v);
2809 stp_putc(0x01, v);
2810 stp_putc(0x00, v);
2811 stp_putc(0x11, v);
2812 stp_putc(0x01, v);
2813 stp_putc(0x08, v);
2814 stp_putc(0x00, v);
2815 stp_putc(0x1a, v);
2816 dyesub_nputc(v, 0, 4);
2817
2818 stp_put16_be(pd->w_size, v);
2819 stp_put16_be(pd->h_size, v);
2820 stp_putc(0x00, v);
2821 stp_putc(0x00, v);
2822 stp_putc(0x13, v);
2823 stp_putc(0x01, v);
2824 stp_putc(0x00, v);
2825 stp_putc(0x04, v);
2826 stp_putc(0x00, v);
2827 stp_putc(0x80, v);
2828 stp_putc(0x00, v);
2829 stp_putc(0x23, v);
2830 stp_putc(0x00, v);
2831 stp_putc(0x10, v);
2832
2833 stp_putc(0x03, v);
2834 stp_putc(0x00, v);
2835 stp_put16_be(pd->w_size, v);
2836 stp_put16_be(pd->h_size, v);
2837 dyesub_nputc(v, 0, 4);
2838 stp_putc(0x08, v);
2839 stp_putc(0x08, v);
2840 stp_putc(0x08, v);
2841 stp_putc(0xff, v);
2842 stp_putc(0xff, v);
2843 stp_putc(0xff, v);
2844
2845 stp_putc(0x01, v);
2846 stp_putc(0x00, v);
2847 stp_putc(0x17, v);
2848 stp_putc(0x00, v);
2849 stp_putc(0x08, v);
2850 stp_putc(0x00, v);
2851 stp_putc(0x19, v);
2852 dyesub_nputc(v, 0, 4);
2853 stp_put16_be(pd->w_size, v);
2854 stp_put16_be(pd->h_size, v);
2855 stp_putc(0x00, v);
2856
2857 stp_putc(0x00, v);
2858 stp_putc(0x81, v);
2859 stp_putc(0x80, v);
2860 stp_putc(0x00, v);
2861 stp_putc(0x8f, v);
2862 stp_putc(0x00, v);
2863 if (strcmp(pd->pagesize,"w360h504-div2") == 0 ||
2864 strcmp(pd->pagesize,"w432h576-div2") == 0) {
2865 stp_putc(0x9e, v);
2866 dyesub_nputc(v, 0, 0x9e);
2867 } else {
2868 stp_putc(0xa4, v);
2869 dyesub_nputc(v, 0, 0xa4);
2870 }
2871 stp_putc(0xc0, v);
2872 stp_putc(0x00, v);
2873 stp_putc(0x82, v);
2874 stp_put32_be(pd->w_size* pd->h_size * 3, v);
2875 }
2876
2877 /* Sony UP-DR80 family */
2878 static const dyesub_pagesize_t updr80md_page[] =
2879 {
2880 DEFINE_PAPER_SIMPLE( "A4", "A4", PT(2392,301), PT(3400,301), DYESUB_PORTRAIT), /* Letter */
2881 DEFINE_PAPER_SIMPLE( "Letter", "Letter", PT(2464,301), PT(3192,301), DYESUB_PORTRAIT), /* A4 */
2882 };
2883
2884 LIST(dyesub_pagesize_list_t, updr80md_page_list, dyesub_pagesize_t, updr80md_page);
2885
2886 static const dyesub_printsize_t updr80md_printsize[] =
2887 {
2888 { "301x301", "A4", 2392, 3400},
2889 { "301x301", "Letter", 2464, 3192},
2890 };
2891
2892 LIST(dyesub_printsize_list_t, updr80md_printsize_list, dyesub_printsize_t, updr80md_printsize);
2893
2894 static void sony_updr80md_printer_init_func(stp_vars_t *v)
2895 {
2896 char hdrbuf[256];
2897 char buf[256];
2898
2899 dyesub_privdata_t *pd = get_privdata(v);
2900
2901 int hdrlen;
2902
2903 /* Generate PJL header */
2904 memset(buf, 0, sizeof(buf));
2905 hdrlen = snprintf(buf, sizeof(buf),
2906 "\x1b%%-12345X\r\n"
2907 "@PJL JOB NAME=\"Gutenprint\" \r\n"
2908 "@PJL ENTER LANGUAGE=SONY-PDL-DS2\r\n");
2909 buf[255] = 0;
2910
2911 /* Generate block header */
2912 memset(hdrbuf, 0, sizeof(hdrbuf));
2913 snprintf(hdrbuf, sizeof(hdrbuf), "JOBSIZE=PJL-H,%d,%s,4,0,0,0",
2914 hdrlen, pd->pagesize);
2915
2916 /* Write block header */
2917 stp_zfwrite(hdrbuf, 1, sizeof(hdrbuf), v);
2918 /* Write PJL header */
2919 stp_zfwrite(buf, 1, hdrlen, v);
2920
2921 /* Generate payload header */
2922 hdrlen = pd->w_size * pd->h_size * 3 + 296 + 23;
2923 memset(hdrbuf, 0, sizeof(hdrbuf));
2924 snprintf(hdrbuf, sizeof(hdrbuf), "JOBSIZE=PDL,%d",
2925 hdrlen);
2926 /* Write block header */
2927 stp_zfwrite(hdrbuf, 1, sizeof(hdrbuf), v);
2928
2929 char pg = 0;
2930 if (strcmp(pd->pagesize,"Letter") == 0)
2931 pg = 0x00;
2932 else if (strcmp(pd->pagesize,"A4") == 0)
2933 pg = 0x56;
2934
2935 /* Write 312 bytes of payload header */
2936 stp_putc(0x00, v);
2937 stp_putc(0x00, v);
2938 stp_putc(0x01, v);
2939 stp_putc(0x00, v);
2940 stp_putc(0x00, v);
2941 stp_putc(0x10, v);
2942 stp_putc(0x0f, v);
2943 stp_putc(0x00, v);
2944 stp_putc(0x1c, v);
2945 dyesub_nputc(v, 0, 7);
2946
2947 dyesub_nputc(v, 0, 7);
2948 stp_putc(pg, v);
2949 stp_putc(0x02, v);
2950 stp_putc(0x00, v);
2951 stp_putc(0x16, v);
2952 stp_putc(0x00, v);
2953 stp_putc(0x01, v);
2954 stp_putc(0x80, v);
2955 stp_putc(0x00, v);
2956 stp_putc(0x15, v);
2957
2958 stp_putc(0x00, v);
2959 stp_putc(0x12, v);
2960 stp_putc(0x55, v);
2961 stp_putc(0x50, v);
2962 stp_putc(0x44, v);
2963 stp_putc(0x52, v);
2964 stp_putc(0x38, v);
2965 stp_putc(0x30, v);
2966 stp_putc(0x00, v);
2967 stp_putc(0x00, v);
2968 stp_putc(0x4c, v);
2969 stp_putc(0x55, v);
2970 stp_putc(0x54, v);
2971 stp_putc(0x30, v); // XXX 30 LUT0, 2f NO LUT
2972 stp_putc(0x00, v);
2973 stp_putc(0x00, v);
2974
2975 stp_putc(0x00, v);
2976 stp_putc(0x00, v);
2977 stp_putc(0x00, v);
2978 stp_putc(0x00, v); // 00 XXX LUT0, ff NO LUT
2979 stp_putc(0x02, v);
2980 stp_putc(0x00, v);
2981 stp_putc(0x09, v);
2982 stp_putc(0x00, v);
2983 stp_putc(pd->copies, v);
2984 stp_putc(0x02, v);
2985 stp_putc(0x00, v);
2986 stp_putc(0x06, v);
2987 stp_putc(0x01, v);
2988 stp_putc(0x03, v);
2989 stp_putc(0x04, v);
2990 stp_putc(0x00, v);
2991
2992 stp_putc(0x1d, v);
2993 stp_putc(0x01, v);
2994 stp_putc(0x00, v);
2995 stp_putc(0x00, v);
2996 stp_putc(0x05, v);
2997 stp_putc(0x01, v);
2998 stp_putc(0x00, v);
2999 stp_putc(0x20, v);
3000 stp_putc(0x00, v);
3001 stp_putc(0x01, v);
3002 stp_putc(0x00, v);
3003 stp_putc(0x11, v);
3004 stp_putc(0x01, v);
3005 stp_putc(0x08, v);
3006 stp_putc(0x00, v);
3007 stp_putc(0x1a, v);
3008
3009 dyesub_nputc(v, 0, 4);
3010 stp_put16_be(pd->w_size, v);
3011 stp_put16_be(pd->h_size, v);
3012 stp_putc(0x00, v);
3013 stp_putc(0x00, v);
3014 stp_putc(0x13, v);
3015 stp_putc(0x01, v);
3016 stp_putc(0x00, v);
3017 stp_putc(0x04, v);
3018 stp_putc(0x00, v);
3019 stp_putc(0x80, v);
3020
3021 stp_putc(0x00, v);
3022 stp_putc(0x23, v);
3023 stp_putc(0x00, v);
3024 stp_putc(0x10, v);
3025 stp_putc(0x03, v);
3026 stp_putc(0x00, v);
3027 stp_put16_be(pd->w_size, v);
3028 stp_put16_be(pd->h_size, v);
3029 dyesub_nputc(v, 0, 4);
3030 stp_putc(0x08, v);
3031 stp_putc(0x08, v);
3032
3033 stp_putc(0x08, v);
3034 stp_putc(0xff, v);
3035 stp_putc(0xff, v);
3036 stp_putc(0xff, v);
3037 stp_putc(0x01, v);
3038 stp_putc(0x00, v);
3039 stp_putc(0x17, v);
3040 stp_putc(0x00, v);
3041 stp_putc(0x08, v);
3042 stp_putc(0x00, v);
3043 stp_putc(0x19, v);
3044 dyesub_nputc(v, 0, 4);
3045
3046 stp_put16_be(pd->w_size, v);
3047 stp_put16_be(pd->h_size, v);
3048 stp_putc(0x00, v);
3049 stp_putc(0x00, v);
3050 stp_putc(0x81, v);
3051 stp_putc(0x80, v);
3052 stp_putc(0x00, v);
3053 stp_putc(0x8f, v);
3054 stp_putc(0x00, v);
3055 stp_putc(0xa6, v);
3056 dyesub_nputc(v, 0, 0xa6);
3057 stp_putc(0xc0, v);
3058 stp_putc(0x00, v);
3059 stp_putc(0x82, v);
3060 stp_put32_be(pd->w_size* pd->h_size * 3, v);
3061 }
3062
3063 /* Fujifilm CX-400 */
3064 static const dyesub_pagesize_t cx400_page[] =
3065 {
3066 DEFINE_PAPER( "w288h432", "4x6", PT(1268,310), PT(1658,310), 24, 24, 23, 22, DYESUB_PORTRAIT),
3067 DEFINE_PAPER( "w288h387", "4x5 3/8", PT(1268,310), PT(1842,310), 24, 24, 23, 23, DYESUB_PORTRAIT),
3068 DEFINE_PAPER( "w288h504", "4x7", PT(1268,310), PT(2208,310), 24, 24, 23, 22, DYESUB_PORTRAIT),
3069 };
3070
3071 LIST(dyesub_pagesize_list_t, cx400_page_list, dyesub_pagesize_t, cx400_page);
3072
3073 static const dyesub_printsize_t cx400_printsize[] =
3074 {
3075 { "310x310", "w288h387", 1268, 1658},
3076 { "310x310", "w288h432", 1268, 1842},
3077 { "310x310", "w288h504", 1268, 2208},
3078 };
3079
3080 LIST(dyesub_printsize_list_t, cx400_printsize_list, dyesub_printsize_t, cx400_printsize);
3081
3082 static void cx400_printer_init_func(stp_vars_t *v)
3083 {
3084 dyesub_privdata_t *pd = get_privdata(v);
3085
3086 char pg = '\0';
3087 const char *pname = "XXXXXX";
3088
3089 stp_dprintf(STP_DBG_DYESUB, v,
3090 "dyesub: fuji driver %s\n", stp_get_driver(v));
3091 if (strcmp(stp_get_driver(v),"fujifilm-cx400") == 0)
3092 pname = "NX1000";
3093 else if (strcmp(stp_get_driver(v),"fujifilm-cx550") == 0)
3094 pname = "QX200\0";
3095
3096 stp_zfwrite("FUJIFILM", 1, 8, v);
3097 stp_zfwrite(pname, 1, 6, v);
3098 stp_putc('\0', v);
3099 stp_put16_le(pd->w_size, v);
3100 stp_put16_le(pd->h_size, v);
3101 if (strcmp(pd->pagesize,"w288h504") == 0)
3102 pg = '\x0d';
3103 else if (strcmp(pd->pagesize,"w288h432") == 0)
3104 pg = '\x0c';
3105 else if (strcmp(pd->pagesize,"w288h387") == 0)
3106 pg = '\x0b';
3107 stp_putc(pg, v);
3108 stp_zfwrite("\x00\x00\x00\x00\x00\x01\x00\x01\x00\x00\x00\x00"
3109 "\x00\x00\x2d\x00\x00\x00\x00", 1, 19, v);
3110 stp_zfwrite("FUJIFILM", 1, 8, v);
3111 stp_zfwrite(pname, 1, 6, v);
3112 stp_putc('\1', v);
3113 }
3114
3115 /* Fujifilm NX-500 */
3116 static const dyesub_pagesize_t nx500_page[] =
3117 {
3118 DEFINE_PAPER( "Postcard", "Postcard", PT(1024,306), PT(1518,306), 21, 21, 29, 29, DYESUB_PORTRAIT),
3119 };
3120
3121 LIST(dyesub_pagesize_list_t, nx500_page_list, dyesub_pagesize_t, nx500_page);
3122
3123 static const dyesub_printsize_t nx500_printsize[] =
3124 {
3125 { "306x306", "Postcard", 1024, 1518},
3126 };
3127
3128 LIST(dyesub_printsize_list_t, nx500_printsize_list, dyesub_printsize_t, nx500_printsize);
3129
3130 static void nx500_printer_init_func(stp_vars_t *v)
3131 {
3132 dyesub_privdata_t *pd = get_privdata(v);
3133
3134 stp_zfwrite("INFO-QX-20--MKS\x00\x00\x00M\x00W\00A\x00R\00E", 1, 27, v);
3135 dyesub_nputc(v, '\0', 21);
3136 stp_zfwrite("\x80\x00\x02", 1, 3, v);
3137 dyesub_nputc(v, '\0', 20);
3138 stp_zfwrite("\x02\x01\x01", 1, 3, v);
3139 dyesub_nputc(v, '\0', 2);
3140 stp_put16_le(pd->h_size, v);
3141 stp_put16_le(pd->w_size, v);
3142 stp_zfwrite("\x00\x02\x00\x70\x2f", 1, 5, v);
3143 dyesub_nputc(v, '\0', 43);
3144 }
3145
3146
3147 /* Kodak Easyshare Dock family */
3148 static const dyesub_pagesize_t kodak_dock_page[] =
3149 {
3150 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1248,300), PT(1856,300), DYESUB_PORTRAIT), /* 4x6 */
3151 };
3152
3153 LIST(dyesub_pagesize_list_t, kodak_dock_page_list, dyesub_pagesize_t, kodak_dock_page);
3154
3155 static const dyesub_printsize_t kodak_dock_printsize[] =
3156 {
3157 { "300x300", "w288h432", 1248, 1856},
3158 };
3159
3160 LIST(dyesub_printsize_list_t, kodak_dock_printsize_list, dyesub_printsize_t, kodak_dock_printsize);
3161
3162 static void kodak_dock_printer_init(stp_vars_t *v)
3163 {
3164 stp_put16_be(0x3000, v);
3165 dyesub_nputc(v, '\0', 10);
3166 }
3167
3168 static void kodak_dock_plane_init(stp_vars_t *v)
3169 {
3170 dyesub_privdata_t *pd = get_privdata(v);
3171
3172 stp_put16_be(0x3001, v);
3173 stp_put16_le(3 - pd->plane, v);
3174 stp_put32_le(pd->w_size*pd->h_size, v);
3175 dyesub_nputc(v, '\0', 4);
3176 }
3177
3178 /* Kodak 6800 */
3179 static const dyesub_pagesize_t kodak_6800_page[] =
3180 {
3181 DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT(636,300), PT(1844,300), DYESUB_LANDSCAPE), /* 2x6 */
3182 DEFINE_PAPER_SIMPLE( "w216h432", "3x6", PT(936,300), PT(1844,300), DYESUB_LANDSCAPE), /* 3x6 */
3183 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1240,300), PT(1844,300), DYESUB_LANDSCAPE), /* 4x6 */
3184 DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT(1282,300), PT(1844,300), DYESUB_LANDSCAPE), /* 4x6-div2 */
3185 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1836,300), PT(1844,300), DYESUB_LANDSCAPE), /* 6x6 */
3186 DEFINE_PAPER_SIMPLE( "w432h432-div2", "3x6*2", PT(1844,300), PT(1882,300), DYESUB_PORTRAIT), /* 3x6*2 */
3187 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1844,300), PT(2434,300), DYESUB_PORTRAIT), /* 6x8 */
3188 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(1844,300), PT(2490,300), DYESUB_PORTRAIT), /* 6x8-div2 */
3189 };
3190
3191 LIST(dyesub_pagesize_list_t, kodak_6800_page_list, dyesub_pagesize_t, kodak_6800_page);
3192
3193 static const dyesub_printsize_t kodak_6800_printsize[] =
3194 {
3195 { "300x300", "w144h432", 636, 1844},
3196 { "300x300", "w216h432", 936, 1844},
3197 { "300x300", "w288h432", 1240, 1844},
3198 { "300x300", "w288h432-div2", 1282, 1844},
3199 { "300x300", "w432h432", 1836, 1844},
3200 { "300x300", "w432h432-div2", 1844, 1882},
3201 { "300x300", "w432h576", 1844, 2434},
3202 { "300x300", "w432h576-div2", 1844, 2490},
3203 };
3204
3205 LIST(dyesub_printsize_list_t, kodak_6800_printsize_list, dyesub_printsize_t, kodak_6800_printsize);
3206
3207 static const overcoat_t kodak_6800_overcoat[] =
3208 {
3209 {"Coated", N_("Coated"), {1, "\x01"}},
3210 {"None", N_("None"), {1, "\x00"}},
3211 };
3212
3213 LIST(overcoat_list_t, kodak_6800_overcoat_list, overcoat_t, kodak_6800_overcoat);
3214
3215 /* Kodak 6850 */
3216 static const dyesub_pagesize_t kodak_6850_page[] =
3217 {
3218 DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT(636,300), PT(1844,300), DYESUB_LANDSCAPE), /* 2x6 */
3219 DEFINE_PAPER_SIMPLE( "w216h432", "3x6", PT(936,300), PT(1844,300), DYESUB_LANDSCAPE), /* 3x6 */
3220 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1240,300), PT(1844,300), DYESUB_LANDSCAPE), /* 4x6 */
3221 DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT(1282,300), PT(1844,300), DYESUB_LANDSCAPE), /* 4x6-div2 */
3222 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1548,300), PT(2140,300), DYESUB_PORTRAIT), /* 5x7 */
3223 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1836,300), PT(1844,300), DYESUB_LANDSCAPE), /* 6x6 */
3224 DEFINE_PAPER_SIMPLE( "w432h432-div2", "3x6*2", PT(1844,300), PT(1882,300), DYESUB_PORTRAIT), /* 3x6*2 */
3225 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1844,300), PT(2434,300), DYESUB_PORTRAIT), /* 6x8 */
3226 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(1844,300), PT(2490,300), DYESUB_PORTRAIT), /* 6x8-div2 */
3227 };
3228
3229 LIST(dyesub_pagesize_list_t, kodak_6850_page_list, dyesub_pagesize_t, kodak_6850_page);
3230
3231 static const dyesub_printsize_t kodak_6850_printsize[] =
3232 {
3233 { "300x300", "w144h432", 636, 1844},
3234 { "300x300", "w216h432", 936, 1844},
3235 { "300x300", "w288h432", 1240, 1844},
3236 { "300x300", "w288h432-div2", 1282, 1844},
3237 { "300x300", "w360h504", 1548, 2140},
3238 { "300x300", "w432h432", 1836, 1844},
3239 { "300x300", "w432h432-div2", 1844, 1882},
3240 { "300x300", "w432h576", 1844, 2434},
3241 { "300x300", "w432h576-div2", 1844, 2490},
3242 };
3243
3244 LIST(dyesub_printsize_list_t, kodak_6850_printsize_list, dyesub_printsize_t, kodak_6850_printsize);
3245
3246 static unsigned short short_to_packed_bcd(unsigned short val)
3247 {
3248 unsigned short bcd;
3249 unsigned short i;
3250
3251 /* Handle from 0-9999 */
3252 i = val % 10;
3253 bcd = i;
3254 val /= 10;
3255
3256 i = val % 10;
3257 bcd |= (i << 4);
3258 val /= 10;
3259
3260 i = val % 10;
3261 bcd |= (i << 8);
3262 val /= 10;
3263
3264 i = val % 10;
3265 bcd |= (i << 12);
3266
3267 return bcd;
3268 }
3269
3270 static void kodak_68xx_printer_init(stp_vars_t *v)
3271 {
3272 dyesub_privdata_t *pd = get_privdata(v);
3273
3274 stp_zfwrite("\x03\x1b\x43\x48\x43\x0a\x00\x01", 1, 8, v);
3275 stp_put16_be(short_to_packed_bcd(pd->copies), v); /* Number of copies in BCD */
3276 stp_put16_be(pd->w_size, v);
3277 stp_put16_be(pd->h_size, v);
3278
3279 if (!strcmp(pd->pagesize,"w360h504"))
3280 stp_putc(0x07, v); /* All 5" sizes */
3281 else
3282 stp_putc(0x06, v); /* All others are 6" sizes */
3283
3284 stp_zfwrite((pd->overcoat->seq).data, 1,
3285 (pd->overcoat->seq).bytes, v);
3286
3287 if (!strcmp(pd->pagesize,"w360h504"))
3288 stp_putc(0x00, v);
3289 else if (!strcmp(pd->pagesize,"w144h432"))
3290 stp_putc(0x21, v);
3291 else if (!strcmp(pd->pagesize,"w216h432"))
3292 stp_putc(0x23, v);
3293 else if (!strcmp(pd->pagesize,"w288h432"))
3294 stp_putc(0x01, v);
3295 else if (!strcmp(pd->pagesize,"w288h432-div2"))
3296 stp_putc(0x20, v);
3297 else if (!strcmp(pd->pagesize,"w432h432"))
3298 stp_putc(0x00, v);
3299 else if (!strcmp(pd->pagesize,"w432h432-div2"))
3300 stp_putc(0x00, v);
3301 else if (!strcmp(pd->pagesize,"w432h576"))
3302 stp_putc(0x00, v);
3303 else if (!strcmp(pd->pagesize,"w432h576-div2"))
3304 stp_putc(0x02, v);
3305 else
3306 stp_putc(0x00, v); /* Catch-all, just in case */
3307
3308 }
3309
3310 /* Kodak 605 */
3311 static const dyesub_pagesize_t kodak_605_page[] =
3312 {
3313 DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT(636,300), PT(1844,300), DYESUB_LANDSCAPE), /* 2x6 */
3314 DEFINE_PAPER_SIMPLE( "w216h432", "3x6", PT(936,300), PT(1844,300), DYESUB_LANDSCAPE), /* 3x6 */
3315 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1240,300), PT(1844,300), DYESUB_LANDSCAPE), /* 4x6 */
3316 DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT(1282,300), PT(1844,300), DYESUB_LANDSCAPE), /* 4x6-div2 */
3317 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1500,300), PT(2100,300), DYESUB_PORTRAIT), /* 5x7 */
3318 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1836,300), PT(1844,300), DYESUB_LANDSCAPE),
3319 DEFINE_PAPER_SIMPLE( "w432h432-div2", "3x6*2", PT(1844,300), PT(1882,300), DYESUB_PORTRAIT),
3320 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1844,300), PT(2434,300), DYESUB_PORTRAIT), /* 6x8 */
3321 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(1844,300), PT(2490,300), DYESUB_PORTRAIT), /* 6x8-div2 */
3322 };
3323
3324 LIST(dyesub_pagesize_list_t, kodak_605_page_list, dyesub_pagesize_t, kodak_605_page);
3325
3326 static const dyesub_printsize_t kodak_605_printsize[] =
3327 {
3328 { "300x300", "w144h432", 636, 1844},
3329 { "300x300", "w216h432", 936, 1844},
3330 { "300x300", "w288h432", 1240, 1844},
3331 { "300x300", "w288h432-div2", 1282, 1844},
3332 { "300x300", "w432h432", 1836, 1844},
3333 { "300x300", "w432h432-div2", 1844, 1836},
3334 { "300x300", "w360h504", 1500, 2100},
3335 { "300x300", "w432h576", 1844, 2434},
3336 { "300x300", "w432h576-div2", 1844, 2490},
3337 };
3338
3339 LIST(dyesub_printsize_list_t, kodak_605_printsize_list, dyesub_printsize_t, kodak_605_printsize);
3340
3341 static void kodak_605_printer_init(stp_vars_t *v)
3342 {
3343 dyesub_privdata_t *pd = get_privdata(v);
3344
3345 stp_zfwrite("\x01\x40\x0a\x00\x01", 1, 5, v);
3346 stp_put16_le(pd->copies, v);
3347 stp_put16_le(pd->w_size, v);
3348 stp_put16_le(pd->h_size, v);
3349
3350 if (!strcmp(pd->pagesize,"w144h432"))
3351 stp_putc(0x12, v);
3352 else if (!strcmp(pd->pagesize,"w216h432"))
3353 stp_putc(0x14, v);
3354 else if (!strcmp(pd->pagesize,"w288h432"))
3355 stp_putc(0x01, v);
3356 else if (!strcmp(pd->pagesize,"w288h432-div2"))
3357 stp_putc(0x11, v);
3358 else if (!strcmp(pd->pagesize,"w432h432"))
3359 stp_putc(0x0d, v);
3360 else if (!strcmp(pd->pagesize,"w432h432-div2"))
3361 stp_putc(0x13, v);
3362 else if (!strcmp(pd->pagesize,"w432h576"))
3363 stp_putc(0x03, v);
3364 else if (!strcmp(pd->pagesize,"w432h576-div2"))
3365 stp_putc(0x04, v);
3366 else if (!strcmp(pd->pagesize,"w360h504"))
3367 stp_putc(0x02, v);
3368 else
3369 stp_putc(0x01, v); /* Just in case */
3370
3371 stp_zfwrite((pd->overcoat->seq).data, 1,
3372 (pd->overcoat->seq).bytes, v);
3373 stp_putc(0x00, v);
3374 }
3375
3376 static const overcoat_t kodak_605_overcoat[] =
3377 {
3378 {"Coated", N_("Coated"), {1, "\x02"}},
3379 {"None", N_("None"), {1, "\x01"}},
3380 };
3381
3382 LIST(overcoat_list_t, kodak_605_overcoat_list, overcoat_t, kodak_605_overcoat);
3383
3384 /* Kodak 1400 */
3385 static const dyesub_pagesize_t kodak_1400_page[] =
3386 {
3387 /* Printer has 1" non-printable area on top and bottom of page, not part of
3388 data sent over.
3389
3390 Printer requires full-bleed data horizontally. However, not all pixels
3391 are actually printed. 35+35 (8x14 paper) or 76+76 (8x12 paper) are
3392 effectively discarded (ie ~0.125" and ~0.250" respectively).
3393
3394 The printer can technically print a little wider but these dimensions are
3395 defined by the lamination area, which is fixed.
3396 */
3397 DEFINE_PAPER( "w612h864", "8.5x12", PT(2560,301), PT(3010,301)+72*2, PT(76,301), PT(76,301), 72, 72, DYESUB_PORTRAIT), /* 8x12 */
3398 DEFINE_PAPER( "Legal", "8.5x14", PT(2560,301), PT(3612,301)+72*2, PT(35,301), PT(35,301), 72, 72, DYESUB_PORTRAIT), /* 8x14 */
3399 DEFINE_PAPER( "A4", "A4", PT(2560,301), PT(3010,301)+72*2, PT(76,301), PT(76,301), 0, 0, DYESUB_PORTRAIT), /* A4, identical to 8x12 */
3400 };
3401
3402 LIST(dyesub_pagesize_list_t, kodak_1400_page_list, dyesub_pagesize_t, kodak_1400_page);
3403
3404 static const dyesub_media_t kodak_1400_media[] =
3405 {
3406 { "Glossy", N_("Glossy"), {2, "\x00\x3c"}},
3407 { "Matte+5", N_("Matte +5"), {2, "\x01\x28"}},
3408 { "Matte+4", N_("Matte +4"), {2, "\x01\x2e"}},
3409 { "Matte+3", N_("Matte +3"), {2, "\x01\x34"}},
3410 { "Matte+2", N_("Matte +2"), {2, "\x01\x3a"}},
3411 { "Matte+1", N_("Matte +1"), {2, "\x01\x40"}},
3412 { "Matte", N_("Matte"), {2, "\x01\x46"}},
3413 { "Matte-1", N_("Matte -1"), {2, "\x01\x52"}},
3414 { "Matte-2", N_("Matte -2"), {2, "\x01\x5e"}},
3415 { "Matte-3", N_("Matte -3"), {2, "\x01\x6a"}},
3416 { "Matte-4", N_("Matte -4"), {2, "\x01\x76"}},
3417 { "Matte-5", N_("Matte -5"), {2, "\x01\x82"}},
3418 };
3419 LIST(dyesub_media_list_t, kodak_1400_media_list, dyesub_media_t, kodak_1400_media);
3420
3421 static const dyesub_printsize_t kodak_1400_printsize[] =
3422 {
3423 { "301x301", "w612h864", 2560, 3010},
3424 { "301x301", "Legal", 2560, 3612},
3425 { "301x301", "A4", 2560, 3010},
3426 };
3427
3428 LIST(dyesub_printsize_list_t, kodak_1400_printsize_list, dyesub_printsize_t, kodak_1400_printsize);
3429
3430 static void kodak_1400_printer_init(stp_vars_t *v)
3431 {
3432 dyesub_privdata_t *pd = get_privdata(v);
3433
3434 stp_zfwrite("PGHD", 1, 4, v);
3435 stp_put16_le(pd->w_size, v);
3436 dyesub_nputc(v, 0x00, 2);
3437 stp_put16_le(pd->h_size, v);
3438 dyesub_nputc(v, 0x00, 2);
3439 stp_put32_le(pd->h_size*pd->w_size, v);
3440 dyesub_nputc(v, 0x00, 4);
3441 stp_zfwrite((pd->media->seq).data, 1, 1, v); /* Matte or Glossy? */
3442 stp_zfwrite((pd->overcoat->seq).data, 1,
3443 (pd->overcoat->seq).bytes, v);
3444 stp_putc(0x01, v);
3445 stp_zfwrite((const char*)((pd->media->seq).data) + 1, 1, 1, v); /* Lamination intensity */
3446 dyesub_nputc(v, 0x00, 12);
3447 }
3448
3449 /* Kodak 805 */
3450 static const dyesub_pagesize_t kodak_805_page[] =
3451 {
3452 /* Identical to the Kodak 1400 except for the lack of A4 support.
3453 See the 1400 comments for explanations of this. */
3454 DEFINE_PAPER( "w612h864", "8.5x12", PT(2560,301), PT(3010,301)+72*2, PT(76,301), PT(76,301), 72, 72, DYESUB_PORTRAIT), /* 8x12 */
3455 DEFINE_PAPER( "Legal", "8.5x14", PT(2560,301), PT(3612,301)+72*2, PT(35,301), PT(35,301), 72, 72, DYESUB_PORTRAIT), /* 8x14 */
3456 };
3457
3458 LIST(dyesub_pagesize_list_t, kodak_805_page_list, dyesub_pagesize_t, kodak_805_page);
3459
3460 static const dyesub_printsize_t kodak_805_printsize[] =
3461 {
3462 { "301x301", "w612h864", 2560, 3010},
3463 { "301x301", "Legal", 2560, 3612},
3464 };
3465
3466 LIST(dyesub_printsize_list_t, kodak_805_printsize_list, dyesub_printsize_t, kodak_805_printsize);
3467
3468 static void kodak_805_printer_init(stp_vars_t *v)
3469 {
3470 dyesub_privdata_t *pd = get_privdata(v);
3471
3472 stp_zfwrite("PGHD", 1, 4, v);
3473 stp_put16_le(pd->w_size, v);
3474 dyesub_nputc(v, 0x00, 2);
3475 stp_put16_le(pd->h_size, v);
3476 dyesub_nputc(v, 0x00, 2);
3477 stp_put32_le(pd->h_size*pd->w_size, v);
3478 dyesub_nputc(v, 0x00, 5);
3479 stp_zfwrite((pd->overcoat->seq).data, 1,
3480 (pd->overcoat->seq).bytes, v);
3481 stp_putc(0x01, v);
3482 stp_putc(0x3c, v); /* Lamination intensity; fixed on glossy media */
3483 dyesub_nputc(v, 0x00, 12);
3484 }
3485
3486 /* Kodak 9810 / 8800 */
3487 static const dyesub_pagesize_t kodak_9810_page[] =
3488 {
3489 DEFINE_PAPER_SIMPLE( "c8x10", "8x10", PT(2464,300), PT(3024,300), DYESUB_PORTRAIT),
3490 DEFINE_PAPER( "c8x10-div2", "8x5*2", PT(2464,300), PT1(3024,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
3491 DEFINE_PAPER_SIMPLE( "w576h864", "8x12", PT(2464,300), PT(3624,300), DYESUB_PORTRAIT),
3492 DEFINE_PAPER( "w576h864-div2", "8x6*2", PT(2464,300), PT1(3624,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
3493 };
3494 LIST(dyesub_pagesize_list_t, kodak_9810_page_list, dyesub_pagesize_t, kodak_9810_page);
3495
3496 static const dyesub_printsize_t kodak_9810_printsize[] =
3497 {
3498 { "300x300", "c8x10", 2464, 3024},
3499 { "300x300", "c8x10-div2", 2464, 3024},
3500 { "300x300", "w576h864", 2464, 3624},
3501 { "300x300", "w576h864-div2", 2464, 3624},
3502 };
3503
3504 LIST(dyesub_printsize_list_t, kodak_9810_printsize_list, dyesub_printsize_t, kodak_9810_printsize);
3505
3506 static const overcoat_t kodak_9810_overcoat[] =
3507 {
3508 {"Coated", N_("Coated"), {3, "\x4f\x6e\x20"}},
3509 {"None", N_("None"), {3, "\x4f\x66\x66"}},
3510 };
3511
3512 LIST(overcoat_list_t, kodak_9810_overcoat_list, overcoat_t, kodak_9810_overcoat);
3513
3514 static const stp_parameter_t kodak_9810_parameters[] =
3515 {
3516 {
3517 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
3518 N_("Sharpening to apply to image (0 is off, 18 is normal, 24 is max"),
3519 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
3520 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
3521 },
3522 };
3523 #define kodak_9810_parameter_count (sizeof(kodak_9810_parameters) / sizeof(const stp_parameter_t))
3524
3525 static int
3526 kodak_9810_load_parameters(const stp_vars_t *v, const char *name,
3527 stp_parameter_t *description)
3528 {
3529 unsigned int i;
3530 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
3531 stp_get_model_id(v));
3532
3533 if (caps->parameter_count && caps->parameters)
3534 {
3535 for (i = 0; i < caps->parameter_count; i++)
3536 if (strcmp(name, caps->parameters[i].name) == 0)
3537 {
3538 stp_fill_parameter_settings(description, &(caps->parameters[i]));
3539 break;
3540 }
3541 }
3542
3543 if (strcmp(name, "Sharpen") == 0)
3544 {
3545 description->deflt.integer = 18;
3546 description->bounds.integer.lower = 0;
3547 description->bounds.integer.upper = 24;
3548 description->is_active = 1;
3549 }
3550 else
3551 {
3552 return 0;
3553 }
3554 return 1;
3555 }
3556
3557 static int kodak_9810_parse_parameters(stp_vars_t *v)
3558 {
3559 dyesub_privdata_t *pd = get_privdata(v);
3560
3561 /* No need to set global params if there's no privdata yet */
3562 if (!pd)
3563 return 1;
3564
3565 /* Parse options */
3566 pd->privdata.k9810.sharpen = stp_get_int_parameter(v, "Sharpen");
3567
3568 return 1;
3569 }
3570
3571 static void kodak_9810_printer_init(stp_vars_t *v)
3572 {
3573 dyesub_privdata_t *pd = get_privdata(v);
3574
3575 /* Command stream header */
3576 stp_putc(0x1b, v);
3577 stp_zfwrite("MndROSETTA V001.00100000020525072696E74657242696E4D6F74726C", 1, 59, v);
3578
3579 /* Begin Job */
3580 stp_putc(0x1b, v);
3581 stp_zfwrite("MndBgnJob Print ", 1, 19, v);
3582 dyesub_nputc(v, 0x00, 4);
3583 stp_put32_be(8, v);
3584 stp_zfwrite("\x56\x30\x30\x31\x2e\x30\x30\x30", 1, 8, v);
3585
3586 /* Job Definition Start */
3587 stp_putc(0x1b, v);
3588 stp_zfwrite("FlsSrtJbDefSetup ", 1, 19, v);
3589 dyesub_nputc(v, 0x00, 4);
3590 stp_put32_be(0, v);
3591
3592 /* Paper selection */
3593 stp_putc(0x1b, v);
3594 stp_zfwrite("FlsJbMkMed Name ", 1, 19, v);
3595 dyesub_nputc(v, 0x00, 4);
3596 stp_put32_be(64, v);
3597 if (pd->h_size == 3624) {
3598 stp_zfwrite("YMCX 8x12 Glossy", 1, 16, v);
3599 } else {
3600 stp_zfwrite("YMCX 8x10 Glossy", 1, 16, v);
3601 }
3602 dyesub_nputc(v, 0x00, 48);
3603
3604 /* Paper Selection II */
3605 stp_putc(0x1b, v);
3606 stp_zfwrite("FlsPgMedia Name ", 1, 19, v);
3607 dyesub_nputc(v, 0x00, 4);
3608 stp_put32_be(64, v);
3609 stp_zfwrite("\x38\x22", 1, 2, v);
3610 dyesub_nputc(v, 0x00, 62);
3611
3612 /* Lamination */
3613 stp_putc(0x1b, v);
3614 stp_zfwrite("FlsJbLam ", 1, 11, v);
3615 stp_zfwrite((pd->overcoat->seq).data, 1,
3616 (pd->overcoat->seq).bytes, v);
3617 dyesub_nputc(v, 0x20, 5);
3618 dyesub_nputc(v, 0x00, 4);
3619 stp_put32_be(0, v);
3620
3621 /* Job Definition End */
3622 stp_putc(0x1b, v);
3623 stp_zfwrite("FlsStpJbDef ", 1, 19, v);
3624 dyesub_nputc(v, 0x00, 4);
3625 stp_put32_be(0, v);
3626
3627 /* Begin Page */
3628 stp_putc(0x1b, v);
3629 stp_zfwrite("MndBgnLPageNormal ", 1, 19, v);
3630 dyesub_nputc(v, 0x00, 4);
3631 stp_put32_be(4, v);
3632 stp_put32_be(1, v);
3633
3634 /* Page dimensions I -- maybe this is physical media size? */
3635 stp_putc(0x1b, v);
3636 stp_zfwrite("MndSetLPage ", 1, 19, v);
3637 dyesub_nputc(v, 0x00, 4);
3638 stp_put32_be(8, v);
3639 stp_put32_be(pd->w_size, v);
3640 stp_put32_be(pd->h_size, v);
3641
3642 /* Page dimensions II -- maybe this is image data size? */
3643 stp_putc(0x1b, v);
3644 stp_zfwrite("MndImSpec Size ", 1, 19, v);
3645 dyesub_nputc(v, 0x00, 4);
3646 stp_put32_be(16, v);
3647 stp_put32_be(pd->w_size, v);
3648 stp_put32_be(pd->h_size, v);
3649 stp_put32_be(pd->w_size, v);
3650 stp_put32_be(0, v);
3651
3652 /* Positioning within page? */
3653 stp_putc(0x1b, v);
3654 stp_zfwrite("FlsImPositnSpecify ", 1, 19, v);
3655 dyesub_nputc(v, 0x00, 4);
3656 stp_put32_be(8, v);
3657 stp_put32_be(0, v); /* Presumably X */
3658 stp_put32_be(0, v); /* Presumably Y */
3659
3660 /* Sharpening */
3661 stp_putc(0x1b, v);
3662 stp_zfwrite("FlsImSharp SetLevel", 1, 19, v);
3663 dyesub_nputc(v, 0x00, 4);
3664 stp_put32_be(2, v);
3665 stp_putc(0xFF, v);
3666 stp_putc(pd->privdata.k9810.sharpen, v);
3667
3668 /* Number of Copies */
3669 stp_putc(0x1b, v);
3670 stp_zfwrite("FlsPgCopies ", 1, 19, v);
3671 dyesub_nputc(v, 0x00, 4);
3672 stp_put32_be(4, v);
3673 stp_put32_be(pd->copies, v);
3674
3675 /* Mirroring */
3676 stp_putc(0x1b, v);
3677 stp_zfwrite("FlsPgMirrorNone ", 1, 19, v);
3678 dyesub_nputc(v, 0x00, 4);
3679 stp_put32_be(0, v);
3680
3681 /* Rotation */
3682 stp_putc(0x1b, v);
3683 stp_zfwrite("FlsPgRotateNone ", 1, 19, v);
3684 dyesub_nputc(v, 0x00, 4);
3685 stp_put32_be(0, v);
3686
3687 /* Cut list -- A list of be16 row offsets for cuts. */
3688 stp_putc(0x1b, v);
3689 stp_zfwrite("FlsCutList ", 1, 19, v);
3690 dyesub_nputc(v, 0x00, 4);
3691
3692 if (strcmp(pd->pagesize,"c8x10") == 0) {
3693 stp_put32_be(4, v);
3694 stp_zfwrite("\x00\x0c\x0b\xc4", 1, 4, v);
3695 } else if (strcmp(pd->pagesize,"c8x10-div2") == 0) {
3696 stp_put32_be(6, v);
3697 stp_zfwrite("\x00\x0c\x05\xe8\x0b\xc4", 1, 6, v);
3698 /* XXX double slug
3699 stp_put32_be(8, v);
3700 stp_zfwrite("\x00\x0c\x05\xd5\x05\xfb\x0b\xc4", 1, 6, v);
3701 */
3702 } else if (strcmp(pd->pagesize,"w576h864") == 0) {
3703 stp_put32_be(4, v);
3704 stp_zfwrite("\x00\x0c\x0e\x1c", 1, 4, v);
3705 } else if (strcmp(pd->pagesize,"w576h864-div2") == 0) {
3706 stp_put32_be(6, v);
3707 stp_zfwrite("\x00\x0c\x07\x14\x0e\x1c", 1, 6, v);
3708 /* XXX double slug
3709 stp_put32_be(8, v);
3710 stp_zfwrite("\x00\x0c\x07\x01\x07\x27\x0e\x1c", 1, 6, v);
3711 */
3712 }
3713 }
3714
3715 static void kodak_9810_printer_end(stp_vars_t *v)
3716 {
3717 /* End Page */
3718 stp_putc(0x1b, v);
3719 stp_zfwrite("MndEndLPage ", 1, 19, v);
3720 dyesub_nputc(v, 0x00, 4);
3721 stp_put32_be(0, v);
3722
3723 /* End Job */
3724 stp_putc(0x1b, v);
3725 stp_zfwrite("MndEndJob ", 1, 19, v);
3726 dyesub_nputc(v, 0x00, 4);
3727 stp_put32_be(0, v);
3728 }
3729
3730 static void kodak_9810_plane_init(stp_vars_t *v)
3731 {
3732 dyesub_privdata_t *pd = get_privdata(v);
3733
3734 /* Data block */
3735 stp_putc(0x1b, v);
3736 stp_zfwrite("FlsData Block ", 1, 19, v);
3737 dyesub_nputc(v, 0x00, 4);
3738 stp_put32_be((pd->w_size * pd->h_size) + 8, v);
3739 stp_zfwrite("Image ", 1, 8, v);
3740 }
3741
3742 /* Kodak 8810 */
3743 static const dyesub_pagesize_t kodak_8810_page[] =
3744 {
3745 DEFINE_PAPER_SIMPLE( "w288h576", "8x4", PT(1208,300), PT(2464,300), DYESUB_LANDSCAPE),
3746 DEFINE_PAPER_SIMPLE( "w360h576", "8x5", PT(1508,300), PT(2464,300), DYESUB_LANDSCAPE),
3747 DEFINE_PAPER_SIMPLE( "w432h576", "8x6", PT(1808,300), PT(2464,300), DYESUB_LANDSCAPE),
3748 DEFINE_PAPER_SIMPLE( "w576h576", "8x8", PT(2408,300), PT(2464,300), DYESUB_LANDSCAPE),
3749 DEFINE_PAPER( "w576h576-div2", "8x4*2", PT1(2408,300), PT(2464,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
3750 DEFINE_PAPER_SIMPLE( "c8x10", "8x10", PT(2464,300), PT(3024,300), DYESUB_PORTRAIT),
3751 DEFINE_PAPER( "c8x10-div2", "8x5*2", PT(2464,300), PT1(3024,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
3752 DEFINE_PAPER_SIMPLE( "A4", "203x297mm", PT(2464,300), PT(3531,300), DYESUB_PORTRAIT),
3753 DEFINE_PAPER_SIMPLE( "w576h864", "8x12", PT(2464,300), PT(3624,300), DYESUB_PORTRAIT),
3754 DEFINE_PAPER( "w576h864-div2", "8x6*2", PT(2464,300), PT1(3624,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
3755 DEFINE_PAPER( "w576h864-div3", "8x4*3", PT(2464,300), PT2(3624,300), 0, 0, 0, PT2(0,300), DYESUB_PORTRAIT),
3756 /* Panorama sizes */
3757 DEFINE_PAPER_SIMPLE( "w576h1008", "8x14 Panorama", PT(2464,300), PT(4224,300), DYESUB_PORTRAIT),
3758 DEFINE_PAPER_SIMPLE( "w576h1152", "8x16 Panorama", PT(2464,300), PT(4824,300), DYESUB_PORTRAIT),
3759 DEFINE_PAPER_SIMPLE( "w576h1440", "8x20 Panorama", PT(2464,300), PT(6024,300), DYESUB_PORTRAIT),
3760 DEFINE_PAPER_SIMPLE( "w576h1728", "8x24 Panorama", PT(2464,300), PT(7224,300), DYESUB_PORTRAIT),
3761 DEFINE_PAPER_SIMPLE( "w576h2304", "8x32 Panorama", PT(2464,300), PT(9624,300), DYESUB_PORTRAIT),
3762 DEFINE_PAPER_SIMPLE( "w576h2592", "8x36 Panorama", PT(2464,300), PT(10824,300), DYESUB_PORTRAIT),
3763 };
3764 LIST(dyesub_pagesize_list_t, kodak_8810_page_list, dyesub_pagesize_t, kodak_8810_page);
3765
3766 static const dyesub_printsize_t kodak_8810_printsize[] =
3767 {
3768 { "300x300", "w288h576", 1208, 2464},
3769 { "300x300", "w360h576", 1508, 2464},
3770 { "300x300", "w432h576", 1808, 2464},
3771 { "300x300", "w576h576", 2408, 2464},
3772 { "300x300", "w576h576-div2", 2408, 2464},
3773 { "300x300", "c8x10", 2464, 3024},
3774 { "300x300", "c8x10-div2", 2464, 3024},
3775 { "300x300", "A4", 2464, 3531},
3776 { "300x300", "w576h864", 2464, 3624},
3777 { "300x300", "w576h864-div2", 2464, 3624},
3778 { "300x300", "w576h864-div3", 2464, 3624},
3779 /* Panorama sizes */
3780 { "300x300", "w576h1008", 2464, 4264},
3781 { "300x300", "w576h1152", 2464, 4864},
3782 { "300x300", "w576h1440", 2464, 6064},
3783 { "300x300", "w576h1728", 2464, 7264},
3784 { "300x300", "w576h2304", 2464, 9664},
3785 { "300x300", "w576h2592", 2464, 10864},
3786 };
3787
3788 LIST(dyesub_printsize_list_t, kodak_8810_printsize_list, dyesub_printsize_t, kodak_8810_printsize);
3789
3790 static const overcoat_t kodak_8810_overcoat[] =
3791 {
3792 {"Glossy", N_("Glossy"), {1, "\x02"}},
3793 {"Satin", N_("Satin"), {1, "\x03"}},
3794 };
3795
3796 LIST(overcoat_list_t, kodak_8810_overcoat_list, overcoat_t, kodak_8810_overcoat);
3797
3798 static void kodak_8810_printer_init(stp_vars_t *v)
3799 {
3800 dyesub_privdata_t *pd = get_privdata(v);
3801 char method;
3802 char media;
3803
3804 /* NOTE: These multicut sizes are broken. */
3805 if (strcmp(pd->pagesize,"w576h576-div2") == 0) {
3806 method = 2;
3807 media = 0x30;
3808 } else if (strcmp(pd->pagesize,"c8x10-div2") == 0) {
3809 method = 2;
3810 media = 0x31;
3811 } else if (strcmp(pd->pagesize,"w576h864-div2") == 0) {
3812 method = 2;
3813 media = 0x32;
3814 } else if (strcmp(pd->pagesize,"w576h864-div3") == 0) {
3815 method = 3;
3816 media = 0x40;
3817 } else {
3818 method = 0;
3819 media = 0;
3820 }
3821
3822 stp_putc(0x01, v);
3823 stp_putc(0x40, v);
3824 stp_putc(0x12, v);
3825 stp_putc(0x00, v);
3826 stp_putc(0x01, v);
3827 stp_put16_le(pd->copies, v);
3828 stp_put16_le(pd->w_size, v);
3829 stp_put16_le(pd->h_size, v);
3830 stp_put16_le(pd->w_size, v);
3831 stp_put16_le(pd->h_size, v);
3832 dyesub_nputc(v, 0, 4);
3833 stp_zfwrite((pd->overcoat->seq).data, 1,
3834 (pd->overcoat->seq).bytes, v);
3835 stp_putc(method, v); /* Method -- 00 is normal, 02 is x2, 03 is x3 */
3836 stp_putc(media, v); /* Reserved? */
3837 }
3838
3839 static int kodak_8810_parse_paramters(stp_vars_t *v)
3840 {
3841 const char *oc_mode;
3842 const char *pagesize;
3843
3844 pagesize = stp_get_string_parameter(v, "PageSize");
3845 oc_mode = stp_get_string_parameter(v, "Laminate");
3846
3847 if (strcmp(oc_mode, "Glossy"))
3848 {
3849 if (!strcmp(pagesize, "w576h1008") ||
3850 !strcmp(pagesize, "w576h1152") ||
3851 !strcmp(pagesize, "w576h1440") ||
3852 !strcmp(pagesize, "w576h1728") ||
3853 !strcmp(pagesize, "w576h2304") ||
3854 !strcmp(pagesize, "w576h2592"))
3855 {
3856 stp_eprintf(v, _("Must use glossy overcoat with panorama print sizes!\n"));
3857 return 0;
3858 }
3859 }
3860 return 1; /* Everything is peachy */
3861 }
3862
3863 /* Kodak 6900 */
3864 static const dyesub_pagesize_t kodak_6900_page[] =
3865 {
3866 DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT(636,300), PT(1844,300), DYESUB_LANDSCAPE),
3867 DEFINE_PAPER_SIMPLE( "w216h432", "3x6", PT(936,300), PT(1844,300), DYESUB_LANDSCAPE),
3868 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1236,300), PT(1844,300), DYESUB_LANDSCAPE),
3869 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1836,300), PT(1844,300), DYESUB_LANDSCAPE),
3870 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1844,300), PT(2436,300), DYESUB_PORTRAIT),
3871 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1086,300), PT(1548,300), DYESUB_LANDSCAPE),
3872 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1548,300), PT(2136,300), DYESUB_PORTRAIT),
3873 };
3874
3875 LIST(dyesub_pagesize_list_t, kodak_6900_page_list, dyesub_pagesize_t, kodak_6900_page);
3876
3877 static const dyesub_printsize_t kodak_6900_printsize[] =
3878 {
3879 { "300x300", "w144h432", 636, 1844},
3880 { "300x300", "w216h432", 636, 1844},
3881 { "300x300", "w288h432", 1236, 1844},
3882 { "300x300", "w432h432", 1836, 1844},
3883 { "300x300", "w432h576", 1844, 2436},
3884 { "300x300", "B7", 1086, 2140},
3885 { "300x300", "w360h504", 1548, 2140},
3886 };
3887
3888 LIST(dyesub_printsize_list_t, kodak_6900_printsize_list, dyesub_printsize_t, kodak_6900_printsize);
3889
3890 static const overcoat_t kodak_6900_overcoat[] =
3891 {
3892 {"Glossy", N_("Glossy"), {1, "\x01"}},
3893 {"Satin", N_("Satin"), {1, "\x02"}},
3894 };
3895
3896 LIST(overcoat_list_t, kodak_6900_overcoat_list, overcoat_t, kodak_6900_overcoat);
3897
3898 static const dyesub_stringitem_t kodak6900_qualities[] =
3899 {
3900 { "Standard", N_ ("Standard") },
3901 { "High", N_ ("High") },
3902 };
3903 LIST(dyesub_stringlist_t, kodak6900_quality_list, dyesub_stringitem_t, kodak6900_qualities);
3904
3905 static const stp_parameter_t kodak6900_parameters[] =
3906 {
3907 {
3908 "PrintQuality", N_("Print Quality"), "Color=No,Category=Advanced Printer Setup",
3909 N_("Print Speed"),
3910 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
3911 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
3912 },
3913 };
3914 #define kodak6900_parameter_count (sizeof(kodak6900_parameters) / sizeof(const stp_parameter_t))
3915
3916 static int
3917 kodak6900_load_parameters(const stp_vars_t *v, const char *name,
3918 stp_parameter_t *description)
3919 {
3920 unsigned int i;
3921 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
3922 stp_get_model_id(v));
3923
3924 if (caps->parameter_count && caps->parameters)
3925 {
3926 for (i = 0; i < caps->parameter_count; i++)
3927 if (strcmp(name, caps->parameters[i].name) == 0)
3928 {
3929 stp_fill_parameter_settings(description, &(caps->parameters[i]));
3930 break;
3931 }
3932 }
3933
3934 if (strcmp(name, "PrintQuality") == 0)
3935 {
3936 description->bounds.str = stp_string_list_create();
3937
3938 const dyesub_stringlist_t *mlist = &kodak6900_quality_list;
3939 for (i = 0; i < mlist->n_items; i++)
3940 {
3941 const dyesub_stringitem_t *m = &(mlist->item[i]);
3942 stp_string_list_add_string(description->bounds.str,
3943 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
3944 }
3945 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
3946 description->is_active = 1;
3947 }
3948 else
3949 {
3950 return 0;
3951 }
3952 return 1;
3953 }
3954
3955 static int kodak6900_parse_parameters(stp_vars_t *v)
3956 {
3957 const char *quality = stp_get_string_parameter(v, "PrintQuality");
3958 dyesub_privdata_t *pd = get_privdata(v);
3959
3960 /* No need to set global params if there's no privdata yet */
3961 if (!pd)
3962 return 1;
3963
3964 pd->privdata.k6900.quality = 0;
3965
3966 /* Parse options */
3967 if (strcmp(quality, "High") == 0) {
3968 pd->privdata.k6900.quality = 1;
3969 }
3970
3971 return 1;
3972 }
3973
3974 static void kodak_6900_printer_init(stp_vars_t *v)
3975 {
3976 dyesub_privdata_t *pd = get_privdata(v);
3977
3978 stp_zfwrite("\x01\x40\x1c\x00", 1, 4, v); /* Header */
3979 stp_putc(0, v); /* Job ID */
3980 stp_put16_le(pd->copies, v); /* Copies */
3981 stp_put16_le(pd->w_size, v); /* Columns */
3982 stp_put16_le(pd->h_size, v); /* Rows */
3983
3984 int media = 0;
3985 int overcoat = ((const char*)((pd->overcoat->seq).data))[0];
3986
3987 overcoat |= (pd->privdata.k6900.quality ? 0x08 : 0);
3988
3989 if (strcmp(pd->pagesize,"w144h432") == 0)
3990 media = 0x02;
3991 else if (strcmp(pd->pagesize,"w216h432") == 0)
3992 media = 0x02;
3993 else if (strcmp(pd->pagesize,"w288h432") == 0)
3994 media = 0x04;
3995 else if (strcmp(pd->pagesize,"B7") == 0)
3996 media = 0x01;
3997 else if (strcmp(pd->pagesize,"w360h504") == 0)
3998 media = 0x01;
3999 else if (strcmp(pd->pagesize,"w432h432") == 0)
4000 media = 0x00;
4001 else if (strcmp(pd->pagesize,"w432h576") == 0)
4002 media = 0x00;
4003 else
4004 media = 0x04;
4005
4006 stp_putc(media, v); /* Media Type */
4007 dyesub_nputc(v, 0, 7); /* Reserved */
4008 stp_putc(overcoat, v); /* Options */
4009 stp_putc(0, v); /* Method XXX Multicut? */
4010 dyesub_nputc(v, 0, 11); /* Reserved */
4011 }
4012
4013 /* Kodak 7000/7010 */
4014 static const dyesub_pagesize_t kodak_7000_page[] =
4015 {
4016 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1240,300), PT(1844,300), DYESUB_LANDSCAPE), /* 4x6 */
4017 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1836,300), PT(1844,300), DYESUB_LANDSCAPE), /* 4x6 */
4018 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1844,300), PT(2434,300), DYESUB_PORTRAIT), /* 6x8 */
4019 };
4020
4021 LIST(dyesub_pagesize_list_t, kodak_7000_page_list, dyesub_pagesize_t, kodak_7000_page);
4022
4023 static const dyesub_printsize_t kodak_7000_printsize[] =
4024 {
4025 { "300x300", "w288h432", 1240, 1844},
4026 { "300x300", "w432h432", 1836, 1844},
4027 { "300x300", "w432h576", 1844, 2434},
4028 };
4029
4030 LIST(dyesub_printsize_list_t, kodak_7000_printsize_list, dyesub_printsize_t, kodak_7000_printsize);
4031
4032 static void kodak_70xx_printer_init(stp_vars_t *v)
4033 {
4034 dyesub_privdata_t *pd = get_privdata(v);
4035
4036 stp_zfwrite("\x01\x40\x0a\x00\x01", 1, 5, v);
4037 stp_put16_le(pd->copies, v);
4038 stp_put16_le(pd->w_size, v);
4039 stp_put16_le(pd->h_size, v);
4040
4041 if (!strcmp(pd->pagesize,"w288h432"))
4042 stp_putc(0x01, v);
4043 else if (!strcmp(pd->pagesize,"w432h432"))
4044 stp_putc(0x0e, v);
4045 else if (!strcmp(pd->pagesize,"w432h576"))
4046 stp_putc(0x03, v);
4047 else if (!strcmp(pd->pagesize,"w360h540"))
4048 stp_putc(0x09, v);
4049 else if (!strcmp(pd->pagesize,"w360h504"))
4050 stp_putc(0x06, v);
4051 else if (!strcmp(pd->pagesize,"w360h360"))
4052 stp_putc(0x08, v);
4053 else if (!strcmp(pd->pagesize,"w288h360"))
4054 stp_putc(0x07, v);
4055 else if (!strcmp(pd->pagesize,"B7"))
4056 stp_putc(0x0d, v);
4057 else
4058 stp_putc(0x01, v);
4059
4060 stp_zfwrite((pd->overcoat->seq).data, 1,
4061 (pd->overcoat->seq).bytes, v);
4062 stp_putc(0x00, v);
4063 }
4064
4065 /* Kodak 7015 */
4066 static const dyesub_pagesize_t kodak_7015_page[] =
4067 {
4068 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1086,300), PT(1548,300), DYESUB_LANDSCAPE), /* 3.5x5 */
4069 DEFINE_PAPER_SIMPLE( "w288h360", "4x5", PT(1240,300), PT(1548,300), DYESUB_LANDSCAPE), /* 4x5 */
4070 DEFINE_PAPER_SIMPLE( "w360h360", "5x5", PT(1536,300), PT(1548,300), DYESUB_LANDSCAPE), /* 5x5 */
4071 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1548,300), PT(2140,300), DYESUB_PORTRAIT), /* 5x7 */
4072 DEFINE_PAPER_SIMPLE( "w360h540", "5x7.5", PT(1548,300), PT(2288,300), DYESUB_PORTRAIT), /* 5x7.6 */
4073 };
4074
4075 LIST(dyesub_pagesize_list_t, kodak_7015_page_list, dyesub_pagesize_t, kodak_7015_page);
4076
4077 static const dyesub_printsize_t kodak_7015_printsize[] =
4078 {
4079 { "300x300", "B7", 1086, 1548},
4080 { "300x300", "w288h360", 1240, 1548},
4081 { "300x300", "w360h360", 1536, 1548},
4082 { "300x300", "w360h504", 1548, 2140},
4083 { "300x300", "w360h540", 1548, 2288},
4084 };
4085
4086 LIST(dyesub_printsize_list_t, kodak_7015_printsize_list, dyesub_printsize_t, kodak_7015_printsize);
4087
4088 /* Kodak Professional 8500 */
4089 static const dyesub_pagesize_t kodak_8500_page[] =
4090 {
4091 DEFINE_PAPER_SIMPLE( "w612h864", "8.5x12", PT(2508,314), PT(3134,314), DYESUB_PORTRAIT), /* 8.5x12 & A4 */
4092 DEFINE_PAPER_SIMPLE( "Letter", "8.5x11", PT(2508,314), PT(2954,314), DYESUB_PORTRAIT), /* Letter */
4093 };
4094
4095 LIST(dyesub_pagesize_list_t, kodak_8500_page_list, dyesub_pagesize_t, kodak_8500_page);
4096
4097 static const dyesub_printsize_t kodak_8500_printsize[] =
4098 {
4099 { "314x314", "w612h864", 2508, 3134},
4100 { "314x314", "Letter", 2508, 2954},
4101 };
4102
4103 LIST(dyesub_printsize_list_t, kodak_8500_printsize_list, dyesub_printsize_t, kodak_8500_printsize);
4104
4105 static const dyesub_media_t kodak_8500_media[] =
4106 {
4107 { "Glossy", N_("Glossy"), {1, "\x00"}},
4108 { "Matte", N_("Matte"), {1, "\x01"}},
4109 };
4110 LIST(dyesub_media_list_t, kodak_8500_media_list, dyesub_media_t, kodak_8500_media);
4111
4112 static const overcoat_t kodak_8500_overcoat[] =
4113 {
4114 {"Coated", N_("Coated"), {1, "\x00"}},
4115 {"None", N_("None"), {1, "\x02"}},
4116 };
4117
4118 LIST(overcoat_list_t, kodak_8500_overcoat_list, overcoat_t, kodak_8500_overcoat);
4119
4120 static const stp_parameter_t kodak_8500_parameters[] =
4121 {
4122 {
4123 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
4124 N_("Sharpening to apply to image (-5 through +5)"),
4125 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
4126 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
4127 },
4128 {
4129 "MatteIntensity", N_("Matte Intensity"), "Color=No,Category=Advanced Printer Setup",
4130 N_("Strength of matte lamination pattern (-5 through +5)"),
4131 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
4132 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
4133 },
4134 };
4135 #define kodak_8500_parameter_count (sizeof(kodak_8500_parameters) / sizeof(const stp_parameter_t))
4136
4137 static int
4138 kodak_8500_load_parameters(const stp_vars_t *v, const char *name,
4139 stp_parameter_t *description)
4140 {
4141 unsigned int i;
4142 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
4143 stp_get_model_id(v));
4144
4145 if (caps->parameter_count && caps->parameters)
4146 {
4147 for (i = 0; i < caps->parameter_count; i++)
4148 if (strcmp(name, caps->parameters[i].name) == 0)
4149 {
4150 stp_fill_parameter_settings(description, &(caps->parameters[i]));
4151 break;
4152 }
4153 }
4154
4155 if (strcmp(name, "Sharpen") == 0)
4156 {
4157 description->deflt.integer = 0;
4158 description->bounds.integer.lower = -5;
4159 description->bounds.integer.upper = 5;
4160 description->is_active = 1;
4161 }
4162 else if (strcmp(name, "MatteIntensity") == 0)
4163 {
4164 description->deflt.integer = 0;
4165 description->bounds.integer.lower = -5;
4166 description->bounds.integer.upper = 5;
4167 description->is_active = 1;
4168 }
4169 else
4170 {
4171 return 0;
4172 }
4173 return 1;
4174 }
4175
4176 static int kodak_8500_parse_parameters(stp_vars_t *v)
4177 {
4178 dyesub_privdata_t *pd = get_privdata(v);
4179
4180 /* No need to set global params if there's no privdata yet */
4181 if (!pd)
4182 return 1;
4183
4184 /* Parse options */
4185 pd->privdata.k8500.sharpen = stp_get_int_parameter(v, "Sharpen");
4186 pd->privdata.k8500.matte_intensity = stp_get_int_parameter(v, "MatteIntensity");
4187
4188 return 1;
4189 }
4190
4191 static void kodak_8500_printer_init(stp_vars_t *v)
4192 {
4193 dyesub_privdata_t *pd = get_privdata(v);
4194
4195 /* Start with NULL block */
4196 dyesub_nputc(v, 0x00, 64);
4197 /* Number of copies */
4198 stp_putc(0x1b, v);
4199 stp_putc(0x4e, v);
4200 stp_putc(pd->copies > 50 ? 50 : pd->copies, v); /* 1-50 */
4201 dyesub_nputc(v, 0x00, 61);
4202 /* Paper type. Fixed. */
4203 stp_putc(0x1b, v);
4204 stp_putc(0x5a, v);
4205 stp_putc(0x46, v);
4206 stp_putc(0x00, v); /* Fixed */
4207 dyesub_nputc(v, 0x00, 60);
4208 /* Print dimensions */
4209 stp_putc(0x1b, v);
4210 stp_putc(0x5a, v);
4211 stp_putc(0x53, v);
4212 stp_put16_be(pd->w_size, v);
4213 stp_put16_be(pd->h_size, v);
4214 dyesub_nputc(v, 0x00, 57);
4215 /* Sharpening */
4216 stp_putc(0x1b, v);
4217 stp_putc(0x46, v);
4218 stp_putc(0x50, v);
4219 stp_putc(pd->privdata.k8500.sharpen, v);
4220 dyesub_nputc(v, 0x00, 60);
4221 /* Lamination */
4222 stp_putc(0x1b, v);
4223 stp_putc(0x59, v);
4224 if (*((const char*)((pd->overcoat->seq).data)) == 0x02) { /* No lamination */
4225 stp_putc(0x02, v);
4226 stp_putc(0x00, v);
4227 } else {
4228 stp_zfwrite((const char*)((pd->media->seq).data), 1,
4229 (pd->media->seq).bytes, v);
4230 if (*((const char*)((pd->media->seq).data)) == 0x01) { /* Matte */
4231 stp_putc(pd->privdata.k8500.matte_intensity, v);
4232 } else {
4233 stp_putc(0x00, v);
4234 }
4235 }
4236 dyesub_nputc(v, 0x00, 60);
4237 /* Unknown */
4238 stp_putc(0x1b, v);
4239 stp_putc(0x46, v);
4240 stp_putc(0x47, v);
4241 dyesub_nputc(v, 0x00, 61);
4242
4243 /* Data header */
4244 stp_putc(0x1b, v);
4245 stp_putc(0x5a, v);
4246 stp_putc(0x54, v);
4247 dyesub_nputc(v, 0x00, 2);
4248 stp_put16_be(0, v); /* Starting row for this block */
4249 stp_put16_be(pd->w_size, v);
4250 stp_put16_be(pd->h_size, v); /* Number of rows in this block */
4251 dyesub_nputc(v, 0x00, 53);
4252 }
4253
4254 static void kodak_8500_printer_end(stp_vars_t *v)
4255 {
4256 dyesub_privdata_t *pd = get_privdata(v);
4257
4258 /* Pad data to 64-byte block */
4259 unsigned int length = pd->w_size * pd->h_size * 3;
4260 length %= 64;
4261 if (length) {
4262 length = 64 - length;
4263 dyesub_nputc(v, 0x00, length);
4264 }
4265
4266 /* Page Footer */
4267 stp_putc(0x1b, v);
4268 stp_putc(0x50, v);
4269 dyesub_nputc(v, 0x00, 62);
4270 }
4271
4272 /* Mitsubishi P95D/DW */
4273 static const dyesub_pagesize_t mitsu_p95d_page[] =
4274 {
4275 DEFINE_PAPER_SIMPLE( "w213h284", "1280x960", PT(960,325), PT(1280,325), DYESUB_LANDSCAPE),
4276 DEFINE_PAPER_SIMPLE( "w227h284", "1280x1024", PT(1024,325), PT(1280,325), DYESUB_LANDSCAPE),
4277 DEFINE_PAPER_SIMPLE( "w284h284", "1280x1280", PT(1280,325), PT(1280,325), DYESUB_PORTRAIT),
4278 DEFINE_PAPER_SIMPLE( "w284h426", "1280x1920", PT(1280,325), PT(1920,325), DYESUB_PORTRAIT),
4279 DEFINE_PAPER_SIMPLE( "w284h1277", "1280x5760", PT(1280,325), PT(5760,325), DYESUB_PORTRAIT),
4280 /* A true "custom" size, printer will cut at the image boundary */
4281 DEFINE_PAPER_SIMPLE( "Custom", "Custom", PT(1280,325), -1, DYESUB_PORTRAIT),
4282 };
4283
4284 LIST(dyesub_pagesize_list_t, mitsu_p95d_page_list, dyesub_pagesize_t, mitsu_p95d_page);
4285
4286 static const dyesub_printsize_t mitsu_p95d_printsize[] =
4287 {
4288 { "325x325", "w213h284", 960, 1280},
4289 { "325x325", "w227h284", 1024, 1280},
4290 { "325x325", "w284h284", 1280, 1280},
4291 { "325x325", "w284h426", 1280, 1920},
4292 { "325x325", "w284h1277", 1280, 5760},
4293 { "325x325", "Custom", 1280, 5760}, /* Maximum */
4294 };
4295
4296 LIST(dyesub_printsize_list_t, mitsu_p95d_printsize_list, dyesub_printsize_t, mitsu_p95d_printsize);
4297
4298 static const dyesub_media_t mitsu_p95d_medias[] =
4299 {
4300 {"Standard", N_("Standard (KP61B)"), {1, "\x00"}},
4301 {"HighDensity", N_("High Density (KP65HM)"), {1, "\x01"}},
4302 {"HighGlossy", N_("High Glossy (KP91HG)"), {1, "\x02"}},
4303 {"HighGlossyK95HG", N_("High Glosy (K95HG)"), {1, "\x03"}},
4304 };
4305
4306 LIST(dyesub_media_list_t, mitsu_p95d_media_list, dyesub_media_t, mitsu_p95d_medias);
4307
4308 static const dyesub_stringitem_t mitsu_p95d_gammas[] =
4309 {
4310 { "Printer", N_ ("Printer-Defined Setting") },
4311 { "T1", N_ ("Table 1") },
4312 { "T2", N_ ("Table 2") },
4313 { "T3", N_ ("Table 3") },
4314 { "T4", N_ ("Table 4") },
4315 { "T5", N_ ("Table 5") },
4316 { "LUT", N_ ("Use LUT") },
4317 };
4318 LIST(dyesub_stringlist_t, mitsu_p95d_gamma_list, dyesub_stringitem_t, mitsu_p95d_gammas);
4319
4320 static const dyesub_stringitem_t mitsu_p95d_buzzers[] =
4321 {
4322 { "Off", N_ ("Off") },
4323 { "Low", N_ ("Low") },
4324 { "High", N_ ("High") },
4325 };
4326 LIST(dyesub_stringlist_t, mitsu_p95d_buzzer_list, dyesub_stringitem_t, mitsu_p95d_buzzers);
4327
4328 static const dyesub_stringitem_t mitsu_p95d_cutters[] =
4329 {
4330 { "PaperSave", N_ ("Paper Save") },
4331 { "4mm", N_ ("4mm") },
4332 { "5mm", N_ ("5mm") },
4333 { "6mm", N_ ("6mm") },
4334 { "7mm", N_ ("7mm") },
4335 { "8mm", N_ ("8mm") },
4336 };
4337 LIST(dyesub_stringlist_t, mitsu_p95d_cutter_list, dyesub_stringitem_t, mitsu_p95d_cutters);
4338
4339 static const dyesub_stringitem_t mitsu_p95d_comments[] =
4340 {
4341 { "Off", N_ ("Off") },
4342 { "Settings", N_ ("Printer Settings") },
4343 { "Date", N_ ("Date") },
4344 { "DateTime", N_ ("Date and Time") },
4345 };
4346 LIST(dyesub_stringlist_t, mitsu_p95d_comment_list, dyesub_stringitem_t, mitsu_p95d_comments);
4347
4348 static const stp_parameter_t mitsu_p95d_parameters[] =
4349 {
4350 {
4351 "P95Gamma", N_("Printer Gamma Correction"), "Color=No,Category=Advanced Printer Setup",
4352 N_("Printer Gamma Correction"),
4353 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
4354 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4355 },
4356 {
4357 "Buzzer", N_("Printer Buzzer"), "Color=No,Category=Advanced Printer Setup",
4358 N_("Printer Buzzer"),
4359 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
4360 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4361 },
4362 {
4363 "MediaCut", N_("Media Cut Length"), "Color=No,Category=Advanced Printer Setup",
4364 N_("Media Cut Length"),
4365 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
4366 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4367 },
4368 {
4369 "Comment", N_("Generate Comment"), "Color=No,Category=Advanced Printer Setup",
4370 N_("Generate Comment"),
4371 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
4372 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4373 },
4374 {
4375 "ClearMemory", N_("Clear Memory"), "Color=No,Category=Advanced Printer Setup",
4376 N_("Clear Memory"),
4377 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
4378 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4379 },
4380 {
4381 "ContinuousPrint", N_("Continuous Printing"), "Color=No,Category=Advanced Printer Setup",
4382 N_("Continuous Printing"),
4383 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
4384 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4385 },
4386 {
4387 "P95Brightness", N_("Brightness"), "Color=No,Category=Advanced Printer Setup",
4388 N_("Printer Brightness Adjustment"),
4389 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
4390 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4391 },
4392 {
4393 "P95Contrast", N_("Contrast"), "Color=No,Category=Advanced Printer Setup",
4394 N_("Printer Contrast Adjustment"),
4395 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
4396 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4397 },
4398 {
4399 "UserComment", N_("User Comment"), "Color=No,Category=Advanced Printer Setup",
4400 N_("User-specified comment (0-34 characters from 0x20->0x7E), null terminated if under 34 characters long"),
4401 STP_PARAMETER_TYPE_RAW, STP_PARAMETER_CLASS_FEATURE,
4402 STP_PARAMETER_LEVEL_ADVANCED, 0, 1, STP_CHANNEL_NONE, 1, 0
4403 },
4404 {
4405 "UserLUT", N_("User LUT"), "Color=No,Category=Advanced Printer Setup",
4406 N_("User-specified Lookup Table, must be exactly 34 bytes in long"),
4407 STP_PARAMETER_TYPE_RAW, STP_PARAMETER_CLASS_FEATURE,
4408 STP_PARAMETER_LEVEL_ADVANCED, 0, 1, STP_CHANNEL_NONE, 1, 0
4409 },
4410 };
4411 #define mitsu_p95d_parameter_count (sizeof(mitsu_p95d_parameters) / sizeof(const stp_parameter_t))
4412
4413 static int
4414 mitsu_p95d_load_parameters(const stp_vars_t *v, const char *name,
4415 stp_parameter_t *description)
4416 {
4417 unsigned int i;
4418 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
4419 stp_get_model_id(v));
4420
4421 if (caps->parameter_count && caps->parameters)
4422 {
4423 for (i = 0; i < caps->parameter_count; i++)
4424 if (strcmp(name, caps->parameters[i].name) == 0)
4425 {
4426 stp_fill_parameter_settings(description, &(caps->parameters[i]));
4427 break;
4428 }
4429 }
4430
4431 if (strcmp(name, "P95Gamma") == 0)
4432 {
4433 description->bounds.str = stp_string_list_create();
4434
4435 const dyesub_stringlist_t *mlist = &mitsu_p95d_gamma_list;
4436 for (i = 0; i < mlist->n_items; i++)
4437 {
4438 const dyesub_stringitem_t *m = &(mlist->item[i]);
4439 stp_string_list_add_string(description->bounds.str,
4440 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
4441 }
4442 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
4443 description->is_active = 1;
4444 } else if (strcmp(name, "Buzzer") == 0) {
4445 description->bounds.str = stp_string_list_create();
4446
4447 const dyesub_stringlist_t *mlist = &mitsu_p95d_buzzer_list;
4448 for (i = 0; i < mlist->n_items; i++)
4449 {
4450 const dyesub_stringitem_t *m = &(mlist->item[i]);
4451 stp_string_list_add_string(description->bounds.str,
4452 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
4453 }
4454 description->deflt.str = stp_string_list_param(description->bounds.str, 2)->name;
4455 description->is_active = 1;
4456 } else if (strcmp(name, "MediaCut") == 0) {
4457 description->bounds.str = stp_string_list_create();
4458
4459 const dyesub_stringlist_t *mlist = &mitsu_p95d_cutter_list;
4460 for (i = 0; i < mlist->n_items; i++)
4461 {
4462 const dyesub_stringitem_t *m = &(mlist->item[i]);
4463 stp_string_list_add_string(description->bounds.str,
4464 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
4465 }
4466 description->deflt.str = stp_string_list_param(description->bounds.str, 2)->name;
4467 description->is_active = 1;
4468 } else if (strcmp(name, "Comment") == 0) {
4469 description->bounds.str = stp_string_list_create();
4470
4471 const dyesub_stringlist_t *mlist = &mitsu_p95d_comment_list;
4472 for (i = 0; i < mlist->n_items; i++)
4473 {
4474 const dyesub_stringitem_t *m = &(mlist->item[i]);
4475 stp_string_list_add_string(description->bounds.str,
4476 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
4477 }
4478 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
4479 description->is_active = 1;
4480 } else if (strcmp(name, "ClearMemory") == 0) {
4481 description->is_active = 1;
4482 description->deflt.boolean = 0;
4483 } else if (strcmp(name, "ContinuousPrint") == 0) {
4484 description->is_active = 1;
4485 description->deflt.boolean = 0;
4486 } else if (strcmp(name, "P95Brightness") == 0) {
4487 description->deflt.integer = 0;
4488 description->bounds.integer.lower = -127;
4489 description->bounds.integer.upper = 127;
4490 description->is_active = 1;
4491 } else if (strcmp(name, "P95Contrast") == 0) {
4492 description->deflt.integer = 0;
4493 description->bounds.integer.lower = -127;
4494 description->bounds.integer.upper = 127;
4495 description->is_active = 1;
4496 } else if (strcmp(name, "UserComment") == 0) {
4497 description->is_active = 1;
4498 } else if (strcmp(name, "UserLUT") == 0) {
4499 description->is_active = 1;
4500 }
4501 else
4502 {
4503 return 0;
4504 }
4505 return 1;
4506 }
4507
4508 static const char *p95d_lut = "\x00\x12\x01\x5e\x03\x52\x05\xdc\x08\x66\x0a\x96\x0c\x3a\x0d\x70\x0e\x42\x0e\xce\x0f\x32\x0f\x78\x0f\xa0\x0f\xb4\x0f\xc8\x0f\xd8\x0f\xff"; /* Taken from "P95D.lut" dated 2016-05-25 */
4509
4510 static int mitsu_p95d_parse_parameters(stp_vars_t *v)
4511 {
4512 dyesub_privdata_t *pd = get_privdata(v);
4513 const char *gamma = stp_get_string_parameter(v, "P95Gamma");
4514 const char *buzzer = stp_get_string_parameter(v, "Buzzer");
4515 const char *cutter = stp_get_string_parameter(v, "MediaCut");
4516 const char *comment = stp_get_string_parameter(v, "Comment");
4517 const stp_raw_t *usercomment = NULL;
4518 const stp_raw_t *userlut = NULL;
4519
4520 /* Sanity check */
4521 if (stp_check_raw_parameter(v, "UserComment", STP_PARAMETER_ACTIVE)) {
4522 usercomment = stp_get_raw_parameter(v, "UserComment");
4523 if (usercomment->bytes > 34) {
4524 stp_eprintf(v, _("StpUserComment must be between 0 and 34 bytes!\n"));
4525 return 0;
4526 }
4527 }
4528
4529 if (stp_check_raw_parameter(v, "UserLUT", STP_PARAMETER_ACTIVE)) {
4530 userlut = stp_get_raw_parameter(v, "UserLUT");
4531 if (usercomment->bytes != 34) {
4532 stp_eprintf(v, _("StpUserLUT must be exactly 34 bytes!\n"));
4533 return 0;
4534 }
4535 }
4536
4537 /* No need to set global params if there's no privdata yet */
4538 if (!pd)
4539 return 1;
4540
4541 /* Parse options */
4542 pd->privdata.m95d.clear_mem = stp_get_boolean_parameter(v, "ClearMemory");
4543 pd->privdata.m95d.cont_print = stp_get_boolean_parameter(v, "ContinuousPrint");
4544
4545 if (pd->copies > 200)
4546 pd->copies = 200;
4547
4548 pd->privdata.m95d.brightness = stp_get_int_parameter(v, "P95Brightness");
4549 pd->privdata.m95d.contrast = stp_get_int_parameter(v, "P95Contrast");
4550
4551 if (!strcmp(gamma, "Printer")) {
4552 pd->privdata.m95d.gamma = 0x00;
4553 } else if (!strcmp(gamma, "T1")) {
4554 pd->privdata.m95d.gamma = 0x01;
4555 } else if (!strcmp(gamma, "T2")) {
4556 pd->privdata.m95d.gamma = 0x02;
4557 } else if (!strcmp(gamma, "T3")) {
4558 pd->privdata.m95d.gamma = 0x03;
4559 } else if (!strcmp(gamma, "T4")) {
4560 pd->privdata.m95d.gamma = 0x04;
4561 } else if (!strcmp(gamma, "T5")) {
4562 pd->privdata.m95d.gamma = 0x05;
4563 } else if (!strcmp(gamma, "LUT")) {
4564 pd->privdata.m95d.gamma = 0x10;
4565 }
4566
4567 if (!strcmp(buzzer, "Off")) {
4568 pd->privdata.m95d.flags |= 0x00;
4569 } else if (!strcmp(buzzer, "Low")) {
4570 pd->privdata.m95d.flags |= 0x02;
4571 } else if (!strcmp(buzzer, "High")) {
4572 pd->privdata.m95d.flags |= 0x03;
4573 }
4574
4575 if (!strcmp(cutter, "PaperSave")) {
4576 pd->privdata.m95d.flags |= 0x54;
4577 } else if (!strcmp(cutter, "4mm")) {
4578 pd->privdata.m95d.flags |= 0x40;
4579 } else if (!strcmp(cutter, "5mm")) {
4580 pd->privdata.m95d.flags |= 0x50;
4581 } else if (!strcmp(cutter, "6mm")) {
4582 pd->privdata.m95d.flags |= 0x60;
4583 } else if (!strcmp(cutter, "7mm")) {
4584 pd->privdata.m95d.flags |= 0x70;
4585 } else if (!strcmp(cutter, "8mm")) {
4586 pd->privdata.m95d.flags |= 0x80;
4587 }
4588
4589 if (!strcmp(comment, "Off")) {
4590 memset(pd->privdata.m95d.commentbuf, 0, sizeof(pd->privdata.m95d.commentbuf));
4591 pd->privdata.m95d.comment = 0;
4592 } else if (!strcmp(comment, "Settings")) {
4593 memset(pd->privdata.m95d.commentbuf, 0, sizeof(pd->privdata.m95d.commentbuf));
4594 pd->privdata.m95d.comment = 1;
4595 } else if (!strcmp(comment, "Date")) {
4596 struct tm tmp;
4597 time_t t;
4598 t = stpi_time(NULL);
4599 localtime_r(&t, &tmp);
4600 strftime(pd->privdata.m95d.commentbuf, sizeof(pd->privdata.m95d.commentbuf), " %F", &tmp);
4601 pd->privdata.m95d.comment = 2;
4602 } else if (!strcmp(comment, "DateTime")) {
4603 struct tm tmp;
4604 time_t t;
4605 t = stpi_time(NULL);
4606 localtime_r(&t, &tmp);
4607 strftime(pd->privdata.m95d.commentbuf, sizeof(pd->privdata.m95d.commentbuf), " %F %R", &tmp);
4608 pd->privdata.m95d.comment = 3;
4609 }
4610
4611 if (usercomment) {
4612 if (strncmp("None", usercomment->data, usercomment->bytes)) {
4613 unsigned int i;
4614 memcpy(pd->privdata.m95d.usercomment, usercomment->data, usercomment->bytes);
4615 if (usercomment->bytes < 34)
4616 pd->privdata.m95d.usercomment[usercomment->bytes] = 0;
4617 for (i = 0 ; i < usercomment->bytes ; i++) {
4618 if (pd->privdata.m95d.usercomment[i] < 0x20 ||
4619 (unsigned int)pd->privdata.m95d.usercomment[i] > 0x7F)
4620 pd->privdata.m95d.usercomment[i] = 0x20;
4621 }
4622 }
4623 } else {
4624 memset(pd->privdata.m95d.usercomment, 0x20, sizeof(pd->privdata.m95d.usercomment));
4625 }
4626
4627 if (userlut) {
4628 memcpy(pd->privdata.m95d.userlut, userlut->data, userlut->bytes);
4629 } else {
4630 memcpy(pd->privdata.m95d.userlut, p95d_lut, sizeof(pd->privdata.m95d.userlut));
4631 }
4632
4633 return 1;
4634 }
4635
4636 static void mitsu_p95d_printer_init(stp_vars_t *v)
4637 {
4638 dyesub_privdata_t *pd = get_privdata(v);
4639
4640 /* Header */
4641 stp_putc(0x1b, v);
4642 stp_putc(0x51, v);
4643
4644 /* Clear memory */
4645 if (pd->privdata.m95d.clear_mem) {
4646 stp_putc(0x1b, v);
4647 stp_putc(0x5a, v);
4648 stp_putc(0x43, v);
4649 stp_putc(0x00, v);
4650 }
4651
4652 /* Page Setup */
4653 stp_putc(0x1b, v);
4654 stp_putc(0x57, v);
4655 stp_putc(0x20, v);
4656 stp_putc(0x2e, v);
4657 stp_putc(0x00, v);
4658 stp_putc(0x0a, v);
4659 stp_putc(0x00, v);
4660 stp_putc(0x02, v);
4661 dyesub_nputc(v, 0x00, 6);
4662 stp_put16_be(pd->w_size, v); /* Columns */
4663 stp_put16_be(pd->h_size, v); /* Rows */
4664
4665 /* This is only set under Windows if a "custom" size is selected,
4666 but the USB comms always show it set to 1... */
4667 if (!strcmp(pd->pagesize,"Custom"))
4668 stp_putc(0x01, v);
4669 else
4670 stp_putc(0x00, v);
4671 dyesub_nputc(v, 0x00, 31);
4672
4673 /* Print Options */
4674 stp_putc(0x1b, v);
4675 stp_putc(0x57, v);
4676 stp_putc(0x21, v);
4677 stp_putc(0x2e, v);
4678 stp_putc(0x00, v);
4679 stp_putc(0x4a, v);
4680 stp_putc(0xaa, v);
4681 stp_putc(0x00, v);
4682 stp_putc(0x20, v);
4683 stp_zfwrite((pd->media->seq).data, 1, 1, v); /* Media Type */
4684 stp_putc(0x00, v);
4685 stp_putc(0x00, v);
4686 stp_putc(0x64, v);
4687 if (pd->privdata.m95d.cont_print)
4688 stp_putc(0xff, v);
4689 else
4690 stp_putc(pd->copies, v);
4691 stp_putc(0x00, v);
4692 stp_putc(pd->privdata.m95d.comment, v);
4693 stp_zfwrite(pd->privdata.m95d.commentbuf, 1, sizeof(pd->privdata.m95d.commentbuf) -1, v);
4694 dyesub_nputc(v, 0x00, 3);
4695 stp_putc(0x02, v);
4696 dyesub_nputc(v, 0x00, 11);
4697 stp_putc(pd->privdata.m95d.flags, v);
4698
4699 /* Gamma */
4700 stp_putc(0x1b, v);
4701 stp_putc(0x57, v);
4702 stp_putc(0x22, v);
4703 stp_putc(0x2e, v);
4704 stp_putc(0x00, v);
4705 stp_putc(0x15, v);
4706 if (pd->privdata.m95d.gamma == 0x10)
4707 stp_putc(0x01, v);
4708 else
4709 stp_putc(0x00, v);
4710 dyesub_nputc(v, 0x00, 5);
4711 stp_putc(pd->privdata.m95d.gamma, v);
4712 stp_putc(pd->privdata.m95d.brightness, v);
4713 stp_putc(pd->privdata.m95d.contrast, v);
4714 stp_putc(0x00, v);
4715
4716 if (pd->privdata.m95d.gamma == 0x10) {
4717 stp_zfwrite(pd->privdata.m95d.userlut, 1, sizeof(pd->privdata.m95d.userlut), v); /* XXX only for K95HG? */
4718 } else {
4719 dyesub_nputc(v, 0x00, 34);
4720 }
4721
4722 /* User Comment */
4723 stp_putc(0x1b, v);
4724 stp_putc(0x58, v);
4725 stp_zfwrite(pd->privdata.m95d.usercomment, 1, sizeof(pd->privdata.m95d.usercomment) - 6, v); /* 34 on P95, 40 on P93 */
4726 }
4727
4728 static void mitsu_p95d_plane_start(stp_vars_t *v)
4729 {
4730 dyesub_privdata_t *pd = get_privdata(v);
4731
4732 /* Plane header */
4733 stp_putc(0x1b, v);
4734 stp_putc(0x5a, v);
4735 stp_putc(0x74, v);
4736 stp_putc(0x00, v);
4737 stp_put16_be(0, v); /* Column Offset */
4738 stp_put16_be(0, v); /* Row Offset */
4739 stp_put16_be(pd->w_size, v); /* Columns */
4740 stp_put16_be(pd->h_size, v); /* Rows */
4741 }
4742
4743 static void mitsu_p95d_printer_end(stp_vars_t *v)
4744 {
4745 /* Kick off the actual print */
4746 stp_putc(0x1b, v);
4747 stp_putc(0x50, v);
4748 }
4749
4750 /* Mitsubishi P93D/DW */
4751
4752 static const dyesub_media_t mitsu_p93d_medias[] =
4753 {
4754 {"Standard", N_("Standard (KP61B)"), {1, "\x02"}},
4755 {"HighDensity", N_("High Density (KP65HM)"), {1, "\x00"}},
4756 {"HighGlossy", N_("High Glossy (KP91HG)"), {1, "\x01"}},
4757 };
4758
4759 LIST(dyesub_media_list_t, mitsu_p93d_media_list, dyesub_media_t, mitsu_p93d_medias);
4760
4761 static const dyesub_stringitem_t mitsu_p93d_gammas[] =
4762 {
4763 { "T1", N_ ("Table 1") },
4764 { "T2", N_ ("Table 2") },
4765 { "T3", N_ ("Table 3") },
4766 { "T4", N_ ("Table 4") },
4767 { "T5", N_ ("Table 5") },
4768 };
4769 LIST(dyesub_stringlist_t, mitsu_p93d_gamma_list, dyesub_stringitem_t, mitsu_p93d_gammas);
4770
4771 static const stp_parameter_t mitsu_p93d_parameters[] =
4772 {
4773 {
4774 "P93Gamma", N_("Printer Gamma Correction"), "Color=No,Category=Advanced Printer Setup",
4775 N_("Printer Gamma Correction"),
4776 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
4777 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4778 },
4779 {
4780 "Buzzer", N_("Printer Buzzer"), "Color=No,Category=Advanced Printer Setup",
4781 N_("Printer Buzzer"),
4782 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
4783 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4784 },
4785 {
4786 "PaperSaving", N_("Paper Saving Mode"), "Color=Yes,Category=Advanced Printer Setup",
4787 N_("Paper Saving Mode"),
4788 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
4789 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
4790 },
4791 {
4792 "Comment", N_("Generate Comment"), "Color=No,Category=Advanced Printer Setup",
4793 N_("Generate Comment"),
4794 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
4795 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4796 },
4797 {
4798 "ClearMemory", N_("Clear Memory"), "Color=No,Category=Advanced Printer Setup",
4799 N_("Clear Memory"),
4800 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
4801 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4802 },
4803 {
4804 "ContinuousPrint", N_("Continuous Printing"), "Color=No,Category=Advanced Printer Setup",
4805 N_("Continuous Printing"),
4806 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
4807 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4808 },
4809 {
4810 "P93Brightness", N_("Brightness"), "Color=No,Category=Advanced Printer Setup",
4811 N_("Printer Brightness Adjustment"),
4812 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
4813 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4814 },
4815 {
4816 "P93Contrast", N_("Contrast"), "Color=No,Category=Advanced Printer Setup",
4817 N_("Printer Contrast Adjustment"),
4818 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
4819 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
4820 },
4821 {
4822 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
4823 N_("Sharpening to apply to image (0 is soft, 1 is normal, 2 is hard"),
4824 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
4825 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
4826 },
4827 {
4828 "UserComment", N_("User Comment"), "Color=No,Category=Advanced Printer Setup",
4829 N_("User-specified comment (0-40 characters from 0x20->0x7E), null terminated if under 40 characters long"),
4830 STP_PARAMETER_TYPE_RAW, STP_PARAMETER_CLASS_FEATURE,
4831 STP_PARAMETER_LEVEL_ADVANCED, 0, 1, STP_CHANNEL_NONE, 1, 0
4832 },
4833 };
4834 #define mitsu_p93d_parameter_count (sizeof(mitsu_p93d_parameters) / sizeof(const stp_parameter_t))
4835
4836 static int
4837 mitsu_p93d_load_parameters(const stp_vars_t *v, const char *name,
4838 stp_parameter_t *description)
4839 {
4840 unsigned int i;
4841 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
4842 stp_get_model_id(v));
4843
4844 if (caps->parameter_count && caps->parameters)
4845 {
4846 for (i = 0; i < caps->parameter_count; i++)
4847 if (strcmp(name, caps->parameters[i].name) == 0)
4848 {
4849 stp_fill_parameter_settings(description, &(caps->parameters[i]));
4850 break;
4851 }
4852 }
4853
4854 if (strcmp(name, "P93Gamma") == 0)
4855 {
4856 description->bounds.str = stp_string_list_create();
4857
4858 const dyesub_stringlist_t *mlist = &mitsu_p93d_gamma_list;
4859 for (i = 0; i < mlist->n_items; i++)
4860 {
4861 const dyesub_stringitem_t *m = &(mlist->item[i]);
4862 stp_string_list_add_string(description->bounds.str,
4863 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
4864 }
4865 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
4866 description->is_active = 1;
4867 } else if (strcmp(name, "Buzzer") == 0) {
4868 description->bounds.str = stp_string_list_create();
4869
4870 const dyesub_stringlist_t *mlist = &mitsu_p95d_buzzer_list;
4871 for (i = 0; i < mlist->n_items; i++)
4872 {
4873 const dyesub_stringitem_t *m = &(mlist->item[i]);
4874 stp_string_list_add_string(description->bounds.str,
4875 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
4876 }
4877 description->deflt.str = stp_string_list_param(description->bounds.str, 2)->name;
4878 description->is_active = 1;
4879 } else if (strcmp(name, "PaperSaving") == 0) {
4880 description->deflt.boolean = 0;
4881 description->is_active = 1;
4882 } else if (strcmp(name, "Comment") == 0) {
4883 description->bounds.str = stp_string_list_create();
4884
4885 const dyesub_stringlist_t *mlist = &mitsu_p95d_comment_list;
4886 for (i = 0; i < mlist->n_items; i++)
4887 {
4888 const dyesub_stringitem_t *m = &(mlist->item[i]);
4889 stp_string_list_add_string(description->bounds.str,
4890 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
4891 }
4892 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
4893 description->is_active = 1;
4894 } else if (strcmp(name, "ClearMemory") == 0) {
4895 description->is_active = 1;
4896 description->deflt.boolean = 0;
4897 } else if (strcmp(name, "ContinuousPrint") == 0) {
4898 description->is_active = 1;
4899 description->deflt.boolean = 0;
4900 } else if (strcmp(name, "P93Brightness") == 0) {
4901 description->deflt.integer = 0;
4902 description->bounds.integer.lower = -127;
4903 description->bounds.integer.upper = 127;
4904 description->is_active = 1;
4905 } else if (strcmp(name, "P93Contrast") == 0) {
4906 description->deflt.integer = 0;
4907 description->bounds.integer.lower = -127;
4908 description->bounds.integer.upper = 127;
4909 description->is_active = 1;
4910 } else if (strcmp(name, "Sharpen") == 0) {
4911 description->deflt.integer = 1;
4912 description->bounds.integer.lower = 0;
4913 description->bounds.integer.upper = 2;
4914 description->is_active = 1;
4915 } else if (strcmp(name, "UserComment") == 0) {
4916 description->is_active = 1;
4917 }
4918 else
4919 {
4920 return 0;
4921 }
4922 return 1;
4923 }
4924
4925 static int mitsu_p93d_parse_parameters(stp_vars_t *v)
4926 {
4927 dyesub_privdata_t *pd = get_privdata(v);
4928 const char *gamma = stp_get_string_parameter(v, "P93Gamma");
4929 const char *buzzer = stp_get_string_parameter(v, "Buzzer");
4930 const char *comment = stp_get_string_parameter(v, "Comment");
4931 const stp_raw_t *usercomment = NULL;
4932
4933 /* Sanity check */
4934 if (stp_check_raw_parameter(v, "UserComment", STP_PARAMETER_ACTIVE)) {
4935 usercomment = stp_get_raw_parameter(v, "UserComment");
4936 if (usercomment->bytes > 40) {
4937 stp_eprintf(v, _("StpUserComment must be between 0 and 40 bytes!\n"));
4938 return 0;
4939 }
4940 }
4941
4942 /* No need to set global params if there's no privdata yet */
4943 if (!pd)
4944 return 1;
4945
4946 /* Parse options */
4947 pd->privdata.m95d.clear_mem = stp_get_boolean_parameter(v, "ClearMemory");
4948 pd->privdata.m95d.cont_print = stp_get_boolean_parameter(v, "ContinuousPrint");
4949
4950 if (pd->copies > 200)
4951 pd->copies = 200;
4952
4953 if (!strcmp(gamma, "T1")) {
4954 pd->privdata.m95d.gamma = 0x00;
4955 } else if (!strcmp(gamma, "T2")) {
4956 pd->privdata.m95d.gamma = 0x01;
4957 } else if (!strcmp(gamma, "T3")) {
4958 pd->privdata.m95d.gamma = 0x02;
4959 } else if (!strcmp(gamma, "T4")) {
4960 pd->privdata.m95d.gamma = 0x03;
4961 } else if (!strcmp(gamma, "T5")) {
4962 pd->privdata.m95d.gamma = 0x04;
4963 }
4964
4965 if (!strcmp(buzzer, "Off")) {
4966 pd->privdata.m95d.flags |= 0x00;
4967 } else if (!strcmp(buzzer, "Low")) {
4968 pd->privdata.m95d.flags |= 0x02;
4969 } else if (!strcmp(buzzer, "High")) {
4970 pd->privdata.m95d.flags |= 0x03;
4971 }
4972
4973 pd->privdata.m95d.brightness = stp_get_int_parameter(v, "P93Brightness");
4974 pd->privdata.m95d.contrast = stp_get_int_parameter(v, "P93Contrast");
4975 pd->privdata.m95d.sharpen = stp_get_int_parameter(v, "Sharpen");
4976
4977 if (stp_get_boolean_parameter(v, "PaperSaving")) {
4978 pd->privdata.m95d.flags |= 0x04;
4979 }
4980
4981 if (!strcmp(comment, "Off")) {
4982 memset(pd->privdata.m95d.commentbuf, 0, sizeof(pd->privdata.m95d.commentbuf));
4983 pd->privdata.m95d.comment = 0;
4984 } else if (!strcmp(comment, "Settings")) {
4985 memset(pd->privdata.m95d.commentbuf, 0, sizeof(pd->privdata.m95d.commentbuf));
4986 pd->privdata.m95d.comment = 1;
4987 } else if (!strcmp(comment, "Date")) {
4988 struct tm tmp;
4989 time_t t;
4990 t = stpi_time(NULL);
4991 localtime_r(&t, &tmp);
4992 strftime(pd->privdata.m95d.commentbuf, sizeof(pd->privdata.m95d.commentbuf), " %F", &tmp);
4993 pd->privdata.m95d.comment = 2;
4994 } else if (!strcmp(comment, "DateTime")) {
4995 struct tm tmp;
4996 time_t t;
4997 t = stpi_time(NULL);
4998 localtime_r(&t, &tmp);
4999 strftime(pd->privdata.m95d.commentbuf, sizeof(pd->privdata.m95d.commentbuf), " %F %R", &tmp);
5000 pd->privdata.m95d.comment = 3;
5001 }
5002
5003 if (usercomment) {
5004 if (strncmp("None", usercomment->data, usercomment->bytes)) {
5005 unsigned int i;
5006 memcpy(pd->privdata.m95d.usercomment, usercomment->data, usercomment->bytes);
5007 if (usercomment->bytes < 40)
5008 pd->privdata.m95d.usercomment[usercomment->bytes] = 0;
5009 for (i = 0 ; i < usercomment->bytes ; i++) {
5010 if (pd->privdata.m95d.usercomment[i] < 0x20 ||
5011 (unsigned int)pd->privdata.m95d.usercomment[i] > 0x7F)
5012 pd->privdata.m95d.usercomment[i] = 0x20;
5013 }
5014 }
5015 } else {
5016 memset(pd->privdata.m95d.usercomment, 0x20, sizeof(pd->privdata.m95d.usercomment));
5017 }
5018
5019 return 1;
5020 }
5021
5022 static void mitsu_p93d_printer_init(stp_vars_t *v)
5023 {
5024 dyesub_privdata_t *pd = get_privdata(v);
5025
5026 /* Header */
5027 stp_putc(0x1b, v);
5028 stp_putc(0x51, v);
5029
5030 /* Clear memory */
5031 if (pd->privdata.m95d.clear_mem) {
5032 stp_putc(0x1b, v);
5033 stp_putc(0x5a, v);
5034 stp_putc(0x43, v);
5035 stp_putc(0x00, v);
5036 }
5037
5038 /* Page Setup */
5039 stp_putc(0x1b, v);
5040 stp_putc(0x57, v);
5041 stp_putc(0x20, v);
5042 stp_putc(0x2e, v);
5043 stp_putc(0x00, v);
5044 stp_putc(0x0a, v);
5045 dyesub_nputc(v, 0x00, 8);
5046 stp_put16_be(pd->w_size, v); /* Columns */
5047 stp_put16_be(pd->h_size, v); /* Rows */
5048
5049 /* This is only set under Windows if a "custom" size is selected,
5050 but the USB comms always show it set to 1... */
5051 if (!strcmp(pd->pagesize,"Custom"))
5052 stp_putc(0x01, v);
5053 else
5054 stp_putc(0x00, v);
5055 dyesub_nputc(v, 0x00, 31);
5056
5057 /* Print Options */
5058 stp_putc(0x1b, v);
5059 stp_putc(0x57, v);
5060 stp_putc(0x21, v);
5061 stp_putc(0x2e, v);
5062 stp_putc(0x00, v);
5063 stp_putc(0x4a, v);
5064 stp_putc(0xaa, v);
5065 stp_putc(0x00, v);
5066 stp_putc(0x00, v);
5067 stp_zfwrite((pd->media->seq).data, 1, 1, v); /* Media Type */
5068 stp_putc(0x00, v);
5069 stp_putc(0x00, v);
5070 stp_putc(0x00, v);
5071 if (pd->privdata.m95d.cont_print)
5072 stp_putc(0xff, v);
5073 else
5074 stp_putc(pd->copies, v);
5075 stp_putc(0x00, v);
5076 stp_putc(pd->privdata.m95d.comment, v);
5077 stp_zfwrite(pd->privdata.m95d.commentbuf, 1, sizeof(pd->privdata.m95d.commentbuf) -1, v);
5078 dyesub_nputc(v, 0x00, 3);
5079 stp_putc(0x02, v);
5080 dyesub_nputc(v, 0x00, 11);
5081 stp_putc(pd->privdata.m95d.flags, v);
5082
5083 /* Gamma */
5084 stp_putc(0x1b, v);
5085 stp_putc(0x57, v);
5086 stp_putc(0x22, v);
5087 stp_putc(0x2e, v);
5088 stp_putc(0x00, v);
5089 stp_putc(0xd5, v);
5090 dyesub_nputc(v, 0x00, 6);
5091
5092 stp_putc(pd->privdata.m95d.sharpen, v); // XXX
5093 stp_putc(0x00, v);
5094 stp_putc(pd->privdata.m95d.gamma, v);
5095 stp_putc(0x00, v);
5096 stp_putc(pd->privdata.m95d.brightness, v);
5097 stp_putc(0x00, v);
5098 stp_putc(pd->privdata.m95d.contrast, v);
5099 dyesub_nputc(v, 0x00, 31);
5100
5101 /* User Comment */
5102 stp_putc(0x1b, v);
5103 stp_putc(0x58, v);
5104 stp_zfwrite(pd->privdata.m95d.usercomment, 1, sizeof(pd->privdata.m95d.usercomment), v);
5105 }
5106
5107 /* Mitsubishi CP3020D/DU/DE */
5108 static const dyesub_pagesize_t mitsu_cp3020d_page[] =
5109 {
5110 DEFINE_PAPER_SIMPLE( "A4", "A4", PT(2508,314), PT(3134,314), DYESUB_PORTRAIT), /* A4 */
5111 DEFINE_PAPER_SIMPLE( "Legal", "Letter Long", PT(2508,314), PT(3762,314), DYESUB_PORTRAIT), /* Letter */
5112 };
5113
5114 LIST(dyesub_pagesize_list_t, mitsu_cp3020d_page_list, dyesub_pagesize_t, mitsu_cp3020d_page);
5115
5116 static const dyesub_printsize_t mitsu_cp3020d_printsize[] =
5117 {
5118 { "314x314", "A4", 2508, 3134},
5119 { "314x314", "Legal", 2508, 3762},
5120 };
5121
5122 LIST(dyesub_printsize_list_t, mitsu_cp3020d_printsize_list, dyesub_printsize_t, mitsu_cp3020d_printsize);
5123
5124 static void mitsu_cp3020d_printer_init(stp_vars_t *v)
5125 {
5126 dyesub_privdata_t *pd = get_privdata(v);
5127
5128 /* Start with NULL block */
5129 dyesub_nputc(v, 0x00, 64);
5130 /* Unknown */
5131 stp_putc(0x1b, v);
5132 stp_putc(0x51, v);
5133 dyesub_nputc(v, 0x00, 62);
5134 /* Paper type */
5135 stp_putc(0x1b, v);
5136 stp_putc(0x5a, v);
5137 stp_putc(0x46, v);
5138 if (pd->h_size == 3762)
5139 stp_putc(0x04, v);
5140 else
5141 stp_putc(0x00, v);
5142 dyesub_nputc(v, 0x00, 60);
5143 /* Number of copies */
5144 stp_putc(0x1b, v);
5145 stp_putc(0x4e, v);
5146 stp_putc(pd->copies > 50 ? 50 : pd->copies, v); /* 1-50 */
5147 dyesub_nputc(v, 0x00, 61);
5148 /* Unknown */
5149 stp_putc(0x1b, v);
5150 stp_putc(0x46, v);
5151 stp_putc(0x53, v);
5152 dyesub_nputc(v, 0x00, 61);
5153 /* Lamination. Fixed on. */
5154 stp_putc(0x1b, v);
5155 stp_putc(0x59, v);
5156 dyesub_nputc(v, 0x00, 62);
5157 /* High Contrast */
5158 stp_putc(0x1b, v);
5159 stp_putc(0x46, v);
5160 stp_putc(0x43, v);
5161 stp_putc(0x00, v); /* XXX or 0x01 for "High Contrast" */
5162 dyesub_nputc(v, 0x00, 60);
5163 /* Print dimensions */
5164 stp_putc(0x1b, v);
5165 stp_putc(0x5a, v);
5166 stp_putc(0x53, v);
5167 stp_put16_be(pd->w_size, v);
5168 stp_put16_be(pd->h_size, v);
5169 dyesub_nputc(v, 0x00, 57);
5170 }
5171
5172 static void mitsu_cp3020d_printer_end(stp_vars_t *v)
5173 {
5174 /* Page Footer */
5175 stp_putc(0x1b, v);
5176 stp_putc(0x50, v);
5177 dyesub_nputc(v, 0x00, 62);
5178 }
5179
5180 static void mitsu_cp3020d_plane_init(stp_vars_t *v)
5181 {
5182 dyesub_privdata_t *pd = get_privdata(v);
5183
5184 /* Plane data header */
5185 stp_putc(0x1b, v);
5186 stp_putc(0x5a, v);
5187 stp_putc(0x30 + 4 - pd->plane, v); /* Y = x31, M = x32, C = x33 */
5188 dyesub_nputc(v, 0x00, 2);
5189 stp_put16_be(0, v); /* Starting row for this block */
5190 stp_put16_be(pd->w_size, v);
5191 stp_put16_be(pd->h_size, v); /* Number of rows in this block */
5192 dyesub_nputc(v, 0x00, 53);
5193 }
5194
5195 static void mitsu_cp3020d_plane_end(stp_vars_t *v)
5196 {
5197 dyesub_privdata_t *pd = get_privdata(v);
5198 /* Pad data to 64-byte block */
5199 unsigned int length = pd->w_size * pd->h_size;
5200 length %= 64;
5201 if (length) {
5202 length = 64 - length;
5203 dyesub_nputc(v, 0x00, length);
5204 }
5205 }
5206
5207 /* Mitsubishi CP3020DA/DAE */
5208 static void mitsu_cp3020da_printer_init(stp_vars_t *v)
5209 {
5210 dyesub_privdata_t *pd = get_privdata(v);
5211
5212 /* Init */
5213 stp_putc(0x1b, v);
5214 stp_putc(0x57, v);
5215 stp_putc(0x20, v);
5216 stp_putc(0x2e, v);
5217 stp_putc(0x00, v);
5218 stp_putc(0x0a, v);
5219 stp_putc(0x10, v);
5220 dyesub_nputc(v, 0x00, 7);
5221 stp_put16_be(pd->w_size, v);
5222 stp_put16_be(pd->h_size, v);
5223 dyesub_nputc(v, 0x00, 32);
5224 /* Page count */
5225 stp_putc(0x1b, v);
5226 stp_putc(0x57, v);
5227 stp_putc(0x21, v);
5228 stp_putc(0x2e, v);
5229 stp_putc(0x00, v);
5230 stp_putc(0x80, v);
5231 stp_putc(0x00, v);
5232 stp_putc(0x20, v);
5233 stp_putc(0x00, v);
5234 stp_putc(0x02, v);
5235 dyesub_nputc(v, 0x00, 19);
5236 stp_putc(pd->copies > 50 ? 50 : pd->copies, v); /* 1-50 */
5237 dyesub_nputc(v, 0x00, 20);
5238 /* Contrast ? */
5239 stp_putc(0x1b, v);
5240 stp_putc(0x57, v);
5241 stp_putc(0x22, v);
5242 stp_putc(0x2e, v);
5243 stp_putc(0x00, v);
5244 stp_putc(0xf0, v);
5245 dyesub_nputc(v, 0x00, 4);
5246 stp_putc(0x00, v); /* x00 = Photo, x01 = High Contrast, x02 = Natural */
5247 dyesub_nputc(v, 0x00, 39);
5248 /* Unknown */
5249 stp_putc(0x1b, v);
5250 stp_putc(0x57, v);
5251 stp_putc(0x26, v);
5252 stp_putc(0x2e, v);
5253 stp_putc(0x00, v);
5254 stp_putc(0x20, v);
5255 dyesub_nputc(v, 0x00, 6);
5256 stp_putc(0x01, v);
5257 dyesub_nputc(v, 0x00, 37);
5258 }
5259
5260 static void mitsu_cp3020da_printer_end(stp_vars_t *v)
5261 {
5262 /* Page Footer */
5263 stp_putc(0x1b, v);
5264 stp_putc(0x50, v);
5265 stp_putc(0x51, v);
5266 stp_putc(0x50, v);
5267 }
5268
5269 static void mitsu_cp3020da_plane_init(stp_vars_t *v)
5270 {
5271 dyesub_privdata_t *pd = get_privdata(v);
5272
5273 /* Plane data header */
5274 stp_putc(0x1b, v);
5275 stp_putc(0x5a, v);
5276 stp_putc(0x54, v);
5277 stp_putc(0x00, v);
5278 stp_put16_be(0, v); /* Starting column for this block */
5279 stp_put16_be(0, v); /* Starting row for this block */
5280 stp_put16_be(pd->w_size, v);
5281 stp_put16_be(pd->h_size, v); /* Number of rows in this block */
5282 }
5283
5284 /* Mitsubishi 9500D/DW */
5285 static const dyesub_resolution_t res_m9500[] =
5286 {
5287 { "346x346", 346, 346},
5288 { "346x792", 346, 792},
5289 };
5290
5291 LIST(dyesub_resolution_list_t, res_m9500_list, dyesub_resolution_t, res_m9500);
5292
5293 static const dyesub_pagesize_t mitsu_cp9500_page[] =
5294 {
5295 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1240,346), PT(1812,346), DYESUB_LANDSCAPE),
5296 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1416,346), PT(2152,346), DYESUB_LANDSCAPE),
5297 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1812,346), PT(2452,346), DYESUB_PORTRAIT),
5298 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(2152,346), PT(2792,346), DYESUB_PORTRAIT),
5299 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(2152,346), PT(3146,346), DYESUB_PORTRAIT),
5300 };
5301
5302 LIST(dyesub_pagesize_list_t, mitsu_cp9500_page_list, dyesub_pagesize_t, mitsu_cp9500_page);
5303
5304 static const dyesub_printsize_t mitsu_cp9500_printsize[] =
5305 {
5306 { "346x346", "B7", 1240, 1812},
5307 { "346x792", "B7", 2480, 1812},
5308 { "346x346", "w288h432", 1416, 2152},
5309 { "346x792", "w288h432", 2832, 2152},
5310 { "346x346", "w360h504", 1812, 2452},
5311 { "346x792", "w360h504", 1812, 4904},
5312 { "346x346", "w432h576", 2152, 2792},
5313 { "346x792", "w432h576", 2152, 5584},
5314 { "346x346", "w432h648", 2152, 3146},
5315 { "346x792", "w432h648", 2152, 6292},
5316 };
5317
5318 LIST(dyesub_printsize_list_t, mitsu_cp9500_printsize_list, dyesub_printsize_t, mitsu_cp9500_printsize);
5319
5320 static void mitsu_cp9500_printer_init(stp_vars_t *v)
5321 {
5322 dyesub_privdata_t *pd = get_privdata(v);
5323
5324 /* Init */
5325 stp_putc(0x1b, v);
5326 stp_putc(0x57, v);
5327 stp_putc(0x21, v);
5328 stp_putc(0x2e, v);
5329 stp_putc(0x00, v);
5330 stp_putc(0x80, v);
5331 stp_putc(0x00, v);
5332 stp_putc(0x22, v);
5333 stp_putc(0xa8, v);
5334 stp_putc(0x03, v);
5335 dyesub_nputc(v, 0x00, 18);
5336 stp_put16_be(pd->copies, v);
5337 dyesub_nputc(v, 0x00, 19);
5338 stp_putc(0x01, v);
5339 /* Parameters 1 */
5340 stp_putc(0x1b, v);
5341 stp_putc(0x57, v);
5342 stp_putc(0x20, v);
5343 stp_putc(0x2e, v);
5344 stp_putc(0x00, v);
5345 stp_putc(0x0a, v);
5346 stp_putc(0x10, v);
5347 dyesub_nputc(v, 0x00, 7);
5348 stp_put16_be(pd->w_size, v);
5349 stp_put16_be(pd->h_size, v);
5350 dyesub_nputc(v, 0x00, 32);
5351 /* Parameters 2 */
5352 stp_putc(0x1b, v);
5353 stp_putc(0x57, v);
5354 stp_putc(0x22, v);
5355 stp_putc(0x2e, v);
5356 stp_putc(0x00, v);
5357 stp_putc(0xf0, v);
5358 dyesub_nputc(v, 0x00, 5);
5359 stp_putc(0x00, v); // XXX 0x01 for "High Contrast" mode
5360 dyesub_nputc(v, 0x00, 38);
5361 /* Unknown */
5362 stp_putc(0x1b, v);
5363 stp_putc(0x57, v);
5364 stp_putc(0x26, v);
5365 stp_putc(0x2e, v);
5366 stp_putc(0x00, v);
5367 stp_putc(0x70, v);
5368 dyesub_nputc(v, 0x00, 6);
5369 stp_putc(0x01, v);
5370 stp_putc(0x01, v);
5371 dyesub_nputc(v, 0x00, 36);
5372 }
5373
5374 static void mitsu_cp9500_printer_end(stp_vars_t *v)
5375 {
5376 /* Page Footer */
5377 stp_putc(0x1b, v);
5378 stp_putc(0x50, v);
5379 stp_putc(0x57, v);
5380 stp_putc(0x00, v);
5381 }
5382
5383 static const dyesub_stringitem_t mitsu9500_contrasts[] =
5384 {
5385 { "Photo", N_ ("Photo") },
5386 { "HighContrast", N_ ("High Contrast") },
5387 };
5388 LIST(dyesub_stringlist_t, mitsu9500_contrast_list, dyesub_stringitem_t, mitsu9500_contrasts);
5389
5390 static const stp_parameter_t mitsu9500_parameters[] =
5391 {
5392 {
5393 "CP9500Contrast", N_("Printer Contrast"), "Color=No,Category=Advanced Printer Setup",
5394 N_("Printer Contrast"),
5395 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
5396 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
5397 },
5398 };
5399 #define mitsu9500_parameter_count (sizeof(mitsu9500_parameters) / sizeof(const stp_parameter_t))
5400
5401 static int
5402 mitsu9500_load_parameters(const stp_vars_t *v, const char *name,
5403 stp_parameter_t *description)
5404 {
5405 unsigned int i;
5406 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
5407 stp_get_model_id(v));
5408
5409 if (caps->parameter_count && caps->parameters)
5410 {
5411 for (i = 0; i < caps->parameter_count; i++)
5412 if (strcmp(name, caps->parameters[i].name) == 0)
5413 {
5414 stp_fill_parameter_settings(description, &(caps->parameters[i]));
5415 break;
5416 }
5417 }
5418
5419 if (strcmp(name, "CP9500Contrast") == 0)
5420 {
5421 description->bounds.str = stp_string_list_create();
5422
5423 const dyesub_stringlist_t *mlist = &mitsu9500_contrast_list;
5424 for (i = 0; i < mlist->n_items; i++)
5425 {
5426 const dyesub_stringitem_t *m = &(mlist->item[i]);
5427 stp_string_list_add_string(description->bounds.str,
5428 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
5429 }
5430 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
5431 description->is_active = 1;
5432 }
5433 else
5434 {
5435 return 0;
5436 }
5437 return 1;
5438 }
5439
5440 static int mitsu9500_parse_parameters(stp_vars_t *v)
5441 {
5442 const char *contrast = stp_get_string_parameter(v, "CP9500Contrast");
5443 dyesub_privdata_t *pd = get_privdata(v);
5444
5445 /* No need to set global params if there's no privdata yet */
5446 if (!pd)
5447 return 1;
5448
5449 if (strcmp(contrast, "HighContrast") == 0) {
5450 pd->privdata.m9550.contrast = 1;
5451 } else {
5452 pd->privdata.m9550.contrast = 0;
5453 }
5454
5455 return 1;
5456 }
5457
5458 /* Mitsubishi 9550D/DW */
5459 static const dyesub_pagesize_t mitsu_cp9550_page[] =
5460 {
5461 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1240,346), PT(1812,346), DYESUB_LANDSCAPE),
5462 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1416,346), PT(2152,346), DYESUB_LANDSCAPE),
5463 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1416,346), PT(2152,346), 0, PT1(0,346), 0, 0, DYESUB_LANDSCAPE),
5464 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1812,346), PT(2452,346), DYESUB_PORTRAIT),
5465 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(2152,346), PT(2792,346), DYESUB_PORTRAIT),
5466 DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT(2152,346), PT(2956,346), DYESUB_PORTRAIT),
5467 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(2152,346), PT(3146,346), DYESUB_PORTRAIT),
5468 /* XXX also 3.3x6 and 3.5x6!
5469 XXX also 4x6*2, 4.4*6*2, 3x6*3, 2x6*4! (Built on 6x9 media) */
5470 };
5471
5472 LIST(dyesub_pagesize_list_t, mitsu_cp9550_page_list, dyesub_pagesize_t, mitsu_cp9550_page);
5473
5474 static const dyesub_printsize_t mitsu_cp9550_printsize[] =
5475 {
5476 { "346x346", "B7", 1240, 1812},
5477 { "346x346", "w288h432", 1416, 2152},
5478 { "346x346", "w288h432-div2", 1416, 2152},
5479 { "346x346", "w360h504", 1812, 2452},
5480 { "346x346", "w432h576", 2152, 2792},
5481 { "346x346", "w432h612", 2152, 2956},
5482 { "346x346", "w432h648", 2152, 3146},
5483 };
5484
5485 LIST(dyesub_printsize_list_t, mitsu_cp9550_printsize_list, dyesub_printsize_t, mitsu_cp9550_printsize);
5486
5487 static const dyesub_stringitem_t mitsu9550_qualities[] =
5488 {
5489 { "Fine", N_ ("Fine") },
5490 { "SuperFine", N_ ("Super Fine") },
5491 { "FineDeep", N_ ("Fine Deep") }
5492 };
5493 LIST(dyesub_stringlist_t, mitsu9550_quality_list, dyesub_stringitem_t, mitsu9550_qualities);
5494
5495 static const stp_parameter_t mitsu9550_parameters[] =
5496 {
5497 {
5498 "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
5499 N_("Print Speed"),
5500 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
5501 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
5502 },
5503 };
5504 #define mitsu9550_parameter_count (sizeof(mitsu9550_parameters) / sizeof(const stp_parameter_t))
5505
5506 static int
5507 mitsu9550_load_parameters(const stp_vars_t *v, const char *name,
5508 stp_parameter_t *description)
5509 {
5510 unsigned int i;
5511 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
5512 stp_get_model_id(v));
5513
5514 if (caps->parameter_count && caps->parameters)
5515 {
5516 for (i = 0; i < caps->parameter_count; i++)
5517 if (strcmp(name, caps->parameters[i].name) == 0)
5518 {
5519 stp_fill_parameter_settings(description, &(caps->parameters[i]));
5520 break;
5521 }
5522 }
5523
5524 if (strcmp(name, "PrintSpeed") == 0)
5525 {
5526 description->bounds.str = stp_string_list_create();
5527
5528 const dyesub_stringlist_t *mlist = &mitsu9550_quality_list;
5529 for (i = 0; i < mlist->n_items; i++)
5530 {
5531 const dyesub_stringitem_t *m = &(mlist->item[i]);
5532 stp_string_list_add_string(description->bounds.str,
5533 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
5534 }
5535 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
5536 description->is_active = 1;
5537 }
5538 else
5539 {
5540 return 0;
5541 }
5542 return 1;
5543 }
5544
5545 static int mitsu9550_parse_parameters(stp_vars_t *v)
5546 {
5547 const char *quality = stp_get_string_parameter(v, "PrintSpeed");
5548 dyesub_privdata_t *pd = get_privdata(v);
5549
5550 /* No need to set global params if there's no privdata yet */
5551 if (!pd)
5552 return 1;
5553
5554 pd->privdata.m9550.quality = 0;
5555 pd->privdata.m9550.finedeep = 0;
5556
5557 /* Parse options */
5558 if (strcmp(quality, "SuperFine") == 0) {
5559 pd->privdata.m9550.quality = 0x80;
5560 } else if (strcmp(quality, "FineDeep") == 0) {
5561 pd->privdata.m9550.finedeep = 1;
5562 }
5563
5564 return 1;
5565 }
5566
5567 static void mitsu_cp9550_printer_init(stp_vars_t *v)
5568 {
5569 dyesub_privdata_t *pd = get_privdata(v);
5570
5571 /* Init */
5572 stp_putc(0x1b, v);
5573 stp_putc(0x57, v);
5574 stp_putc(0x20, v);
5575 stp_putc(0x2e, v);
5576 stp_putc(0x00, v);
5577 stp_putc(0x0a, v);
5578 stp_putc(0x10, v);
5579 dyesub_nputc(v, 0x00, 7);
5580 stp_put16_be(pd->w_size, v);
5581 stp_put16_be(pd->h_size, v);
5582 dyesub_nputc(v, 0x00, 32);
5583 /* Parameters 1 */
5584 stp_putc(0x1b, v);
5585 stp_putc(0x57, v);
5586 stp_putc(0x21, v);
5587 stp_putc(0x2e, v);
5588 stp_putc(0x00, v);
5589 stp_putc(0x80, v);
5590 stp_putc(0x00, v);
5591 stp_putc(0x22, v);
5592 stp_putc(0x08, v);
5593 stp_putc(0x03, v);
5594 dyesub_nputc(v, 0x00, 18);
5595 stp_put16_be(pd->copies, v);
5596 dyesub_nputc(v, 0x00, 2);
5597 if (strcmp(pd->pagesize,"w288h432-div2") == 0)
5598 stp_putc(0x83, v);
5599 else
5600 stp_putc(0x00, v);
5601 dyesub_nputc(v, 0x00, 5);
5602 stp_putc(pd->privdata.m9550.quality, v);
5603 dyesub_nputc(v, 0x00, 10);
5604 stp_putc(0x01, v);
5605 /* Parameters 2 */
5606 stp_putc(0x1b, v);
5607 stp_putc(0x57, v);
5608 stp_putc(0x22, v);
5609 stp_putc(0x2e, v);
5610 stp_putc(0x00, v);
5611 stp_putc(0x40, v);
5612 dyesub_nputc(v, 0x00, 5);
5613 stp_putc(pd->privdata.m9550.finedeep, v);
5614 dyesub_nputc(v, 0x00, 38);
5615 /* Unknown */
5616 stp_putc(0x1b, v);
5617 stp_putc(0x57, v);
5618 stp_putc(0x26, v);
5619 stp_putc(0x2e, v);
5620 stp_putc(0x00, v);
5621 stp_putc(0x70, v);
5622 dyesub_nputc(v, 0x00, 6);
5623 stp_putc(0x01, v);
5624 stp_putc(0x01, v);
5625 dyesub_nputc(v, 0x00, 36);
5626 }
5627
5628 static void mitsu_cp9550_printer_end(stp_vars_t *v)
5629 {
5630 /* Page Footer */
5631 stp_putc(0x1b, v);
5632 stp_putc(0x50, v);
5633 stp_putc(0x46, v);
5634 stp_putc(0x00, v);
5635 }
5636
5637 /* Mitsubishi CP9550DW-S */
5638
5639 static const dyesub_pagesize_t mitsu_cp9550s_page[] =
5640 {
5641 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1416,346), PT(2152,346), DYESUB_LANDSCAPE),
5642 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1416,346), PT(2152,346), 0, PT1(0,346), 0, 0, DYESUB_LANDSCAPE),
5643 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1812,346), PT(2452,346), DYESUB_PORTRAIT),
5644 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(2152,346), PT(2792,346), DYESUB_PORTRAIT),
5645 DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT(2152,346), PT(2956,346), DYESUB_PORTRAIT),
5646 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(2152,346), PT(3146,346), DYESUB_PORTRAIT),
5647 };
5648
5649 LIST(dyesub_pagesize_list_t, mitsu_cp9550s_page_list, dyesub_pagesize_t, mitsu_cp9550s_page);
5650
5651 static const dyesub_printsize_t mitsu_cp9550s_printsize[] =
5652 {
5653 { "346x346", "w288h432", 1416, 2152},
5654 { "346x346", "w288h432-div2", 1416, 2152},
5655 { "346x346", "w360h504", 1812, 2452},
5656 { "346x346", "w432h576", 2152, 2792},
5657 { "346x346", "w432h612", 2152, 2956},
5658 { "346x346", "w432h648", 2152, 3146},
5659 };
5660
5661 LIST(dyesub_printsize_list_t, mitsu_cp9550s_printsize_list, dyesub_printsize_t, mitsu_cp9550s_printsize);
5662
5663 static void mitsu_cp9550s_printer_end(stp_vars_t *v)
5664 {
5665 /* Page Footer */
5666 stp_putc(0x1b, v);
5667 stp_putc(0x50, v);
5668 stp_putc(0x47, v);
5669 stp_putc(0x00, v);
5670 }
5671
5672 /* Mitsubishi 9600D/DW */
5673 static const dyesub_resolution_t res_mitsu9600_dpi[] =
5674 {
5675 { "300x300", 300, 300},
5676 { "600x600", 600, 600},
5677 };
5678
5679 LIST(dyesub_resolution_list_t, res_mitsu9600_dpi_list, dyesub_resolution_t, res_mitsu9600_dpi);
5680
5681 static const dyesub_pagesize_t mitsu_cp9600_page[] =
5682 {
5683 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1076,300), PT(1572,300), DYESUB_LANDSCAPE),
5684 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1228,300), PT(1868,300), DYESUB_LANDSCAPE),
5685 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1572,300), PT(2128,300), DYESUB_PORTRAIT),
5686 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1868,300), PT(2442,300), DYESUB_PORTRAIT),
5687 DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT(1868,300), PT(2564,300), DYESUB_PORTRAIT),
5688 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1868,300), PT(2730,300), DYESUB_PORTRAIT),
5689 };
5690
5691 LIST(dyesub_pagesize_list_t, mitsu_cp9600_page_list, dyesub_pagesize_t, mitsu_cp9600_page);
5692
5693 static const dyesub_printsize_t mitsu_cp9600_printsize[] =
5694 {
5695 { "300x300", "B7", 1076, 1572},
5696 { "600x600", "B7", 2152, 3144},
5697 { "300x300", "w288h432", 1228, 1868},
5698 { "600x600", "w288h432", 2458, 3736},
5699 { "300x300", "w360h504", 1572, 2128},
5700 { "600x600", "w360h504", 3144, 4256},
5701 { "300x300", "w432h576", 1868, 2442},
5702 { "600x600", "w432h576", 3736, 4846},
5703 { "300x300", "w432h612", 1868, 2564},
5704 { "600x600", "w432h612", 3736, 5130},
5705 { "300x300", "w432h648", 1868, 2730},
5706 { "600x600", "w432h648", 3736, 5462},
5707 };
5708
5709 LIST(dyesub_printsize_list_t, mitsu_cp9600_printsize_list, dyesub_printsize_t, mitsu_cp9600_printsize);
5710
5711 static void mitsu_cp9600_printer_init(stp_vars_t *v)
5712 {
5713 dyesub_privdata_t *pd = get_privdata(v);
5714
5715 /* Parameters 1 */
5716 stp_putc(0x1b, v);
5717 stp_putc(0x57, v);
5718 stp_putc(0x21, v);
5719 stp_putc(0x2e, v);
5720 stp_putc(0x00, v);
5721 stp_putc(0x80, v);
5722 stp_putc(0x00, v);
5723 stp_putc(0x22, v);
5724 stp_putc(0x00, v);
5725 stp_putc(0x03, v);
5726 dyesub_nputc(v, 0x00, 18);
5727 stp_put16_be(pd->copies, v);
5728 dyesub_nputc(v, 0x00, 19);
5729 stp_putc(0x01, v);
5730 /* Parameters 2 */
5731 stp_putc(0x1b, v);
5732 stp_putc(0x57, v);
5733 stp_putc(0x20, v);
5734 stp_putc(0x2e, v);
5735 stp_putc(0x00, v);
5736 stp_putc(0x0a, v);
5737 stp_putc(0x10, v);
5738 dyesub_nputc(v, 0x00, 7);
5739 stp_put16_be(pd->w_size, v);
5740 stp_put16_be(pd->h_size, v);
5741 dyesub_nputc(v, 0x00, 32);
5742 /* Parameters 3 */
5743 stp_putc(0x1b, v);
5744 stp_putc(0x57, v);
5745 stp_putc(0x26, v);
5746 stp_putc(0x2e, v);
5747 stp_putc(0x00, v);
5748 stp_putc(0x60, v);
5749 dyesub_nputc(v, 0x00, 6);
5750 stp_putc(0x01, v);
5751 dyesub_nputc(v, 0x00, 37);
5752 }
5753
5754 static void mitsu_cp9600_printer_end(stp_vars_t *v)
5755 {
5756 /* Page Footer */
5757 stp_putc(0x1b, v);
5758 stp_putc(0x50, v);
5759 stp_putc(0x48, v);
5760 stp_putc(0x00, v);
5761 }
5762
5763 /* Mitsubishi 9810D/DW */
5764 static const dyesub_pagesize_t mitsu_cp9810_page[] =
5765 {
5766 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1076,300), PT(1572,300), DYESUB_LANDSCAPE),
5767 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1228,300), PT(1868,300), DYESUB_LANDSCAPE),
5768 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1572,300), PT(2128,300), DYESUB_PORTRAIT),
5769 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1868,300), PT(2442,300), DYESUB_PORTRAIT),
5770 DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT(1868,300), PT(2564,300), DYESUB_PORTRAIT),
5771 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1868,300), PT(2730,300), DYESUB_PORTRAIT),
5772 };
5773
5774 LIST(dyesub_pagesize_list_t, mitsu_cp9810_page_list, dyesub_pagesize_t, mitsu_cp9810_page);
5775
5776 static const dyesub_printsize_t mitsu_cp9810_printsize[] =
5777 {
5778 { "300x300", "B7", 1076, 1572},
5779 { "300x300", "w288h432", 1228, 1868},
5780 { "300x300", "w360h504", 1572, 2128},
5781 { "300x300", "w432h576", 1868, 2442},
5782 { "300x300", "w432h612", 1868, 2564},
5783 { "300x300", "w432h648", 1868, 2730},
5784 };
5785
5786 LIST(dyesub_printsize_list_t, mitsu_cp9810_printsize_list, dyesub_printsize_t, mitsu_cp9810_printsize);
5787
5788 static const overcoat_t mitsu_cp9810_overcoat[] =
5789 {
5790 {"Glossy", N_("Glossy"), {1, "\x00"}},
5791 {"Matte", N_("Matte"), {1, "\x01"}},
5792 };
5793
5794 LIST(overcoat_list_t, mitsu_cp9810_overcoat_list, overcoat_t, mitsu_cp9810_overcoat);
5795
5796 static const dyesub_stringitem_t mitsu9810_qualities[] =
5797 {
5798 { "Fine", N_ ("Fine (Standard Media") },
5799 { "FineHG", N_ ("Fine (High Grade Media)") },
5800 { "SuperFine", N_ ("Super Fine") },
5801 };
5802 LIST(dyesub_stringlist_t, mitsu9810_quality_list, dyesub_stringitem_t, mitsu9810_qualities);
5803
5804 static const stp_parameter_t mitsu98xx_parameters[] =
5805 {
5806 {
5807 "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
5808 N_("Print Speed"),
5809 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
5810 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
5811 },
5812 {
5813 "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
5814 N_("Use Internal Color Correction"),
5815 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
5816 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
5817 },
5818 {
5819 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
5820 N_("Sharpening to apply to image (0 is off, 1 is min, 10 is max"),
5821 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
5822 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
5823 },
5824 };
5825 #define mitsu98xx_parameter_count (sizeof(mitsu98xx_parameters) / sizeof(const stp_parameter_t))
5826
5827 static int
5828 mitsu98xx_load_parameters(const stp_vars_t *v, const char *name,
5829 stp_parameter_t *description)
5830 {
5831 unsigned int i;
5832 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
5833 stp_get_model_id(v));
5834
5835 if (caps->parameter_count && caps->parameters)
5836 {
5837 for (i = 0; i < caps->parameter_count; i++)
5838 if (strcmp(name, caps->parameters[i].name) == 0)
5839 {
5840 stp_fill_parameter_settings(description, &(caps->parameters[i]));
5841 break;
5842 }
5843 }
5844
5845 if (strcmp(name, "PrintSpeed") == 0)
5846 {
5847 description->bounds.str = stp_string_list_create();
5848
5849 const dyesub_stringlist_t *mlist = &mitsu9810_quality_list;
5850 for (i = 0; i < mlist->n_items; i++)
5851 {
5852 const dyesub_stringitem_t *m = &(mlist->item[i]);
5853 stp_string_list_add_string(description->bounds.str,
5854 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
5855 }
5856 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
5857 description->is_active = 1;
5858 }
5859 else if (strcmp(name, "UseLUT") == 0)
5860 {
5861 description->deflt.boolean = 0;
5862 description->is_active = 1;
5863 }
5864 else if (strcmp(name, "Sharpen") == 0)
5865 {
5866 description->deflt.integer = 6;
5867 description->bounds.integer.lower = 0;
5868 description->bounds.integer.upper = 10;
5869 description->is_active = 1;
5870 }
5871 else
5872 {
5873 return 0;
5874 }
5875 return 1;
5876 }
5877
5878 static int mitsu98xx_parse_parameters(stp_vars_t *v)
5879 {
5880 const char *quality = stp_get_string_parameter(v, "PrintSpeed");
5881 dyesub_privdata_t *pd = get_privdata(v);
5882 const overcoat_t *overcoat = NULL;
5883 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
5884 stp_get_model_id(v));
5885
5886 /* No need to set global params if there's no privdata yet */
5887 if (!pd)
5888 return 1;
5889
5890 pd->privdata.m9550.quality = 0;
5891
5892 /* Parse options */
5893 if (strcmp(quality, "SuperFine") == 0) {
5894 pd->privdata.m9550.quality = 0x80;
5895 } else if (strcmp(quality, "FineHG") == 0) {
5896 pd->privdata.m9550.quality = 0x11; /* Extension, backend corrects */
5897 } else if (strcmp(quality, "Fine") == 0) {
5898 pd->privdata.m9550.quality = 0x10;
5899 }
5900
5901 pd->privdata.m70x.use_lut = stp_get_boolean_parameter(v, "UseLUT");
5902 pd->privdata.m70x.sharpen = stp_get_int_parameter(v, "Sharpen");
5903
5904 /* Matte lamination forces SuperFine mode */
5905 if (caps->overcoat) {
5906 overcoat = dyesub_get_overcoat_pattern(v);
5907 if (*((const char*)((overcoat->seq).data)) != 0x00) {
5908 pd->privdata.m9550.quality = 0x80;
5909 }
5910 }
5911
5912 return 1;
5913 }
5914
5915 static void mitsu_cp98xx_printer_init(stp_vars_t *v, int model)
5916 {
5917 dyesub_privdata_t *pd = get_privdata(v);
5918
5919 /* Init */
5920 stp_putc(0x1b, v);
5921 stp_putc(0x57, v);
5922 stp_putc(0x20, v);
5923 stp_putc(0x2e, v);
5924 stp_putc(0x00, v);
5925 stp_putc(0x0a, v);
5926 stp_putc(model, v);
5927 dyesub_nputc(v, 0x00, 7);
5928 stp_put16_be(pd->w_size, v);
5929 stp_put16_be(pd->h_size, v);
5930 if (model == 0x90) {
5931 stp_zfwrite((pd->overcoat->seq).data, 1,
5932 (pd->overcoat->seq).bytes, v); /* Lamination */
5933 } else {
5934 stp_putc(0x00, v);
5935 }
5936 dyesub_nputc(v, 0x00, 31);
5937
5938 /* Parameters 1 */
5939 stp_putc(0x1b, v);
5940 stp_putc(0x57, v);
5941 stp_putc(0x21, v);
5942 stp_putc(0x2e, v);
5943 stp_putc(0x00, v);
5944 stp_putc(0x80, v);
5945 stp_putc(0x00, v);
5946 stp_putc(0x22, v);
5947 stp_putc(0x08, v);
5948 stp_putc(0x01, v);
5949 dyesub_nputc(v, 0x00, 18);
5950 stp_put16_be(pd->copies, v);
5951 dyesub_nputc(v, 0x00, 8);
5952 stp_putc(pd->privdata.m9550.quality, v);
5953 dyesub_nputc(v, 0x00, 7);
5954 stp_putc(pd->privdata.m70x.sharpen, v); /* EXTENSION! Sharpness. */
5955 stp_putc(0x01, v); /* EXTENSION! Tell backend data is in correct order */
5956 stp_putc(pd->privdata.m70x.use_lut, v); /* Use LUT? EXTENSION! */
5957 stp_putc(0x01, v);
5958
5959 /* Unknown */
5960 stp_putc(0x1b, v);
5961 stp_putc(0x57, v);
5962 stp_putc(0x26, v);
5963 stp_putc(0x2e, v);
5964 stp_putc(0x00, v);
5965 stp_putc(0x70, v);
5966 dyesub_nputc(v, 0x00, 6);
5967 stp_putc(0x01, v);
5968 stp_putc(0x01, v);
5969 dyesub_nputc(v, 0x00, 36);
5970
5971 /* Put out a single plane header */
5972 stp_putc(0x1b, v);
5973 stp_putc(0x5a, v);
5974 stp_putc(0x54, v);
5975 stp_putc(0x80, v); /* special flag to say this is 8bpp packed BGR */
5976 stp_put16_be(0, v); /* Starting column for this block */
5977 stp_put16_be(0, v); /* Starting row for this block */
5978 stp_put16_be(pd->w_size, v);
5979 stp_put16_be(pd->h_size, v); /* Number of rows in this block */
5980 }
5981
5982 static void mitsu_cp9810_printer_init(stp_vars_t *v)
5983 {
5984 mitsu_cp98xx_printer_init(v, 0x90);
5985 }
5986
5987 static void mitsu_cp9800_printer_init(stp_vars_t *v)
5988 {
5989 mitsu_cp98xx_printer_init(v, 0x10);
5990 }
5991
5992 static void mitsu_cp9810_printer_end(stp_vars_t *v)
5993 {
5994 /* Job Footer */
5995 stp_putc(0x1b, v);
5996 stp_putc(0x50, v);
5997 stp_putc(0x4c, v); /* XXX 9800DW-S uses 0x4e, backend corrects */
5998 stp_putc(0x00, v);
5999 }
6000
6001 /* Mitsubishi CP30DW */
6002 static const dyesub_pagesize_t mitsu_cp30_page[] =
6003 {
6004 DEFINE_PAPER_SIMPLE( "w272h204", "S", PT(1200,300), PT(1600,300), DYESUB_LANDSCAPE),
6005 DEFINE_PAPER_SIMPLE( "w272h357", "L", PT(1600,300), PT(2100,300), DYESUB_PORTRAIT),
6006 };
6007
6008 LIST(dyesub_pagesize_list_t, mitsu_cp30_page_list, dyesub_pagesize_t, mitsu_cp30_page);
6009
6010 static const dyesub_printsize_t mitsu_cp30_printsize[] =
6011 {
6012 { "423x423", "w272h204", 1200, 1600},
6013 { "423x423", "w272h357", 1600, 2100},
6014 };
6015
6016 LIST(dyesub_printsize_list_t, mitsu_cp30_printsize_list, dyesub_printsize_t, mitsu_cp30_printsize);
6017
6018 static void mitsu_cp30_printer_init(stp_vars_t *v)
6019 {
6020 dyesub_privdata_t *pd = get_privdata(v);
6021
6022 /* Header 1 */
6023 stp_putc(0x1b, v);
6024 stp_putc(0x57, v);
6025 stp_putc(0x20, v);
6026 stp_putc(0x2e, v);
6027 stp_putc(0x00, v);
6028 stp_putc(0x0a, v);
6029 stp_putc(0x10, v);
6030 dyesub_nputc(v, 0x00, 7);
6031 stp_put16_be(pd->w_size, v);
6032 stp_put16_be(pd->h_size, v);
6033 dyesub_nputc(v, 0x00, 32);
6034
6035 /* Header 2 */
6036 stp_putc(0x1b, v);
6037 stp_putc(0x57, v);
6038 stp_putc(0x21, v);
6039 stp_putc(0x2e, v);
6040 dyesub_nputc(v, 0x00, 3);
6041 stp_putc(0x20, v);
6042 stp_putc(0x08, v);
6043 stp_putc(0x02, v);
6044 dyesub_nputc(v, 0x00, 18);
6045 stp_put16_be(pd->copies, v);
6046 dyesub_nputc(v, 0x00, 8);
6047 stp_putc(pd->privdata.m9550.quality, v); // XXX 0x80 for powersave, 0x00 normal
6048 dyesub_nputc(v, 0x00, 7);
6049 stp_putc(pd->privdata.m70x.sharpen, v); /* EXTENSION! Sharpness? */
6050 stp_putc(0x00, v); /* XXX change to 0x01 if we revert the order? */
6051 stp_putc(pd->privdata.m70x.use_lut, v); /* Use LUT? EXTENSION! */
6052 stp_putc(0x00, v);
6053
6054 /* Header 3 */
6055 stp_putc(0x1b, v);
6056 stp_putc(0x57, v);
6057 stp_putc(0x22, v);
6058 stp_putc(0x2e, v);
6059 stp_putc(0x00, v);
6060 stp_putc(0x40, v);
6061 dyesub_nputc(v, 0x00, 44);
6062
6063 /* Header 4 */
6064 stp_putc(0x1b, v);
6065 stp_putc(0x57, v);
6066 stp_putc(0x26, v);
6067 stp_putc(0x2e, v);
6068 stp_putc(0x00, v);
6069 stp_putc(0x3f, v);
6070 stp_putc(0x80, v);
6071 dyesub_nputc(v, 0x00, 5);
6072 stp_putc(0x01, v);
6073 stp_putc(0x01, v);
6074 stp_putc(0x80, v);
6075 stp_putc(0x10, v);
6076 stp_putc(0x10, v);
6077 stp_putc(0x00, v);
6078 stp_putc(0x10, v);
6079 dyesub_nputc(v, 0x00, 31);
6080 }
6081
6082 static void mitsu_cp30_printer_end(stp_vars_t *v)
6083 {
6084 /* Page Footer */
6085 stp_putc(0x1b, v);
6086 stp_putc(0x50, v);
6087 stp_putc(0x52, v);
6088 stp_putc(0x00, v);
6089 stp_putc(0x00, v);
6090 stp_putc(0x00, v);
6091 }
6092
6093 static const dyesub_stringitem_t mitsu_cp30_qualities[] =
6094 {
6095 { "Normal", N_ ("Normal") },
6096 { "PowerSaving", N_ ("Power Saving") }
6097 };
6098 LIST(dyesub_stringlist_t, mitsu_cp30_quality_list, dyesub_stringitem_t, mitsu_cp30_qualities);
6099
6100 static const stp_parameter_t mitsu_cp30_parameters[] =
6101 {
6102 {
6103 "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
6104 N_("Use Internal Color Correction"),
6105 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
6106 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6107 },
6108 {
6109 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
6110 N_("Sharpening to apply to image (0 is off, 1 is min, 7 is max"),
6111 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
6112 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6113 },
6114 {
6115 "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
6116 N_("Print Speed"),
6117 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
6118 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6119 },
6120 };
6121 #define mitsu_cp30_parameter_count (sizeof(mitsu_cp30_parameters) / sizeof(const stp_parameter_t))
6122
6123 static int mitsu_cp30_load_parameters(const stp_vars_t *v, const char *name,
6124 stp_parameter_t *description)
6125 {
6126 unsigned int i;
6127 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
6128 stp_get_model_id(v));
6129
6130 if (caps->parameter_count && caps->parameters)
6131 {
6132 for (i = 0; i < caps->parameter_count; i++)
6133 if (strcmp(name, caps->parameters[i].name) == 0)
6134 {
6135 stp_fill_parameter_settings(description, &(caps->parameters[i]));
6136 break;
6137 }
6138 }
6139
6140 if (strcmp(name, "UseLUT") == 0)
6141 {
6142 description->deflt.boolean = 1;
6143 description->is_active = 1;
6144 }
6145 else if (strcmp(name, "Sharpen") == 0)
6146 {
6147 description->deflt.integer = 4;
6148 description->bounds.integer.lower = 0;
6149 description->bounds.integer.upper = 8;
6150 description->is_active = 1;
6151 }
6152 else if (strcmp(name, "PrintSpeed") == 0)
6153 {
6154 description->bounds.str = stp_string_list_create();
6155
6156 const dyesub_stringlist_t *mlist = &mitsu_cp30_quality_list;
6157 for (i = 0; i < mlist->n_items; i++)
6158 {
6159 const dyesub_stringitem_t *m = &(mlist->item[i]);
6160 stp_string_list_add_string(description->bounds.str,
6161 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
6162 }
6163 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
6164 description->is_active = 1;
6165 }
6166 else
6167 {
6168 return 0;
6169 }
6170 return 1;
6171 }
6172
6173 static int mitsu_cp30_parse_parameters(stp_vars_t *v)
6174 {
6175 const char *quality = stp_get_string_parameter(v, "PrintSpeed");
6176 dyesub_privdata_t *pd = get_privdata(v);
6177
6178 /* No need to set global params if there's no privdata yet */
6179 if (!pd)
6180 return 1;
6181
6182 pd->privdata.m70x.use_lut = stp_get_boolean_parameter(v, "UseLUT");
6183 pd->privdata.m70x.sharpen = stp_get_int_parameter(v, "Sharpen");
6184
6185 if (strcmp(quality, "PowerSaving") == 0)
6186 pd->privdata.m9550.quality = 0x80;
6187 else
6188 pd->privdata.m9550.quality = 0;
6189
6190 return 1;
6191 }
6192
6193 /* Mitsubishi CP-D70D/CP-D707 */
6194 static const dyesub_pagesize_t mitsu_cpd70x_page[] =
6195 {
6196 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1076,300), PT(1568,300), DYESUB_LANDSCAPE),
6197 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1228,300), PT(1864,300), DYESUB_LANDSCAPE),
6198 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1228,300), PT(1864,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
6199 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1568,300), PT(2128,300), DYESUB_PORTRAIT),
6200 DEFINE_PAPER( "w360h504-div2", "3.5x5*2", PT(1568,300), PT1(2128,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
6201 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1820,300), PT(1864,300), DYESUB_LANDSCAPE),
6202 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1864,300), PT(2422,300), DYESUB_PORTRAIT),
6203 DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT(1864,300), PT(2564,300), DYESUB_PORTRAIT),
6204 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1864,300), PT(2730,300), DYESUB_PORTRAIT),
6205 DEFINE_PAPER( "w432h576-div2", "4x6*2", PT(1864,300), PT1(2730,300), 0, 0, PT(236,300), PT1(0,300), DYESUB_PORTRAIT),
6206 #if 0 /* Theoretically supported, no way to test */
6207 DEFINE_PAPER( "w432h576-div4", "2x6*4", PT(1864,300), PT2(2730,300), 0, 0, PT(51,300), PT2(51,300), DYESUB_PORTRAIT),
6208 DEFINE_PAPER( "w432h648-div3", "3x6*3", PT(1864,300), PT3(2730,300), 0, 0, PT(3, 300), PT3(3, 300), DYESUB_PORTRAIT),
6209 DEFINE_PAPER( "w432h648-div2", "4.4x6*2", PT(1864,300), PT4(2730,300), 0, 0, PT(1, 300), PT4(1, 300), DYESUB_PORTRAIT),
6210 #endif
6211 };
6212
6213 LIST(dyesub_pagesize_list_t, mitsu_cpd70x_page_list, dyesub_pagesize_t, mitsu_cpd70x_page);
6214
6215 static const dyesub_printsize_t mitsu_cpd70x_printsize[] =
6216 {
6217 { "300x300", "B7", 1076, 1568},
6218 { "300x300", "w288h432", 1228, 1864},
6219 { "300x300", "w288h432-div2", 1228, 1864},
6220 { "300x300", "w360h504", 1568, 2128},
6221 { "300x300", "w360h504-div2", 1568, 2128},
6222 { "300x300", "w432h432", 1820, 1864},
6223 { "300x300", "w432h576", 1864, 2422},
6224 { "300x300", "w432h612", 1864, 2564},
6225 { "300x300", "w432h648", 1864, 2730},
6226 { "300x300", "w432h576-div2", 1864, 2730},
6227 #if 0
6228 { "300x300", "w432h576-div4", 1864, 2730},
6229 { "300x300", "w432h648-div3", 1864, 2730},
6230 { "300x300", "w432h648-div2", 1864, 2730},
6231 #endif
6232 };
6233
6234 LIST(dyesub_printsize_list_t, mitsu_cpd70x_printsize_list, dyesub_printsize_t, mitsu_cpd70x_printsize);
6235
6236 static const overcoat_t mitsu_cpd70x_overcoat[] =
6237 {
6238 {"Glossy", N_("Glossy"), {1, "\x00"}},
6239 {"Matte", N_("Matte"), {1, "\x02"}},
6240 };
6241
6242 LIST(overcoat_list_t, mitsu_cpd70x_overcoat_list, overcoat_t, mitsu_cpd70x_overcoat);
6243
6244 static const dyesub_stringitem_t mitsu70x_qualities[] =
6245 {
6246 { "Fine", N_ ("Fine") },
6247 { "SuperFine", N_ ("Super Fine") },
6248 { "UltraFine", N_ ("Ultra Fine") }
6249 };
6250 LIST(dyesub_stringlist_t, mitsu70x_quality_list, dyesub_stringitem_t, mitsu70x_qualities);
6251
6252 static const stp_parameter_t mitsu70x_parameters[] =
6253 {
6254 {
6255 "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
6256 N_("Print Speed"),
6257 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
6258 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6259 },
6260 {
6261 "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
6262 N_("Use Internal Color Correction"),
6263 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
6264 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6265 },
6266 {
6267 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
6268 N_("Sharpening to apply to image (0 is off, 1 is min, 9 is max"),
6269 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
6270 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6271 },
6272 };
6273 #define mitsu70x_parameter_count (sizeof(mitsu70x_parameters) / sizeof(const stp_parameter_t))
6274
6275 static const dyesub_stringitem_t mitsu707_decks[] =
6276 {
6277 { "Auto", N_ ("Automatic") },
6278 { "Lower", N_ ("Lower Deck") },
6279 { "Upper", N_ ("Upper Deck") }
6280 };
6281 LIST(dyesub_stringlist_t, mitsu707_deck_list, dyesub_stringitem_t, mitsu707_decks);
6282
6283 static const stp_parameter_t mitsu707_parameters[] =
6284 {
6285 {
6286 "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
6287 N_("Print Speed"),
6288 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
6289 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6290 },
6291 {
6292 "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
6293 N_("Use Internal Color Correction"),
6294 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
6295 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6296 },
6297 {
6298 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
6299 N_("Sharpening to apply to image (0 is off, 1 is min, 9 is max"),
6300 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
6301 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6302 },
6303 {
6304 "Deck", N_("Printer Deck"), "Color=No,Category=Advanced Printer Setup",
6305 N_("Printer Deck"),
6306 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
6307 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6308 },
6309 };
6310 #define mitsu707_parameter_count (sizeof(mitsu707_parameters) / sizeof(const stp_parameter_t))
6311
6312 static int
6313 mitsu70x_load_parameters(const stp_vars_t *v, const char *name,
6314 stp_parameter_t *description)
6315 {
6316 unsigned int i;
6317 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
6318 stp_get_model_id(v));
6319
6320 if (caps->parameter_count && caps->parameters)
6321 {
6322 for (i = 0; i < caps->parameter_count; i++)
6323 if (strcmp(name, caps->parameters[i].name) == 0)
6324 {
6325 stp_fill_parameter_settings(description, &(caps->parameters[i]));
6326 break;
6327 }
6328 }
6329
6330 if (strcmp(name, "PrintSpeed") == 0)
6331 {
6332 description->bounds.str = stp_string_list_create();
6333
6334 const dyesub_stringlist_t *mlist = &mitsu70x_quality_list;
6335 for (i = 0; i < mlist->n_items; i++)
6336 {
6337 const dyesub_stringitem_t *m = &(mlist->item[i]);
6338 stp_string_list_add_string(description->bounds.str,
6339 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
6340 }
6341 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
6342 description->is_active = 1;
6343 }
6344 else if (strcmp(name, "UseLUT") == 0)
6345 {
6346 description->deflt.boolean = 0;
6347 description->is_active = 1;
6348 }
6349 else if (strcmp(name, "Sharpen") == 0)
6350 {
6351 description->deflt.integer = 4;
6352 description->bounds.integer.lower = 0;
6353 description->bounds.integer.upper = 9;
6354 description->is_active = 1;
6355 }
6356 else
6357 {
6358 return 0;
6359 }
6360 return 1;
6361 }
6362
6363 static int
6364 mitsu707_load_parameters(const stp_vars_t *v, const char *name,
6365 stp_parameter_t *description)
6366 {
6367 unsigned int i;
6368 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
6369 stp_get_model_id(v));
6370
6371 if (caps->parameter_count && caps->parameters)
6372 {
6373 for (i = 0; i < caps->parameter_count; i++)
6374 if (strcmp(name, caps->parameters[i].name) == 0)
6375 {
6376 stp_fill_parameter_settings(description, &(caps->parameters[i]));
6377 break;
6378 }
6379 }
6380
6381 if (strcmp(name, "PrintSpeed") == 0)
6382 {
6383 description->bounds.str = stp_string_list_create();
6384
6385 const dyesub_stringlist_t *mlist = &mitsu70x_quality_list;
6386 for (i = 0; i < mlist->n_items; i++)
6387 {
6388 const dyesub_stringitem_t *m = &(mlist->item[i]);
6389 stp_string_list_add_string(description->bounds.str,
6390 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
6391 }
6392 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
6393 description->is_active = 1;
6394 }
6395 else if (strcmp(name, "UseLUT") == 0)
6396 {
6397 description->deflt.boolean = 0;
6398 description->is_active = 1;
6399 }
6400 else if (strcmp(name, "Sharpen") == 0)
6401 {
6402 description->deflt.integer = 4;
6403 description->bounds.integer.lower = 0;
6404 description->bounds.integer.upper = 9;
6405 description->is_active = 1;
6406 }
6407 else if (strcmp(name, "Deck") == 0)
6408 {
6409 description->bounds.str = stp_string_list_create();
6410
6411 const dyesub_stringlist_t *mlist = &mitsu707_deck_list;
6412 for (i = 0; i < mlist->n_items; i++)
6413 {
6414 const dyesub_stringitem_t *m = &(mlist->item[i]);
6415 stp_string_list_add_string(description->bounds.str,
6416 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
6417 }
6418 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
6419 description->is_active = 1;
6420 }
6421 else
6422 {
6423 return 0;
6424 }
6425 return 1;
6426 }
6427
6428 static int mitsu70x_parse_parameters(stp_vars_t *v)
6429 {
6430 const char *quality = stp_get_string_parameter(v, "PrintSpeed");
6431 dyesub_privdata_t *pd = get_privdata(v);
6432
6433 /* No need to set global params if there's no privdata yet */
6434 if (!pd)
6435 return 1;
6436
6437 /* Parse options */
6438 if (strcmp(quality, "SuperFine") == 0) {
6439 pd->privdata.m70x.quality = 3;
6440 } else if (strcmp(quality, "UltraFine") == 0) {
6441 pd->privdata.m70x.quality = 4;
6442 } else if (strcmp(quality, "Fine") == 0) {
6443 pd->privdata.m70x.quality = 0;
6444 } else {
6445 pd->privdata.m70x.quality = 0;
6446 }
6447
6448 /* For D707 only */
6449 pd->privdata.m70x.deck = 0;
6450 if (stp_check_string_parameter(v, "Deck", STP_PARAMETER_ACTIVE)) {
6451 const char *deck = stp_get_string_parameter(v, "Deck");
6452 if (strcmp(deck, "Auto") == 0)
6453 pd->privdata.m70x.deck = 0;
6454 else if (strcmp(deck, "Lower") == 0)
6455 pd->privdata.m70x.deck = 1;
6456 else if (strcmp(deck, "Upper") == 0)
6457 pd->privdata.m70x.deck = 2;
6458 }
6459
6460 pd->privdata.m70x.use_lut = stp_get_boolean_parameter(v, "UseLUT");
6461 pd->privdata.m70x.sharpen = stp_get_int_parameter(v, "Sharpen");
6462
6463 return 1;
6464 }
6465
6466 static void mitsu_cpd70k60_job_start(stp_vars_t *v)
6467 {
6468 /* Printer wakeup, once per job. */
6469 stp_putc(0x1b, v);
6470 stp_putc(0x45, v);
6471 stp_putc(0x57, v);
6472 stp_putc(0x55, v);
6473 dyesub_nputc(v, 0x00, 508);
6474 }
6475
6476 static void mitsu_cpd70k60_printer_init(stp_vars_t *v, unsigned char model)
6477 {
6478 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
6479 stp_get_model_id(v));
6480 dyesub_privdata_t *pd = get_privdata(v);
6481
6482 /* Each copy gets this.. */
6483 stp_putc(0x1b, v);
6484 stp_putc(0x5a, v);
6485 stp_putc(0x54, v);
6486 stp_putc(model, v); /* k60 == x00, EK305 == x90, d70x/d80 == x01, ask300 = 0x80, DSx80 == x04 */
6487 dyesub_nputc(v, 0x00, 12);
6488
6489 stp_put16_be(pd->w_size, v);
6490 stp_put16_be(pd->h_size, v);
6491 if (caps->overcoat && *((const char*)((pd->overcoat->seq).data)) != 0x00) {
6492 stp_put16_be(pd->w_size, v);
6493 if (model == 0x00 || model == 0x90) {
6494 pd->privdata.m70x.overcoat_offset = 0;
6495 if (!pd->privdata.m70x.quality)
6496 pd->privdata.m70x.quality = 4; /* Matte Lamination forces UltraFine on K60 or K305 */
6497 } else {
6498 /* Overcoat a slightly larger boundary in Matte mode */
6499 pd->privdata.m70x.overcoat_offset = 12;
6500 if (!pd->privdata.m70x.quality)
6501 pd->privdata.m70x.quality = 3; /* Matte Lamination forces Superfine (or UltraFine) */
6502 }
6503 stp_put16_be(pd->h_size + pd->privdata.m70x.overcoat_offset, v);
6504 } else {
6505 /* Glossy lamination here */
6506 stp_put16_be(0, v);
6507 stp_put16_be(0, v);
6508 }
6509 stp_putc(pd->privdata.m70x.quality, v);
6510 dyesub_nputc(v, 0x00, 7);
6511
6512 if (model == 0x01) {
6513 stp_putc(pd->privdata.m70x.deck, v); /* D70x: 0x00 Auto deck selection, 0x01 for Lower, 0x02 for Upper. */
6514 } else {
6515 stp_putc(0x01, v); /* All others have a single "lower" deck */
6516 }
6517 dyesub_nputc(v, 0x00, 7);
6518
6519 stp_putc(0x00, v); /* Lamination always enabled */
6520
6521 if (caps->overcoat) {
6522 stp_zfwrite((pd->overcoat->seq).data, 1,
6523 (pd->overcoat->seq).bytes, v); /* Lamination mode */
6524 } else {
6525 stp_putc(0x00, v);
6526 }
6527 dyesub_nputc(v, 0x00, 6);
6528
6529 /* Multi-cut control */
6530 if (strcmp(pd->pagesize,"w432h576-div2") == 0) {
6531 stp_putc(0x01, v);
6532 #if 0
6533 } else if (strcmp(pd->pagesize,"w432h648-div2") == 0) {
6534 stp_putc(0x02, v);
6535 } else if (strcmp(pd->pagesize,"w432h648-div3") == 0) {
6536 stp_putc(0x03, v);
6537 } else if (strcmp(pd->pagesize,"w432h576-div4") == 0) {
6538 stp_putc(0x04, v);
6539 #endif
6540 } else if (strcmp(pd->pagesize,"w288h576-div2") == 0) {
6541 stp_putc(0x01, v);
6542 } else if (strcmp(pd->pagesize,"w360h504-div2") == 0) {
6543 stp_putc(0x01, v);
6544 } else if (strcmp(pd->pagesize,"w288h432-div2") == 0) {
6545 stp_putc(0x05, v);
6546 } else {
6547 stp_putc(0x00, v);
6548 }
6549 dyesub_nputc(v, 0x00, 12);
6550 /* The next four bytes are EXTENSIONS, backend consumes! */
6551 stp_putc(pd->privdata.m70x.sharpen, v);
6552 stp_putc(0x01, v); /* Mark as 8bpp BGR rather than 16bpp YMC cooked */
6553 stp_putc(pd->privdata.m70x.use_lut, v); /* Use LUT? */
6554 stp_putc(0x01, v); /* Tell the backend the data's in the proper order */
6555 stp_putc(pd->copies, v); /* Number of copies to create */
6556 /* end extension */
6557 dyesub_nputc(v, 0x00, 446); /* Pad to 512-byte block */
6558 }
6559
6560 static void mitsu_cpd70x_printer_init(stp_vars_t *v)
6561 {
6562 mitsu_cpd70k60_printer_init(v, 0x01);
6563 }
6564
6565 /* Mitsubishi CP-K60D */
6566 static const dyesub_pagesize_t mitsu_cpk60_page[] =
6567 {
6568 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1076,300), PT(1568,300), DYESUB_LANDSCAPE),
6569 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1218,300), PT(1864,300), DYESUB_LANDSCAPE),
6570 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1218,300), PT(1864,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
6571 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1568,300), PT(2128,300), DYESUB_PORTRAIT),
6572 DEFINE_PAPER_SIMPLE( "w360h504-div2", "3.5x5*2", PT(1568,300), PT(2190,300), DYESUB_PORTRAIT),
6573 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1820,300), PT(1864,300), DYESUB_LANDSCAPE),
6574 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1864,300), PT(2422,300), DYESUB_PORTRAIT),
6575 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(1864,300), PT(2454,300), DYESUB_PORTRAIT),
6576 };
6577
6578 LIST(dyesub_pagesize_list_t, mitsu_cpk60_page_list, dyesub_pagesize_t, mitsu_cpk60_page);
6579
6580 static const dyesub_printsize_t mitsu_cpk60_printsize[] =
6581 {
6582 { "300x300", "B7", 1076, 1568},
6583 { "300x300", "w288h432", 1218, 1864},
6584 { "300x300", "w288h432-div2", 1218, 1864},
6585 { "300x300", "w360h504", 1568, 2128},
6586 { "300x300", "w360h504-div2", 1568, 2190},
6587 { "300x300", "w432h432", 1820, 1864},
6588 { "300x300", "w432h576", 1864, 2422},
6589 { "300x300", "w432h576-div2", 1864, 2454},
6590 };
6591
6592 LIST(dyesub_printsize_list_t, mitsu_cpk60_printsize_list, dyesub_printsize_t, mitsu_cpk60_printsize);
6593
6594 static void mitsu_cpk60_printer_init(stp_vars_t *v)
6595 {
6596 mitsu_cpd70k60_printer_init(v, 0x00);
6597 }
6598
6599 /* Identical to the D70 except for one fewer quality mode */
6600 static const dyesub_stringitem_t mitsu_k60_qualities[] =
6601 {
6602 { "Fine", N_ ("Fine") },
6603 { "UltraFine", N_ ("Ultra Fine") }
6604 };
6605 LIST(dyesub_stringlist_t, mitsu_k60_quality_list, dyesub_stringitem_t, mitsu_k60_qualities);
6606
6607 static int
6608 mitsu_k60_load_parameters(const stp_vars_t *v, const char *name,
6609 stp_parameter_t *description)
6610 {
6611 unsigned int i;
6612 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
6613 stp_get_model_id(v));
6614
6615 if (caps->parameter_count && caps->parameters)
6616 {
6617 for (i = 0; i < caps->parameter_count; i++)
6618 if (strcmp(name, caps->parameters[i].name) == 0)
6619 {
6620 stp_fill_parameter_settings(description, &(caps->parameters[i]));
6621 break;
6622 }
6623 }
6624
6625 if (strcmp(name, "PrintSpeed") == 0)
6626 {
6627 description->bounds.str = stp_string_list_create();
6628
6629 const dyesub_stringlist_t *mlist = &mitsu_k60_quality_list;
6630 for (i = 0; i < mlist->n_items; i++)
6631 {
6632 const dyesub_stringitem_t *m = &(mlist->item[i]);
6633 stp_string_list_add_string(description->bounds.str,
6634 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
6635 }
6636 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
6637 description->is_active = 1;
6638 }
6639 else if (strcmp(name, "UseLUT") == 0)
6640 {
6641 description->deflt.boolean = 0;
6642 description->is_active = 1;
6643 }
6644 else if (strcmp(name, "Sharpen") == 0)
6645 {
6646 description->deflt.integer = 4;
6647 description->bounds.integer.lower = 0;
6648 description->bounds.integer.upper = 9;
6649 description->is_active = 1;
6650 }
6651 else
6652 {
6653 return 0;
6654 }
6655 return 1;
6656 }
6657
6658 static const dyesub_pagesize_t mitsu_cpd80_page[] =
6659 {
6660 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1228,300), PT(1864,300), DYESUB_LANDSCAPE),
6661 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1228,300), PT(1864,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
6662 DEFINE_PAPER_SIMPLE( "w360h360", "5x5", PT(1524,300), PT(1568,300), DYESUB_LANDSCAPE),
6663 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1568,300), PT(2128,300), DYESUB_PORTRAIT),
6664 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1864,300), PT(1820,300), DYESUB_PORTRAIT),
6665 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1864,300), PT(2422,300), DYESUB_PORTRAIT),
6666 DEFINE_PAPER( "w432h576-div2", "4x6*2", PT(1864,300), PT(2730,300), 0, 0, PT(236,300), 0, DYESUB_PORTRAIT),
6667 };
6668
6669 LIST(dyesub_pagesize_list_t, mitsu_cpd80_page_list, dyesub_pagesize_t, mitsu_cpd80_page);
6670
6671 static const dyesub_printsize_t mitsu_cpd80_printsize[] =
6672 {
6673 { "300x300", "w288h432", 1228, 1864},
6674 { "300x300", "w288h432-div2", 1228, 1864},
6675 { "300x300", "w360h360", 1524, 1568},
6676 { "300x300", "w360h504", 1568, 2128},
6677 { "300x300", "w432h432", 1864, 1820},
6678 { "300x300", "w432h576", 1864, 2422},
6679 { "300x300", "w432h576-div2", 1864, 2730},
6680 };
6681
6682 LIST(dyesub_printsize_list_t, mitsu_cpd80_printsize_list, dyesub_printsize_t, mitsu_cpd80_printsize);
6683
6684 /* DNP DS480 */
6685
6686 static const dyesub_pagesize_t dnp_ds480_page[] =
6687 {
6688 DEFINE_PAPER_SIMPLE("w288h288", "4x4", PT(1228,300), PT(1264,300), DYESUB_LANDSCAPE),
6689 DEFINE_PAPER_SIMPLE("w288h382", "4x5.3", PT(1264,300), PT(1614,300), DYESUB_PORTRAIT),
6690 // DEFINE_PAPER_SIMPLE("w288h432", "4x6", PT(1264,300), PT(1828,300), DYESUB_PORTRAIT),
6691 DEFINE_PAPER_SIMPLE("w288h576", "4x8", PT(1264,300), PT(2422,300), DYESUB_PORTRAIT),
6692 DEFINE_PAPER_SIMPLE("w288h576-div2", "4x4*2", PT(1264,300), PT(2494,300), DYESUB_PORTRAIT),
6693 };
6694
6695 LIST(dyesub_pagesize_list_t, dnp_ds480_page_list, dyesub_pagesize_t, dnp_ds480_page);
6696
6697 static const dyesub_printsize_t dnp_ds480_printsize[] =
6698 {
6699 { "300x300", "w288h288", 1228, 1264},
6700 { "300x300", "w288h382", 1264, 1614},
6701 // { "300x300", "w288h432", 1264, 1828},
6702 { "300x300", "w288h576", 1264, 2422},
6703 { "300x300", "w288h576-div2", 1264, 2494},
6704 };
6705
6706 LIST(dyesub_printsize_list_t, dnp_ds480_printsize_list, dyesub_printsize_t, dnp_ds480_printsize);
6707
6708 static void dnp_ds4x0_printer_init(stp_vars_t *v)
6709 {
6710 mitsu_cpd70k60_printer_init(v, 0x04);
6711 }
6712
6713 static const dyesub_stringitem_t dnp_ds4x0_qualities[] =
6714 {
6715 { "Fine", N_ ("Fine") },
6716 { "SuperFine", N_ ("Super Fine") },
6717 };
6718 LIST(dyesub_stringlist_t, dnp_ds4x0_quality_list, dyesub_stringitem_t, dnp_ds4x0_qualities);
6719
6720 static int
6721 dnp_ds4x0_load_parameters(const stp_vars_t *v, const char *name,
6722 stp_parameter_t *description)
6723 {
6724 unsigned int i;
6725 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
6726 stp_get_model_id(v));
6727
6728 if (caps->parameter_count && caps->parameters)
6729 {
6730 for (i = 0; i < caps->parameter_count; i++)
6731 if (strcmp(name, caps->parameters[i].name) == 0)
6732 {
6733 stp_fill_parameter_settings(description, &(caps->parameters[i]));
6734 break;
6735 }
6736 }
6737
6738 if (strcmp(name, "PrintSpeed") == 0)
6739 {
6740 description->bounds.str = stp_string_list_create();
6741
6742 const dyesub_stringlist_t *mlist = &dnp_ds4x0_quality_list;
6743 for (i = 0; i < mlist->n_items; i++)
6744 {
6745 const dyesub_stringitem_t *m = &(mlist->item[i]);
6746 stp_string_list_add_string(description->bounds.str,
6747 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
6748 }
6749 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
6750 description->is_active = 1;
6751 }
6752 #ifdef MITSU70X_8BPP
6753 else if (strcmp(name, "UseLUT") == 0)
6754 {
6755 description->is_active = 1;
6756 }
6757 else if (strcmp(name, "Sharpen") == 0)
6758 {
6759 description->deflt.integer = 0;
6760 description->bounds.integer.lower = 0;
6761 description->bounds.integer.upper = 9;
6762 description->is_active = 1;
6763 }
6764 #endif
6765 else
6766 {
6767 return 0;
6768 }
6769 return 1;
6770 }
6771
6772 /* DNP DS680 */
6773
6774 static const dyesub_pagesize_t dnp_ds680_page[] =
6775 {
6776 DEFINE_PAPER_SIMPLE("w288h432", "4x6", PT(1228,300), PT(1864,300), DYESUB_LANDSCAPE),
6777 DEFINE_PAPER_SIMPLE("w360h504", "5x7", PT(1568,300), PT(2128,300), DYESUB_PORTRAIT),
6778 DEFINE_PAPER_SIMPLE("w432h576", "6x8", PT(1864,300), PT(2422,300), DYESUB_PORTRAIT),
6779 DEFINE_PAPER_SIMPLE("w432h576-div2", "4x6*2", PT(1864,300), PT(2730,300), DYESUB_PORTRAIT),
6780 };
6781
6782 LIST(dyesub_pagesize_list_t, dnp_ds680_page_list, dyesub_pagesize_t, dnp_ds680_page);
6783
6784 static const dyesub_printsize_t dnp_ds680_printsize[] =
6785 {
6786 { "300x300", "w288h432", 1228, 1864},
6787 { "300x300", "w360h504", 1568, 2128},
6788 { "300x300", "w432h576", 1864, 2422},
6789 { "300x300", "w432h576-div2", 1864, 2730},
6790 };
6791
6792 LIST(dyesub_printsize_list_t, dnp_ds680_printsize_list, dyesub_printsize_t, dnp_ds680_printsize);
6793
6794 /* Kodak 305 */
6795 static const dyesub_pagesize_t kodak305_page[] =
6796 {
6797 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1076,300), PT(1568,300), DYESUB_LANDSCAPE),
6798 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1218,300), PT(1864,300), DYESUB_LANDSCAPE),
6799 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1218,300), PT(1864,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
6800 DEFINE_PAPER_SIMPLE( "w360h360", "5x5", PT(1524,300), PT(1568,300), DYESUB_LANDSCAPE),
6801 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1568,300), PT(2128,300), DYESUB_PORTRAIT),
6802 DEFINE_PAPER_SIMPLE( "w360h504-div2", "3.5x5*2", PT(1568,300), PT(2190,300), DYESUB_PORTRAIT),
6803 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1820,300), PT(1864,300), DYESUB_LANDSCAPE),
6804 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1864,300), PT(2422,300), DYESUB_PORTRAIT),
6805 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(1864,300), PT(2454,300), DYESUB_PORTRAIT),
6806 };
6807
6808 LIST(dyesub_pagesize_list_t, kodak305_page_list, dyesub_pagesize_t, kodak305_page);
6809
6810 static const dyesub_printsize_t kodak305_printsize[] =
6811 {
6812 { "300x300", "B7", 1076, 1568},
6813 { "300x300", "w288h432", 1218, 1864},
6814 { "300x300", "w288h432-div2", 1218, 1864},
6815 { "300x300", "w360h360", 1524, 1568},
6816 { "300x300", "w360h504", 1568, 2128},
6817 { "300x300", "w360h504-div2", 1568, 2190},
6818 { "300x300", "w432h432", 1820, 1864},
6819 { "300x300", "w432h576", 1864, 2422},
6820 { "300x300", "w432h576-div2", 1864, 2454},
6821 };
6822
6823 LIST(dyesub_printsize_list_t, kodak305_printsize_list, dyesub_printsize_t, kodak305_printsize);
6824
6825 static void kodak305_printer_init(stp_vars_t *v)
6826 {
6827 mitsu_cpd70k60_printer_init(v, 0x90);
6828 }
6829
6830 /* Mitsubishi CP-D90DW family */
6831 static const dyesub_pagesize_t mitsu_cpd90_page[] =
6832 {
6833 DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT(625,300), PT(1852,300), DYESUB_LANDSCAPE),
6834 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1076,300), PT(1550,300), DYESUB_LANDSCAPE),
6835 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1226,300), PT(1852,300), DYESUB_LANDSCAPE),
6836 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1226,300), PT(1852,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
6837 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1550,300), PT(2128,300), DYESUB_PORTRAIT),
6838 // XXX add 5x7-div2
6839 DEFINE_PAPER_SIMPLE( "w360h360", "5x5", PT(1527,300), PT(1550,300), DYESUB_LANDSCAPE),
6840 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1827,300), PT(1852,300), DYESUB_LANDSCAPE),
6841 // XXX add 6x6+2x6!
6842 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1852,300), PT(2428,300), DYESUB_PORTRAIT),
6843 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(1852,300), PT(2488,300), DYESUB_PORTRAIT),
6844 DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT(1852,300), PT(2568,300), DYESUB_PORTRAIT),
6845 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1852,300), PT(2729,300), DYESUB_PORTRAIT),
6846 DEFINE_PAPER_SIMPLE( "w432h648-div2", "4.4x6*2", PT(1852,300), PT(2728,300), DYESUB_PORTRAIT),
6847 DEFINE_PAPER_SIMPLE( "w432h648-div3", "3x6*2", PT(1852,300), PT(2724,300), DYESUB_PORTRAIT),
6848 DEFINE_PAPER_SIMPLE( "w432h648-div4", "2x6*4", PT(1852,300), PT(2628,300), DYESUB_PORTRAIT),
6849 DEFINE_PAPER_SIMPLE( "w432h1008", "6x14 panorama", PT(1852,300), PT(4228,300), DYESUB_PORTRAIT),
6850 DEFINE_PAPER_SIMPLE( "w432h1440", "6x20 panorama", PT(1852,300), PT(6028,300), DYESUB_PORTRAIT),
6851 };
6852
6853 LIST(dyesub_pagesize_list_t, mitsu_cpd90_page_list, dyesub_pagesize_t, mitsu_cpd90_page);
6854
6855 static const dyesub_printsize_t mitsu_cpd90_printsize[] =
6856 {
6857 { "300x300", "w144h432", 625, 1852},
6858 { "300x300", "B7", 1076, 1550},
6859 { "300x300", "w288h432", 1226, 1852},
6860 { "300x300", "w288h432-div2", 1226, 1852},
6861 { "300x300", "w360h360", 1527, 1550},
6862 { "300x300", "w360h504", 1550, 2128},
6863 // XXX add 5x7-div2
6864 { "300x300", "w432h432", 1827, 1852},
6865 // XXX add 6x6+2x6!
6866 { "300x300", "w432h576", 1852, 2428},
6867 { "300x300", "w432h576-div2", 1852, 2488},
6868 { "300x300", "w432h612", 1852, 2568},
6869 { "300x300", "w432h648", 1852, 2729}, // XXX is this right?
6870 { "300x300", "w432h648-div2", 1852, 2728}, // XXX ???
6871 { "300x300", "w432h648-div3", 1852, 2724}, //
6872 { "300x300", "w432h648-div4", 1852, 2628}, //
6873 { "300x300", "w432h1008", 1852, 4228},
6874 { "300x300", "w432h1440", 1852, 6028},
6875 };
6876 LIST(dyesub_printsize_list_t, mitsu_cpd90_printsize_list, dyesub_printsize_t, mitsu_cpd90_printsize);
6877
6878 static const dyesub_stringitem_t mitsu_d90_qualities[] =
6879 {
6880 { "Auto", N_ ("Automatic") },
6881 { "Fine", N_ ("Fine") },
6882 { "UltraFine", N_ ("Ultra Fine") }
6883 };
6884 LIST(dyesub_stringlist_t, mitsu_d90_quality_list, dyesub_stringitem_t, mitsu_d90_qualities);
6885
6886 static const stp_parameter_t mitsu_d90_parameters[] =
6887 {
6888 {
6889 "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
6890 N_("Print Speed"),
6891 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
6892 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6893 },
6894 {
6895 "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
6896 N_("Use Internal Color Correction"),
6897 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
6898 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6899 },
6900 {
6901 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
6902 N_("Sharpening to apply to image (0 is off, 1 is min, 9 is max"),
6903 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
6904 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6905 },
6906 {
6907 "ComboWait", N_("Combo Print Wait Time"), "Color=No,Category=Advanced Printer Setup",
6908 N_("How many seconds to wait for a second print before starting"),
6909 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
6910 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
6911 },
6912 {
6913 "MarginCutOff", N_("Disable Margin Cut"), "Color=No,Category=Advanced Printer Setup",
6914 N_("Disable Margin Cut"),
6915 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
6916 STP_PARAMETER_LEVEL_ADVANCED, 1, 0, STP_CHANNEL_NONE, 1, 0
6917 },
6918 };
6919 #define mitsu_d90_parameter_count (sizeof(mitsu_d90_parameters) / sizeof(const stp_parameter_t))
6920
6921 static int
6922 mitsu_d90_load_parameters(const stp_vars_t *v, const char *name,
6923 stp_parameter_t *description)
6924 {
6925 unsigned int i;
6926 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
6927 stp_get_model_id(v));
6928
6929 if (caps->parameter_count && caps->parameters)
6930 {
6931 for (i = 0; i < caps->parameter_count; i++)
6932 if (strcmp(name, caps->parameters[i].name) == 0)
6933 {
6934 stp_fill_parameter_settings(description, &(caps->parameters[i]));
6935 break;
6936 }
6937 }
6938
6939 if (strcmp(name, "PrintSpeed") == 0)
6940 {
6941 description->bounds.str = stp_string_list_create();
6942
6943 const dyesub_stringlist_t *mlist = &mitsu_d90_quality_list;
6944 for (i = 0; i < mlist->n_items; i++)
6945 {
6946 const dyesub_stringitem_t *m = &(mlist->item[i]);
6947 stp_string_list_add_string(description->bounds.str,
6948 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
6949 }
6950 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
6951 description->is_active = 1;
6952 }
6953 else if (strcmp(name, "UseLUT") == 0)
6954 {
6955 description->deflt.boolean = 1;
6956 description->is_active = 1;
6957 }
6958 else if (strcmp(name, "Sharpen") == 0)
6959 {
6960 description->deflt.integer = 4;
6961 description->bounds.integer.lower = 0;
6962 description->bounds.integer.upper = 9;
6963 description->is_active = 1;
6964 }
6965 else if (strcmp(name, "ComboWait") == 0)
6966 {
6967 description->deflt.integer = 5;
6968 description->bounds.integer.lower = 0;
6969 description->bounds.integer.upper = 100;
6970 description->is_active = 1;
6971 }
6972 else if (strcmp(name, "MarginCutOff") == 0)
6973 {
6974 description->deflt.boolean = 0;
6975 description->is_active = 1;
6976 }
6977 else
6978 {
6979 return 0;
6980 }
6981 return 1;
6982 }
6983
6984 static int mitsu_d90_parse_parameters(stp_vars_t *v)
6985 {
6986 const char *quality = stp_get_string_parameter(v, "PrintSpeed");
6987 dyesub_privdata_t *pd = get_privdata(v);
6988
6989 /* No need to set global params if there's no privdata yet */
6990 if (!pd)
6991 return 1;
6992
6993 /* Parse options */
6994 if (strcmp(quality, "UltraFine") == 0) {
6995 pd->privdata.m70x.quality = 3;
6996 } else if (strcmp(quality, "Fine") == 0) {
6997 pd->privdata.m70x.quality = 2;
6998 } else {
6999 pd->privdata.m70x.quality = 0;
7000 }
7001
7002 pd->privdata.m70x.use_lut = !stp_get_boolean_parameter(v, "UseLUT");
7003 pd->privdata.m70x.sharpen = stp_get_int_parameter(v, "Sharpen");
7004 pd->privdata.m70x.delay = stp_get_int_parameter(v, "ComboWait");
7005 pd->privdata.m70x.margincutoff = stp_get_boolean_parameter(v, "MarginCutOff");
7006
7007 return 1;
7008 }
7009
7010 static void mitsu_cpdneo_printer_init(stp_vars_t *v, int m1)
7011 {
7012 dyesub_privdata_t *pd = get_privdata(v);
7013
7014 /* Start things going */
7015 stp_putc(0x1b, v);
7016 stp_putc(0x53, v);
7017 stp_putc(0x50, v);
7018 stp_putc(0x30, v);
7019 stp_putc(0x00, v);
7020 stp_putc(0x33, v);
7021 stp_put16_be(pd->w_size, v); /* Columns */
7022 stp_put16_be(pd->h_size, v); /* Rows */
7023 stp_putc(0x64, v); /* Wait Time, Theoretically configurable */
7024 stp_putc(0x00, v);
7025 stp_putc(0x00, v);
7026 stp_putc(0x01, v);
7027 stp_putc(pd->privdata.m70x.margincutoff, v);
7028
7029 if (strcmp(pd->pagesize,"w432h576-div2") == 0) {
7030 stp_putc(0x01, v); /* NumCuts */
7031 stp_put16_be(0x04be, v);
7032 stp_putc(0x00, v); /* MarginCut */
7033 stp_putc(0x00, v); /* Pad */
7034 dyesub_nputc(v, 0x00, 28);
7035 } else if (strcmp(pd->pagesize,"w288h432-div2") == 0) {
7036 stp_putc(0x01, v); /* NumCuts */
7037 stp_put16_be(0x0265, v);
7038 stp_putc(0x01, v); /* Margin Cut */
7039 stp_putc(0x00, v); /* Pad */
7040 dyesub_nputc(v, 0x00, 28);
7041 } else if (strcmp(pd->pagesize,"w432h648-div2") == 0) {
7042 stp_putc(0x01, v); /* NumCuts */
7043 stp_put16_be(0x0536, v);
7044 stp_putc(0x00, v); /* MarginCut */
7045 stp_putc(0x00, v); /* Pad */
7046 dyesub_nputc(v, 0x00, 28);
7047 } else if (strcmp(pd->pagesize,"w432h648-div3") == 0) {
7048 stp_putc(0x02, v); /* NumCuts */
7049 stp_put16_be(0x0390, v);
7050 stp_putc(0x01, v); /* MarginCut */
7051 stp_putc(0x00, v); /* Pad */
7052 stp_put16_be(0x0714, v);
7053 stp_putc(0x01, v); /* MarginCut */
7054 stp_putc(0x00, v); /* Pad */
7055 dyesub_nputc(v, 0x00, 24);
7056 } else if (strcmp(pd->pagesize,"w432h648-div4") == 0) {
7057 stp_putc(0x03, v); /* NumCuts */
7058 stp_put16_be(0x0297, v);
7059 stp_putc(0x01, v); /* MarginCut */
7060 stp_putc(0x00, v); /* Pad */
7061 stp_put16_be(0x0522, v);
7062 stp_putc(0x01, v); /* MarginCut */
7063 stp_putc(0x00, v); /* Pad */
7064 stp_put16_be(0x07ad, v);
7065 stp_putc(0x01, v); /* MarginCut */
7066 stp_putc(0x00, v); /* Pad */
7067 dyesub_nputc(v, 0x00, 20);
7068 } else {
7069 stp_putc(0x00, v); /* NumCuts */
7070 dyesub_nputc(v, 0x00, 32);
7071 }
7072
7073 /* @ 0x30 */
7074 stp_zfwrite((pd->overcoat->seq).data, 1,
7075 (pd->overcoat->seq).bytes, v); /* Lamination mode */
7076 stp_putc(pd->privdata.m70x.quality, v);
7077 stp_putc(pd->privdata.m70x.use_lut, v);
7078 stp_putc(pd->privdata.m70x.sharpen, v); /* Horizontal */
7079 stp_putc(pd->privdata.m70x.sharpen, v); /* Vertical */
7080 dyesub_nputc(v, 0x00, 3);
7081
7082 /* @ 0x38 */
7083 if (m1) {
7084 stp_putc(0x01, v); /* Tells backend that we need to process this */
7085 stp_put16_be(2, v);
7086 } else {
7087 if (strcmp(pd->pagesize,"w432h1008") == 0 ||
7088 strcmp(pd->pagesize,"w432h1440") == 0) {
7089 stp_putc(0x01, v); /* Backend needs to process a this */
7090 stp_put16_be(3, v); /* It's a panorama, yo! */
7091 } else {
7092 stp_putc(0x00, v); /* No panorama */
7093 stp_put16_be(0, v);
7094 }
7095 }
7096 /* @ 0x3b */
7097 dyesub_nputc(v, 0x00, 20);
7098 stp_putc(pd->copies, v); /* EXTENSION */
7099
7100 /* @0x50, zero fill to 512 byte boundary. */
7101 dyesub_nputc(v, 0x00, 512 - 80);
7102
7103 /* Data Plane header */
7104 stp_putc(0x1b, v);
7105 stp_putc(0x5a, v);
7106 stp_putc(0x54, v);
7107 stp_putc(0x01, v);
7108 stp_putc(0x00, v);
7109 stp_putc(0x09, v);
7110 dyesub_nputc(v, 0x00, 4);
7111 stp_put16_be(pd->w_size, v); /* Columns */
7112 stp_put16_be(pd->h_size, v); /* Rows */
7113 dyesub_nputc(v, 0x00, 2);
7114 /* @0x10 */
7115 dyesub_nputc(v, 0x00, 512 - 16);
7116 }
7117
7118 static void mitsu_cpd90_printer_init(stp_vars_t *v)
7119 {
7120 mitsu_cpdneo_printer_init(v, 0);
7121 }
7122
7123 static void mitsu_cpd90_job_end(stp_vars_t *v)
7124 {
7125 int delay;
7126
7127 if (stp_check_int_parameter(v, "ComboWait", STP_PARAMETER_ACTIVE))
7128 delay = stp_get_int_parameter(v, "ComboWait");
7129 else
7130 delay = 5;
7131
7132 if (delay == 0)
7133 delay = 0xff;
7134
7135 /* Wrap it up */
7136 stp_putc(0x1b, v);
7137 stp_putc(0x42, v);
7138 stp_putc(0x51, v);
7139 stp_putc(0x31, v);
7140 stp_put16_be(delay, v);
7141 }
7142
7143 /* Mitsubishi CP-M1 family */
7144 static const dyesub_pagesize_t mitsu_cpm1_page[] =
7145 {
7146 DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT(631,300), PT(1852,300), DYESUB_LANDSCAPE),
7147 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1082,300), PT(1550,300), DYESUB_LANDSCAPE),
7148 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1232,300), PT(1852,300), DYESUB_LANDSCAPE),
7149 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1232,300), PT(1852,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
7150 DEFINE_PAPER_SIMPLE( "w360h360", "5x5", PT(1533,300), PT(1550,300), DYESUB_LANDSCAPE),
7151 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1550,300), PT(2134,300), DYESUB_PORTRAIT),
7152 // XXX add 5x7-div2
7153 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1833,300), PT(1852,300), DYESUB_LANDSCAPE),
7154 // XXX add 6x6+2x6?
7155 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1852,300), PT(2434,300), DYESUB_PORTRAIT),
7156 DEFINE_PAPER( "w432h576-div2", "4x6*2", PT(1852,300), PT1(2434,300), 0, 0, 0, PT1(0, 300), DYESUB_PORTRAIT),
7157 // DEFINE_PAPER_SIMPLE( "w432h576-div4", "2x6*4", PT(1852,300), PT(2628,300), DYESUB_PORTRAIT),
7158 };
7159
7160 LIST(dyesub_pagesize_list_t, mitsu_cpm1_page_list, dyesub_pagesize_t, mitsu_cpm1_page);
7161
7162 static const dyesub_printsize_t mitsu_cpm1_printsize[] =
7163 {
7164 { "300x300", "w144h432", 631, 1852},
7165 { "300x300", "B7", 1082, 1550},
7166 { "300x300", "w288h432", 1232, 1852},
7167 { "300x300", "w288h432-div2", 1232, 1852},
7168 { "300x300", "w360h360", 1533, 1550},
7169 { "300x300", "w360h504", 1550, 2134},
7170 // XXX add 5x7-div2
7171 { "300x300", "w432h432", 1833, 1852},
7172 // XXX add 6x6+2x6!
7173 { "300x300", "w432h576", 1852, 2434},
7174 { "300x300", "w432h576-div2", 1852, 2434},
7175 // { "300x300", "w432h576-div4", 1852, 2488},
7176 };
7177 LIST(dyesub_printsize_list_t, mitsu_cpm1_printsize_list, dyesub_printsize_t, mitsu_cpm1_printsize);
7178
7179 static const overcoat_t mitsu_cpm1_overcoat[] =
7180 {
7181 {"Glossy", N_("Glossy"), {1, "\x00"}},
7182 {"Matte", N_("Matte"), {1, "\x03"}},
7183 };
7184
7185 LIST(overcoat_list_t, mitsu_cpm1_overcoat_list, overcoat_t, mitsu_cpm1_overcoat);
7186
7187 static const stp_parameter_t mitsu_cpm1_parameters[] =
7188 {
7189 {
7190 "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
7191 N_("Print Speed"),
7192 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
7193 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
7194 },
7195 {
7196 "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
7197 N_("Use Internal Color Correction"),
7198 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
7199 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
7200 },
7201 {
7202 "ColorMatching", N_("Color Matching"), "Color=Yes,Category=Advanced Printer Setup",
7203 N_("Enable if color matched flow (ICC profile) is being used"),
7204 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
7205 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
7206 },
7207 {
7208 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
7209 N_("Sharpening to apply to image (0 is off, 1 is min, 7 is max"),
7210 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
7211 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
7212 },
7213 {
7214 "ComboWait", N_("Combo Print Wait Time"), "Color=No,Category=Advanced Printer Setup",
7215 N_("How many seconds to wait for a second print before starting"),
7216 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
7217 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
7218 },
7219 {
7220 "MarginCutOff", N_("Disable Margin Cut"), "Color=No,Category=Advanced Printer Setup",
7221 N_("Disable Margin Cut"),
7222 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
7223 STP_PARAMETER_LEVEL_ADVANCED, 1, 0, STP_CHANNEL_NONE, 1, 0
7224 },
7225 };
7226 #define mitsu_cpm1_parameter_count (sizeof(mitsu_cpm1_parameters) / sizeof(const stp_parameter_t))
7227
7228 static const dyesub_stringitem_t mitsu_cpm1_qualities[] =
7229 {
7230 { "Auto", N_ ("Automatic") },
7231 { "Fast", N_ ("Fast") },
7232 };
7233 LIST(dyesub_stringlist_t, mitsu_cpm1_quality_list, dyesub_stringitem_t, mitsu_cpm1_qualities);
7234
7235 static const dyesub_stringitem_t mitsu_cpm1_colormatches[] =
7236 {
7237 { "Off", N_ ("Off") },
7238 { "Natural", N_ ("Natural") },
7239 { "Vivid", N_ ("Vivid") }
7240 };
7241 LIST(dyesub_stringlist_t, mitsu_cpm1_colormatch_list, dyesub_stringitem_t, mitsu_cpm1_colormatches);
7242
7243 static int
7244 mitsu_cpm1_load_parameters(const stp_vars_t *v, const char *name,
7245 stp_parameter_t *description)
7246 {
7247 unsigned int i;
7248 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
7249 stp_get_model_id(v));
7250
7251 if (caps->parameter_count && caps->parameters)
7252 {
7253 for (i = 0; i < caps->parameter_count; i++)
7254 if (strcmp(name, caps->parameters[i].name) == 0)
7255 {
7256 stp_fill_parameter_settings(description, &(caps->parameters[i]));
7257 break;
7258 }
7259 }
7260
7261 if (strcmp(name, "PrintSpeed") == 0)
7262 {
7263 description->bounds.str = stp_string_list_create();
7264
7265 const dyesub_stringlist_t *mlist = &mitsu_cpm1_quality_list;
7266 for (i = 0; i < mlist->n_items; i++)
7267 {
7268 const dyesub_stringitem_t *m = &(mlist->item[i]);
7269 stp_string_list_add_string(description->bounds.str,
7270 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
7271 }
7272 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
7273 description->is_active = 1;
7274 }
7275 else if (strcmp(name, "UseLUT") == 0)
7276 {
7277 description->deflt.boolean = 1;
7278 description->is_active = 1;
7279 }
7280 else if (strcmp(name, "ColorMatching") == 0)
7281 {
7282 description->bounds.str = stp_string_list_create();
7283
7284 const dyesub_stringlist_t *mlist = &mitsu_cpm1_colormatch_list;
7285 for (i = 0; i < mlist->n_items; i++)
7286 {
7287 const dyesub_stringitem_t *m = &(mlist->item[i]);
7288 stp_string_list_add_string(description->bounds.str,
7289 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
7290 }
7291 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
7292 description->is_active = 1;
7293 }
7294 else if (strcmp(name, "Sharpen") == 0)
7295 {
7296 description->deflt.integer = 4;
7297 description->bounds.integer.lower = 0;
7298 description->bounds.integer.upper = 7;
7299 description->is_active = 1;
7300 }
7301 else if (strcmp(name, "ComboWait") == 0)
7302 {
7303 description->deflt.integer = 5;
7304 description->bounds.integer.lower = 0;
7305 description->bounds.integer.upper = 100;
7306 description->is_active = 1;
7307 }
7308 else if (strcmp(name, "MarginCutOff") == 0)
7309 {
7310 description->deflt.boolean = 0;
7311 description->is_active = 1;
7312 }
7313 else
7314 {
7315 return 0;
7316 }
7317 return 1;
7318 }
7319
7320 static int mitsu_cpm1_parse_parameters(stp_vars_t *v)
7321 {
7322 dyesub_privdata_t *pd = get_privdata(v);
7323 int use_lut = stp_get_boolean_parameter(v, "UseLUT");
7324 const char *matching = stp_get_string_parameter(v, "ColorMatching");
7325 const char *quality = stp_get_string_parameter(v, "PrintSpeed");
7326 int match;
7327
7328 if (use_lut && strcmp(matching, "Off")) {
7329 stp_eprintf(v, _("Cannot use Internal Correction and Color Matching together!\n"));
7330 return 0;
7331 } else if (use_lut && !strcmp(matching, "Off")) {
7332 match = 0;
7333 } else if (!use_lut && strcmp(matching, "Off")) {
7334 match = 2;
7335 } else if (!use_lut && strcmp(matching, "Vivid")) {
7336 match = 3;
7337 } else { /* "Natural" */
7338 match = 1;
7339 }
7340
7341 /* No need to set global params if there's no privdata yet */
7342 if (!pd)
7343 return 1;
7344
7345 /* Parse options */
7346 if (strcmp(quality, "Fast") == 0) {
7347 pd->privdata.m70x.quality = 5;
7348 } else {
7349 pd->privdata.m70x.quality = 0;
7350 }
7351
7352 pd->privdata.m70x.use_lut = match;
7353 pd->privdata.m70x.sharpen = stp_get_int_parameter(v, "Sharpen");
7354 pd->privdata.m70x.delay = stp_get_int_parameter(v, "ComboWait");
7355 pd->privdata.m70x.margincutoff = stp_get_boolean_parameter(v, "MarginCutOff");
7356
7357 return 1;
7358 }
7359
7360 static void mitsu_cpm1_printer_init(stp_vars_t *v)
7361 {
7362 mitsu_cpdneo_printer_init(v, 1);
7363 }
7364
7365 /* Mitsubish CP-W5000 family */
7366 static const dyesub_pagesize_t mitsu_cpw5k_page[] =
7367 {
7368 DEFINE_PAPER_SIMPLE( "w432h288", "6x4", PT(1224,300), PT(1864,300), DYESUB_LANDSCAPE),
7369 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1824,300), PT(1864,300), DYESUB_LANDSCAPE),
7370 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1824,300), PT(2464,300), DYESUB_PORTRAIT),
7371 DEFINE_PAPER_SIMPLE( "w432h576-div2", "6x4*2", PT(1824,300), PT(2524,300), DYESUB_PORTRAIT),
7372 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1824,300), PT(2764,300), DYESUB_PORTRAIT),
7373 DEFINE_PAPER_SIMPLE( "w432h864", "6x12", PT(1824,300), PT(3624,300), DYESUB_PORTRAIT),
7374 DEFINE_PAPER_SIMPLE( "w432h864-div2", "6x6*2", PT(1824,300), PT(3684,300), DYESUB_PORTRAIT),
7375 DEFINE_PAPER_SIMPLE( "w432h864-div3", "6x4*3", PT(1824,300), PT(3744,300), DYESUB_PORTRAIT),
7376
7377 DEFINE_PAPER_SIMPLE( "w490h346", "6.8x4.8", PT(1464,300), PT(2104,300), DYESUB_LANDSCAPE),
7378 DEFINE_PAPER_SIMPLE( "w490h691", "6.8x9.6", PT(2104,300), PT(2904,300), DYESUB_PORTRAIT),
7379
7380 DEFINE_PAPER_SIMPLE( "w504h360", "7x5", PT(1524,300), PT(2164,300), DYESUB_LANDSCAPE),
7381 DEFINE_PAPER_SIMPLE( "w504h720", "7x10", PT(2164,300), PT(3024,300), DYESUB_PORTRAIT),
7382 DEFINE_PAPER_SIMPLE( "w504h720-div2", "7x5*2", PT(2164,300), PT(3084,300), DYESUB_PORTRAIT),
7383
7384 DEFINE_PAPER_SIMPLE( "w576h288", "8x4", PT(1224,300), PT(2464,300), DYESUB_LANDSCAPE),
7385 DEFINE_PAPER_SIMPLE( "w576h432", "8x6", PT(1824,300), PT(2464,300), DYESUB_LANDSCAPE),
7386 DEFINE_PAPER_SIMPLE( "w576h576", "8x8", PT(2424,300), PT(2464,300), DYESUB_LANDSCAPE),
7387 DEFINE_PAPER_SIMPLE( "w576h576-div2", "8x4*2", PT(2464,300), PT(2484,300), DYESUB_PORTRAIT),
7388 DEFINE_PAPER_SIMPLE( "c8x10", "8x10", PT(2464,300), PT(3024,300), DYESUB_PORTRAIT),
7389 DEFINE_PAPER_SIMPLE( "c8x10-div2", "8x5*2", PT(2464,300), PT(3084,300), DYESUB_PORTRAIT),
7390 DEFINE_PAPER_SIMPLE( "w576h792", "8x11", PT(2464,300), PT(3324,300), DYESUB_PORTRAIT),
7391 DEFINE_PAPER_SIMPLE( "w576h842", "8x11.7", PT(2464,300), PT(3534,300), DYESUB_PORTRAIT),
7392 DEFINE_PAPER_SIMPLE( "w576h864", "8x12", PT(2464,300), PT(3624,300), DYESUB_PORTRAIT),
7393 DEFINE_PAPER_SIMPLE( "w576h864-div2", "8x6*2", PT(2464,300), PT(3684,300), DYESUB_PORTRAIT),
7394 DEFINE_PAPER_SIMPLE( "w576h864-div3", "8x4*3", PT(2464,300), PT(3744,300), DYESUB_PORTRAIT),
7395
7396 DEFINE_PAPER_SIMPLE( "Custom", "Custom", -1, -1, DYESUB_PORTRAIT),
7397 };
7398 LIST(dyesub_pagesize_list_t, mitsu_cpw5k_page_list, dyesub_pagesize_t, mitsu_cpw5k_page);
7399
7400 static const dyesub_printsize_t mitsu_cpw5k_printsize[] =
7401 {
7402 /* Each cut adds 60 pixels */
7403 { "300x300", "w432h288", 1224, 1864},
7404 { "300x300", "w432h432", 1824, 1864},
7405 { "300x300", "w432h576", 1824, 2464},
7406 { "300x300", "w432h576-div2", 1824, 2524},
7407 { "300x300", "w432h648", 1824, 2764},
7408 { "300x300", "w432h864", 1824, 3624},
7409 { "300x300", "w432h864-div2", 1824, 3684},
7410 { "300x300", "w432h864-div3", 1824, 3744},
7411
7412 { "300x300", "w490h346", 1464, 2104},
7413 { "300x300", "w490h691", 2104, 2904},
7414
7415 { "300x300", "w504h360", 1524, 2164},
7416 { "300x300", "w504h720", 2164, 3024},
7417 { "300x300", "w504h720-div2", 2164, 3084},
7418
7419 { "300x300", "w576h288", 1224, 2464},
7420 { "300x300", "w576h432", 1824, 2464},
7421 { "300x300", "w576h576", 2424, 2464},
7422 { "300x300", "w576h576-div2", 2464, 2484},
7423 { "300x300", "c8x10", 2464, 3024},
7424 { "300x300", "c8x10-div2", 2464, 3884},
7425 { "300x300", "w576h792", 2464, 3324},
7426 { "300x300", "w576h842", 2464, 3534},
7427 { "300x300", "w576h864", 2464, 3624},
7428 { "300x300", "w576h864-div2", 2464, 3684},
7429 { "300x300", "w576h864-div3", 2464, 3744},
7430
7431 { "300x300", "Custom", 2464, 3624}, /* Maximum */
7432 };
7433 LIST(dyesub_printsize_list_t, mitsu_cpw5k_printsize_list, dyesub_printsize_t, mitsu_cpw5k_printsize);
7434
7435 static const overcoat_t mitsu_cpw5k_overcoat[] =
7436 {
7437 {"Glossy", N_("Glossy"), {1, "\x00"}},
7438 {"GlossySemi", N_("Semi-Glossy"), {1, "\x01"}},
7439 {"Matte", N_("Satin"), {1, "\x02"}},
7440 };
7441
7442 LIST(overcoat_list_t, mitsu_cpw5k_overcoat_list, overcoat_t, mitsu_cpw5k_overcoat);
7443
7444 static const dyesub_stringitem_t mitsu_cpw5k_backfinishes[] =
7445 {
7446 { "None", N_ ("None") },
7447 { "Glossy", N_ ("Glossy") },
7448 { "GlossySemi", N_ ("Semi-Glossy") },
7449 { "Matte", N_ ("Satin") }
7450 };
7451 LIST(dyesub_stringlist_t, mitsu_cpw5k_backfinish_list, dyesub_stringitem_t, mitsu_cpw5k_backfinishes);
7452
7453 static const stp_parameter_t mitsu_cpw5k_parameters[] =
7454 {
7455 {
7456 "BackFinish", N_("Back Finish"), "Color=No,Category=Advanced Printer Setup",
7457 N_("Back Finish"),
7458 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
7459 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
7460 },
7461 {
7462 "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
7463 N_("Use Internal Color Correction"),
7464 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
7465 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
7466 },
7467 {
7468 "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
7469 N_("Sharpening to apply to image (0 is off, 1 is min, 9 is max"),
7470 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
7471 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
7472 },
7473 };
7474 #define mitsu_cpw5k_parameter_count (sizeof(mitsu_cpw5k_parameters) / sizeof(const stp_parameter_t))
7475
7476 static int
7477 mitsu_cpw5k_load_parameters(const stp_vars_t *v, const char *name,
7478 stp_parameter_t *description)
7479 {
7480 unsigned int i;
7481 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
7482 stp_get_model_id(v));
7483
7484 if (caps->parameter_count && caps->parameters)
7485 {
7486 for (i = 0; i < caps->parameter_count; i++)
7487 if (strcmp(name, caps->parameters[i].name) == 0)
7488 {
7489 stp_fill_parameter_settings(description, &(caps->parameters[i]));
7490 break;
7491 }
7492 }
7493 if (strcmp(name, "BackFinish") == 0)
7494 {
7495 description->bounds.str = stp_string_list_create();
7496
7497 const dyesub_stringlist_t *mlist = &mitsu_cpw5k_backfinish_list;
7498 for (i = 0; i < mlist->n_items; i++)
7499 {
7500 const dyesub_stringitem_t *m = &(mlist->item[i]);
7501 stp_string_list_add_string(description->bounds.str,
7502 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
7503 }
7504 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
7505 description->is_active = 1;
7506 }
7507 else if (strcmp(name, "UseLUT") == 0)
7508 {
7509 description->deflt.boolean = 1;
7510 description->is_active = 1;
7511 }
7512 else if (strcmp(name, "Sharpen") == 0)
7513 {
7514 description->deflt.integer = 4;
7515 description->bounds.integer.lower = 0;
7516 description->bounds.integer.upper = 8;
7517 description->is_active = 1;
7518 }
7519 else
7520 {
7521 return 0;
7522 }
7523 return 1;
7524 }
7525
7526 static int mitsu_cpw5k_parse_parameters(stp_vars_t *v)
7527 {
7528 const char *backfinish = stp_get_string_parameter(v, "BackFinish");
7529 dyesub_privdata_t *pd = get_privdata(v);
7530
7531 /* No need to set global params if there's no privdata yet */
7532 if (!pd)
7533 return 1;
7534
7535 /* Parse options */
7536 if (strcmp(backfinish, "None") == 0) {
7537 pd->privdata.m70x.backfinish = 0xff;
7538 } else if (strcmp(backfinish, "Glossy") == 0) {
7539 pd->privdata.m70x.backfinish = 0;
7540 } else if (strcmp(backfinish, "GlossySemi") == 0) {
7541 pd->privdata.m70x.backfinish = 1;
7542 } else if (strcmp(backfinish, "Matte") == 0) {
7543 pd->privdata.m70x.backfinish = 2;
7544 } else {
7545 pd->privdata.m70x.backfinish = 0;
7546 }
7547
7548 pd->privdata.m70x.use_lut = !stp_get_boolean_parameter(v, "UseLUT");
7549 pd->privdata.m70x.sharpen = stp_get_int_parameter(v, "Sharpen");
7550
7551 return 1;
7552 }
7553
7554 static void mitsu_cpw5k_printer_init(stp_vars_t *v)
7555 {
7556 dyesub_privdata_t *pd = get_privdata(v);
7557
7558 char cuts = 0;
7559 short cut1 = 0, cut2 = 0;
7560 char duplex = 0;
7561
7562 if (pd->duplex_mode) {
7563 if (strcmp(pd->duplex_mode,"None"))
7564 duplex = 1;
7565 else
7566 duplex = 0;
7567 }
7568
7569 if (!strcmp(pd->pagesize,"w432h576-div2")) {
7570 cuts = 1;
7571 cut1 = 1212;
7572 } else if (!strcmp(pd->pagesize,"w432h864-div2")) {
7573 cuts = 1;
7574 cut1 = 1812;
7575 } else if (!strcmp(pd->pagesize,"w432h864-div3")) {
7576 cuts = 2;
7577 cut1 = 1212;
7578 cut2 = 2472;
7579 } else if (!strcmp(pd->pagesize,"w504h720-div2")) {
7580 cuts = 1;
7581 cut1 = 1512;
7582 } else if (!strcmp(pd->pagesize,"w576h576-div2")) {
7583 cuts = 1;
7584 cut1 = 1212;
7585 } else if (!strcmp(pd->pagesize,"c8x10-div2")) {
7586 cuts = 1;
7587 cut1 = 1512;
7588 } else if (!strcmp(pd->pagesize,"w576h864-div2")) {
7589 cuts = 1;
7590 cut1 = 1812;
7591 } else if (!strcmp(pd->pagesize,"w576h864-div3")) {
7592 cuts = 2;
7593 cut1 = 1212;
7594 cut2 = 2472;
7595 }
7596
7597 /* Page setup */
7598 stp_putc(0x1b, v);
7599 stp_putc(0x53, v);
7600 stp_putc(0x50, v);
7601 stp_putc(0x30, v);
7602 stp_put16_be(pd->w_size, v); /* Columns */
7603 stp_put16_be(pd->h_size, v); /* Rows */
7604 stp_putc(cuts, v);
7605 stp_put16_be(cut1, v);
7606 stp_put16_be(cut2, v);
7607 stp_putc(duplex, v);
7608 stp_zfwrite((pd->overcoat->seq).data, 1,
7609 (pd->overcoat->seq).bytes, v);
7610 stp_putc(pd->privdata.m70x.backfinish, v);
7611 dyesub_nputc(v, 0x00, 2);
7612 stp_putc(pd->privdata.m70x.use_lut, v);
7613 stp_putc(pd->privdata.m70x.sharpen, v); /* Horizontal */
7614 stp_putc(pd->privdata.m70x.sharpen, v); /* Vertical */
7615 stp_putc(pd->copies, v); /* EXTENSION */
7616 dyesub_nputc(v, 0x00, 512-22);
7617
7618 /* Plane header */
7619 stp_putc(0x1b, v);
7620 stp_putc(0x5a, v);
7621 stp_putc(0x54, v);
7622 stp_putc(0x01, v);
7623 dyesub_nputc(v, 0x00, 4);
7624 stp_put16_be(pd->w_size, v); /* Columns */
7625 stp_put16_be(pd->h_size, v); /* Rows */
7626 dyesub_nputc(v, 0x00, 512-12);
7627 }
7628
7629 static void mitsu_cpw5k_job_end(stp_vars_t *v)
7630 {
7631 stp_putc(0x1b, v);
7632 stp_putc(0x5a, v);
7633 stp_putc(0x54, v);
7634 stp_putc(0x01, v);
7635 dyesub_nputc(v, 0x00, 9);
7636 stp_putc(0x01, v);
7637 dyesub_nputc(v, 0x00, 512-14);
7638 }
7639
7640 // mitsu_cpw5k_job_end
7641 // print start header (512b)
7642
7643 /* Fujifilm ASK-300 */
7644 static const dyesub_pagesize_t fuji_ask300_page[] =
7645 {
7646 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1076,300), PT(1568,300), DYESUB_LANDSCAPE),
7647 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1228,300), PT(1864,300), DYESUB_LANDSCAPE),
7648 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1228,300), PT(1864,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
7649 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1568,300), PT(2128,300), DYESUB_PORTRAIT),
7650 DEFINE_PAPER( "w360h504-div2", "3.5x5*2", PT(1568,300), PT1(2128,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
7651 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1864,300), PT(2422,300), DYESUB_PORTRAIT),
7652 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1864,300), PT(2730,300), DYESUB_PORTRAIT),
7653 DEFINE_PAPER( "w432h576-div2", "4x6*2", PT(1864,300), PT1(2730,300), 0, 0, PT(236,300), PT1(0,300), DYESUB_PORTRAIT),
7654 };
7655
7656 LIST(dyesub_pagesize_list_t, fuji_ask300_page_list, dyesub_pagesize_t, fuji_ask300_page);
7657
7658 static const dyesub_printsize_t fuji_ask300_printsize[] =
7659 {
7660 { "300x300", "B7", 1076, 1568},
7661 { "300x300", "w288h432", 1228, 1864},
7662 { "300x300", "w288h432-div2", 1228, 1864},
7663 { "300x300", "w360h504", 1568, 2128},
7664 { "300x300", "w360h504-div2", 1568, 2128},
7665 { "300x300", "w432h576", 1864, 2422},
7666 { "300x300", "w432h648", 1864, 2730},
7667 { "300x300", "w432h576-div2", 1864, 2730},
7668 };
7669
7670 LIST(dyesub_printsize_list_t, fuji_ask300_printsize_list, dyesub_printsize_t, fuji_ask300_printsize);
7671
7672 static void fuji_ask300_printer_init(stp_vars_t *v)
7673 {
7674 mitsu_cpd70k60_printer_init(v, 0x80);
7675 }
7676
7677 /* Fujifilm ASK-2000/2500 */
7678 static const dyesub_pagesize_t fuji_ask2000_page[] =
7679 {
7680 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1074,300), PT(1536,300), DYESUB_LANDSCAPE),
7681 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1228,300), PT(1832,300), DYESUB_LANDSCAPE),
7682 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1568,300), PT(2130,300), DYESUB_PORTRAIT),
7683 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1832,300), PT(2432,300), DYESUB_PORTRAIT),
7684 DEFINE_PAPER( "w432h576-div2", "4x6*2", PT(1832,300), PT(2732,300), 0, 0, PT(236,300), 0, DYESUB_PORTRAIT),
7685 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1832,300), PT(2748,300), DYESUB_PORTRAIT),
7686 };
7687
7688 LIST(dyesub_pagesize_list_t, fuji_ask2000_page_list, dyesub_pagesize_t, fuji_ask2000_page);
7689
7690 static const dyesub_printsize_t fuji_ask2000_printsize[] =
7691 {
7692 { "300x300", "B7", 1074, 1536},
7693 { "300x300", "w288h432", 1228, 1832},
7694 { "300x300", "w360h504", 1536, 2130},
7695 { "300x300", "w432h576", 1864, 2432},
7696 { "300x300", "w432h576-div2", 1864, 2732},
7697 { "300x300", "w432h648", 1864, 2748},
7698 };
7699
7700 LIST(dyesub_printsize_list_t, fuji_ask2000_printsize_list, dyesub_printsize_t, fuji_ask2000_printsize);
7701
7702 static void fuji_ask2000_printer_init(stp_vars_t *v)
7703 {
7704 dyesub_privdata_t *pd = get_privdata(v);
7705
7706 stp_zfwrite("\x1b\x23\x00\x00\x00\x04\x00\xff\xff\xff\xff", 1, 11, v);
7707 stp_zfwrite("\x1b\x1e\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 1, 19, v);
7708 stp_zfwrite("\x1b\xee\x00\x00\x00\x02\x00", 1, 7, v);
7709 stp_put16_be(pd->copies, v);
7710 stp_zfwrite("\x1b\xe1\x00\x00\x00\x0b\x00\x00\x04\x0c\x00\x00\x00\x00", 1, 14, v);
7711 stp_put16_be(pd->w_size, v);
7712 stp_put16_be(pd->h_size, v);
7713 stp_zfwrite("\x1b\x15\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x60\x00\x00\x00\x00", 1, 16, v);
7714 stp_put16_be(pd->w_size, v);
7715 stp_put16_be(pd->h_size, v);
7716 stp_zfwrite("\x1b\xea\x00\x00\x00\x00", 1, 6, v);
7717 stp_put32_be(pd->w_size * pd->h_size * 3, v); /* Data length */
7718 stp_putc(0x00, v);
7719 }
7720
7721 static void fuji_ask2000_printer_end(stp_vars_t *v)
7722 {
7723 stp_zfwrite("\x1b\x23\x00\x00\x00\x04\x00\xff\xff\xff\xff", 1, 11, v);
7724 stp_zfwrite("\x1b\x0a\x00\x00\x00\x00\x00", 1, 7, v);
7725 // stp_zfwrite("\x1b\x23\x00\x00\x00\x04\x00\xff\xff\xff\xff", 1, 11, v);
7726 }
7727
7728 /* Fujifilm ASK-4000 */
7729 static const dyesub_pagesize_t fuji_ask4000_page[] =
7730 {
7731 DEFINE_PAPER_SIMPLE( "c8x10", "8x10", PT(2444,300), PT(3044,300), DYESUB_PORTRAIT),
7732 DEFINE_PAPER_SIMPLE( "w576h864", "8x12", PT(2444,300), PT(3644,300), DYESUB_PORTRAIT),
7733 };
7734
7735 LIST(dyesub_pagesize_list_t, fuji_ask4000_page_list, dyesub_pagesize_t, fuji_ask4000_page);
7736
7737 static const dyesub_printsize_t fuji_ask4000_printsize[] =
7738 {
7739 { "300x300", "c8x10", 2444, 3044},
7740 { "300x300", "w576h864", 2444, 3644},
7741 };
7742
7743 LIST(dyesub_printsize_list_t, fuji_ask4000_printsize_list, dyesub_printsize_t, fuji_ask4000_printsize);
7744
7745 static void fuji_ask4000_printer_init(stp_vars_t *v)
7746 {
7747 dyesub_privdata_t *pd = get_privdata(v);
7748
7749 stp_zfwrite("\x1b\x1e\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 1, 19, v);
7750 stp_zfwrite("\x1b\xee\x00\x00\x00\x02\x00", 1, 7, v);
7751 stp_put16_be(pd->copies, v);
7752 stp_zfwrite("\x1b\xe1\x00\x00\x00\x0b\x00\x00\x04\x0c\x00\x00\x00\x00", 1, 14, v);
7753 stp_put16_be(pd->w_size, v);
7754 stp_put16_be(pd->h_size, v);
7755 stp_zfwrite("\x1b\xea\x00\x00\x00\x00", 1, 6, v);
7756 stp_put32_be(pd->w_size * pd->h_size * 3, v); /* Data length */
7757 stp_putc(0x00, v);
7758 }
7759
7760 static void fuji_ask4000_printer_end(stp_vars_t *v)
7761 {
7762 stp_zfwrite("\x1b\x0a\x00\x00\x00\x00\x00", 1, 7, v);
7763 }
7764
7765 /* Shinko CHC-S9045 (experimental) */
7766 static const dyesub_pagesize_t shinko_chcs9045_page[] =
7767 {
7768 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1240,300), PT(1844,300), DYESUB_LANDSCAPE),
7769 DEFINE_PAPER_SIMPLE( "B7","3.5x5", PT(1088,300), PT(1548,300), DYESUB_LANDSCAPE),
7770 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1548,300), PT(2140,300), DYESUB_PORTRAIT),
7771 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1844,300), PT(2740,300), DYESUB_PORTRAIT),
7772 DEFINE_PAPER_SIMPLE( "w283h425", "Sticker paper", PT(1092,300), PT(1726,300), DYESUB_LANDSCAPE),
7773 };
7774
7775 LIST(dyesub_pagesize_list_t, shinko_chcs9045_page_list, dyesub_pagesize_t, shinko_chcs9045_page);
7776
7777 static const dyesub_printsize_t shinko_chcs9045_printsize[] =
7778 {
7779 { "300x300", "w288h432", 1240, 1844},
7780 { "300x300", "B7", 1088, 1548},
7781 { "300x300", "w360h504", 1548, 2140},
7782 { "300x300", "w432h648", 1844, 2740},
7783 { "300x300", "w283h425", 1092, 1726},
7784 };
7785
7786 LIST(dyesub_printsize_list_t, shinko_chcs9045_printsize_list, dyesub_printsize_t, shinko_chcs9045_printsize);
7787
7788 static void shinko_chcs9045_printer_init(stp_vars_t *v)
7789 {
7790 dyesub_privdata_t *pd = get_privdata(v);
7791
7792 char pg = '\0';
7793 char sticker = '\0';
7794
7795 stp_zprintf(v, "\033CHC\n");
7796 stp_put16_be(1, v);
7797 stp_put16_be(1, v);
7798 stp_put16_be(pd->w_size, v);
7799 stp_put16_be(pd->h_size, v);
7800 if (strcmp(pd->pagesize,"B7") == 0)
7801 pg = '\1';
7802 else if (strcmp(pd->pagesize,"w360h504") == 0)
7803 pg = '\3';
7804 else if (strcmp(pd->pagesize,"w432h576") == 0)
7805 pg = '\5';
7806 else if (strcmp(pd->pagesize,"w283h425") == 0)
7807 sticker = '\3';
7808 stp_putc(pg, v);
7809 stp_putc('\0', v);
7810 stp_putc(sticker, v);
7811 dyesub_nputc(v, '\0', 4338);
7812 }
7813
7814 /* Shinko CHC-S2145 */
7815 static const dyesub_pagesize_t shinko_chcs2145_page[] =
7816 {
7817 DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT(634,300), PT(1844,300), DYESUB_LANDSCAPE),
7818 DEFINE_PAPER_SIMPLE( "w262h414", "4x6 sticker", PT(1094,300), PT(1728,300), DYESUB_LANDSCAPE),
7819 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1240,300), PT(1844,300), DYESUB_LANDSCAPE),
7820 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1240,300), PT(1844,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
7821 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1088,300), PT(1548,300), DYESUB_LANDSCAPE),
7822 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1548,300), PT(2140,300), DYESUB_PORTRAIT),
7823 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1844,300), PT(2434,300), DYESUB_PORTRAIT),
7824 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(1844,300), PT(2492,300), DYESUB_PORTRAIT),
7825 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1844,300), PT(2740,300), DYESUB_PORTRAIT),
7826 };
7827
7828 LIST(dyesub_pagesize_list_t, shinko_chcs2145_page_list, dyesub_pagesize_t, shinko_chcs2145_page);
7829
7830 static const dyesub_printsize_t shinko_chcs2145_printsize[] =
7831 {
7832 { "300x300", "w144h432", 634, 1844},
7833 { "300x300", "w262h414", 1094, 1728},
7834 { "300x300", "w288h432", 1240, 1844},
7835 { "300x300", "w288h432-div2", 1240, 1844},
7836 { "300x300", "B7", 1088, 1548},
7837 { "300x300", "w360h504", 1548, 2140},
7838 { "300x300", "w432h576", 1844, 2434},
7839 { "300x300", "w432h576-div2", 1844, 2492},
7840 { "300x300", "w432h648", 1844, 2740},
7841 };
7842
7843 LIST(dyesub_printsize_list_t, shinko_chcs2145_printsize_list, dyesub_printsize_t, shinko_chcs2145_printsize);
7844
7845 static const overcoat_t shinko_chcs2145_overcoat[] =
7846 {
7847 {"PrinterDefault", N_("Printer Default"), {4, "\x01\0\0\0"}},
7848 {"Glossy", N_("Glossy"), {4, "\x02\0\0\0"}},
7849 {"GlossyFine", N_("Glossy Fine"), {4, "\x03\0\0\0"}},
7850 {"Matte", N_("Matte"), {4, "\x04\0\0\0"}},
7851 {"MatteFine", N_("Matte Fine"), {4, "\x05\0\0\0"}},
7852 {"ExtraGlossy", N_("Extra Glossy"), {4, "\x06\0\0\0"}},
7853 {"ExtraGlossyFine", N_("Extra Glossy Fine"), {4, "\x07\0\0\0"}},
7854 };
7855
7856 LIST(overcoat_list_t, shinko_chcs2145_overcoat_list, overcoat_t, shinko_chcs2145_overcoat);
7857
7858 static void shinko_chcs2145_printer_init(stp_vars_t *v)
7859 {
7860 dyesub_privdata_t *pd = get_privdata(v);
7861
7862 int media = 0;
7863
7864 if (strcmp(pd->pagesize,"w288h432") == 0)
7865 media = '\0';
7866 else if (strcmp(pd->pagesize,"w288h432-div2") == 0)
7867 media = '\0';
7868 else if (strcmp(pd->pagesize,"B7") == 0)
7869 media = '\1';
7870 else if (strcmp(pd->pagesize,"w360h504") == 0)
7871 media = '\3';
7872 else if (strcmp(pd->pagesize,"w432h576") == 0)
7873 media = '\6';
7874 else if (strcmp(pd->pagesize,"w432h648") == 0)
7875 media = '\5';
7876 else if (strcmp(pd->pagesize,"w432h576-div2") == 0)
7877 media = '\5';
7878 else if (strcmp(pd->pagesize,"w144h432") == 0)
7879 media = '\7';
7880
7881 stp_put32_le(0x10, v);
7882 stp_put32_le(2145, v); /* Printer Model */
7883 stp_put32_le(0x00, v);
7884 stp_put32_le(0x01, v);
7885
7886 stp_put32_le(0x64, v);
7887 stp_put32_le(0x00, v);
7888 stp_put32_le(media, v); /* Media Type */
7889 stp_put32_le(0x00, v);
7890
7891 if (strcmp(pd->pagesize,"w432h576-div2") == 0) {
7892 stp_put32_le(0x02, v);
7893 } else if (strcmp(pd->pagesize,"w288h432-div2") == 0) {
7894 stp_put32_le(0x04, v);
7895 } else {
7896 stp_put32_le(0x00, v); /* Print Method */
7897 }
7898
7899 stp_zfwrite((pd->overcoat->seq).data, 1,
7900 (pd->overcoat->seq).bytes, v); /* Print Mode */
7901 stp_put32_le(0x00, v);
7902 stp_put32_le(0x00, v);
7903
7904 stp_put32_le(0x00, v);
7905 stp_put32_le(pd->w_size, v); /* Columns */
7906 stp_put32_le(pd->h_size, v); /* Rows */
7907 stp_put32_le(pd->copies, v); /* Copies */
7908
7909 stp_put32_le(0x00, v);
7910 stp_put32_le(0x00, v);
7911 stp_put32_le(0x00, v);
7912 stp_put32_le(0xffffffce, v);
7913
7914 stp_put32_le(0x00, v);
7915 stp_put32_le(0xffffffce, v);
7916 stp_put32_le(pd->w_dpi, v); /* Dots Per Inch */
7917 stp_put32_le(0xffffffce, v);
7918
7919 stp_put32_le(0x00, v);
7920 stp_put32_le(0xffffffce, v);
7921 stp_put32_le(0x00, v);
7922 stp_put32_le(0x00, v);
7923
7924 stp_put32_le(0x00, v);
7925 }
7926
7927 static void shinko_chcs2145_printer_end(stp_vars_t *v)
7928 {
7929 stp_putc(0x04, v);
7930 stp_putc(0x03, v);
7931 stp_putc(0x02, v);
7932 stp_putc(0x01, v);
7933 }
7934
7935 /* Shinko CHC-S1245 */
7936 static const dyesub_pagesize_t shinko_chcs1245_page[] =
7937 {
7938 DEFINE_PAPER_SIMPLE( "w288h576", "8x4", PT(1229,300), PT(2446,300), DYESUB_LANDSCAPE),
7939 DEFINE_PAPER_SIMPLE( "w360h576", "8x5", PT(1530,300), PT(2446,300), DYESUB_LANDSCAPE),
7940 DEFINE_PAPER_SIMPLE( "w432h576", "8x6", PT(1831,300), PT(2446,300), DYESUB_LANDSCAPE),
7941 DEFINE_PAPER_SIMPLE( "w576h576", "8x8", PT(2436,300), PT(2446,300), DYESUB_LANDSCAPE),
7942 DEFINE_PAPER_SIMPLE( "w576h576-div2", "8x4*2", PT(2446,300), PT(2468,300), DYESUB_PORTRAIT),
7943 DEFINE_PAPER_SIMPLE( "c8x10", "8x10", PT(2446,300), PT(3036,300), DYESUB_PORTRAIT),
7944 DEFINE_PAPER_SIMPLE( "c8x10-w576h432_w576h288", "8x6+8x4", PT(2446,300), PT(3070,300), DYESUB_PORTRAIT),
7945 DEFINE_PAPER( "c8x10-div2", "8x5*2", PT(2446,300), PT1(3070,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
7946 DEFINE_PAPER_SIMPLE( "w576h864", "8x12", PT(2446,300), PT(3636,300), DYESUB_PORTRAIT),
7947 DEFINE_PAPER_SIMPLE( "w576h864-div2", "8x6*2", PT(2446,300), PT(3672,300), DYESUB_PORTRAIT),
7948 DEFINE_PAPER_SIMPLE( "w576h864-div3", "8x4*3", PT(2446,300), PT(3707,300), DYESUB_PORTRAIT),
7949 };
7950
7951 LIST(dyesub_pagesize_list_t, shinko_chcs1245_page_list, dyesub_pagesize_t, shinko_chcs1245_page);
7952
7953 static const dyesub_printsize_t shinko_chcs1245_printsize[] =
7954 {
7955 { "300x300", "w288h576", 1229, 2446},
7956 { "300x300", "w360h576", 1530, 2446},
7957 { "300x300", "w432h576", 1831, 2446},
7958 { "300x300", "w576h576", 2436, 2446},
7959 { "300x300", "w576h576-div2", 2446, 2468},
7960 { "300x300", "c8x10", 2446, 3036},
7961 { "300x300", "c8x10-w576h432_w576h288", 2446, 3070},
7962 { "300x300", "c8x10-div2", 2446, 3070},
7963 { "300x300", "w576h864", 2446, 3636},
7964 { "300x300", "w576h864-div2", 2446, 3672},
7965 { "300x300", "w576h864-div3", 2446, 3707},
7966 };
7967
7968 LIST(dyesub_printsize_list_t, shinko_chcs1245_printsize_list, dyesub_printsize_t, shinko_chcs1245_printsize);
7969
7970 static const overcoat_t shinko_chcs1245_overcoat[] =
7971 {
7972 {"PrinterDefault", N_("Printer Default"), {4, "\x01\x00\x00\x00"}},
7973 {"Glossy", N_("Glossy"), {4, "\x02\x00\x00\x00"}},
7974 {"GlossyFine", N_("Glossy Fine"), {4, "\x03\x00\x00\x00"}},
7975 {"Matte", N_("Matte"), {4, "\x04\x00\x00\x00"}},
7976 {"MatteFine", N_("Matte Fine"), {4, "\x05\x00\x00\x00"}},
7977 };
7978
7979 LIST(overcoat_list_t, shinko_chcs1245_overcoat_list, overcoat_t, shinko_chcs1245_overcoat);
7980
7981 static const dyesub_stringitem_t shinko_chcs1245_dusts[] =
7982 {
7983 { "PrinterDefault", N_ ("Printer Default") },
7984 { "Off", N_ ("Off") },
7985 { "On", N_ ("On") }
7986 };
7987 LIST(dyesub_stringlist_t, shinko_chcs1245_dust_list, dyesub_stringitem_t, shinko_chcs1245_dusts);
7988
7989 static const stp_parameter_t shinko_chcs1245_parameters[] =
7990 {
7991 {
7992 "DustRemoval", N_("Dust Removal"), "Color=No,Category=Advanced Printer Setup",
7993 N_("Print Speed"),
7994 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
7995 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
7996 },
7997 {
7998 "MatteIntensity", N_("Matte Intensity"), "Color=No,Category=Advanced Printer Setup",
7999 N_("Strength of matte lamination pattern (-25 through +25)"),
8000 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
8001 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
8002 },
8003 };
8004 #define shinko_chcs1245_parameter_count (sizeof(shinko_chcs1245_parameters) / sizeof(const stp_parameter_t))
8005
8006 static int
8007 shinko_chcs1245_load_parameters(const stp_vars_t *v, const char *name,
8008 stp_parameter_t *description)
8009 {
8010 unsigned int i;
8011 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
8012 stp_get_model_id(v));
8013
8014 if (caps->parameter_count && caps->parameters)
8015 {
8016 for (i = 0; i < caps->parameter_count; i++)
8017 if (strcmp(name, caps->parameters[i].name) == 0)
8018 {
8019 stp_fill_parameter_settings(description, &(caps->parameters[i]));
8020 break;
8021 }
8022 }
8023
8024 if (strcmp(name, "DustRemoval") == 0)
8025 {
8026 description->bounds.str = stp_string_list_create();
8027
8028 const dyesub_stringlist_t *mlist = &shinko_chcs1245_dust_list;
8029 for (i = 0; i < mlist->n_items; i++)
8030 {
8031 const dyesub_stringitem_t *m = &(mlist->item[i]);
8032 stp_string_list_add_string(description->bounds.str,
8033 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
8034 }
8035 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
8036 description->is_active = 1;
8037 }
8038 else if (strcmp(name, "MatteIntensity") == 0)
8039 {
8040 description->deflt.integer = 0;
8041 description->bounds.integer.lower = -25;
8042 description->bounds.integer.upper = 25;
8043 description->is_active = 1;
8044 }
8045 else
8046 {
8047 return 0;
8048 }
8049 return 1;
8050 }
8051
8052 static int shinko_chcs1245_parse_parameters(stp_vars_t *v)
8053 {
8054 const char *dust = stp_get_string_parameter(v, "DustRemoval");
8055 dyesub_privdata_t *pd = get_privdata(v);
8056
8057 /* No need to set global params if there's no privdata yet */
8058 if (!pd)
8059 return 1;
8060
8061 /* Parse options */
8062
8063 if (strcmp(dust, "PrinterDefault") == 0) {
8064 pd->privdata.s1245.dust_removal = 3;
8065 } else if (strcmp(dust, "Off") == 0) {
8066 pd->privdata.s1245.dust_removal = 1;
8067 } else if (strcmp(dust, "On") == 0) {
8068 pd->privdata.s1245.dust_removal = 2;
8069 } else {
8070 pd->privdata.s1245.dust_removal = 0;
8071 }
8072
8073 pd->privdata.s1245.matte_intensity = stp_get_int_parameter(v, "MatteIntensity");
8074
8075 return 1;
8076 }
8077
8078 static void shinko_chcs1245_printer_init(stp_vars_t *v)
8079 {
8080 dyesub_privdata_t *pd = get_privdata(v);
8081
8082 int media = 0;
8083
8084 if (strcmp(pd->pagesize,"w288h576") == 0)
8085 media = 5;
8086 else if (strcmp(pd->pagesize,"w360h576") == 0)
8087 media = 4;
8088 else if (strcmp(pd->pagesize,"w432h576") == 0)
8089 media = 6;
8090 else if (strcmp(pd->pagesize,"w576h576") == 0)
8091 media = 9;
8092 else if (strcmp(pd->pagesize,"w576h576-div2") == 0)
8093 media = 2;
8094 else if (strcmp(pd->pagesize,"c8x10") == 0)
8095 media = 0;
8096 else if (strcmp(pd->pagesize,"c8x10-w576h432_w576h288") == 0)
8097 media = 3;
8098 else if (strcmp(pd->pagesize,"c8x10-div2") == 0)
8099 media = 1;
8100 else if (strcmp(pd->pagesize,"w576h864") == 0)
8101 media = 0;
8102 else if (strcmp(pd->pagesize,"w576h864-div2") == 0)
8103 media = 7;
8104 else if (strcmp(pd->pagesize,"w576h864-div3") == 0)
8105 media = 8;
8106
8107 stp_put32_le(0x10, v);
8108 stp_put32_le(1245, v); /* Printer Model */
8109 stp_put32_le(0x00, v);
8110 stp_put32_le(0x01, v);
8111
8112 stp_put32_le(0x64, v);
8113 stp_put32_le(0x00, v);
8114 stp_put32_le(0x10, v); /* Seems to be fixed */
8115 stp_put32_le(0x00, v);
8116
8117 stp_put32_le(media, v);
8118 stp_zfwrite((pd->overcoat->seq).data, 1,
8119 (pd->overcoat->seq).bytes, v); /* Print Mode */
8120 stp_put32_le(0x00, v);
8121 if (((const unsigned char*)(pd->overcoat->seq).data)[0] == 0x02 ||
8122 ((const unsigned char*)(pd->overcoat->seq).data)[0] == 0x03) {
8123 stp_put32_le(0x07fffffff, v); /* Glossy */
8124 } else {
8125 stp_put32_le(pd->privdata.s1245.matte_intensity, v); /* matte intensity */
8126 }
8127
8128 stp_put32_le(pd->privdata.s1245.dust_removal, v); /* Dust Removal Mode */
8129 stp_put32_le(pd->w_size, v); /* Columns */
8130 stp_put32_le(pd->h_size, v); /* Rows */
8131 stp_put32_le(pd->copies, v); /* Copies */
8132
8133 stp_put32_le(0x00, v);
8134 stp_put32_le(0x00, v);
8135 stp_put32_le(0x00, v);
8136 stp_put32_le(0xffffffce, v);
8137
8138 stp_put32_le(0x00, v);
8139 stp_put32_le(0xffffffce, v);
8140 stp_put32_le(pd->w_dpi, v); /* Dots Per Inch */
8141 stp_put32_le(0xffffffce, v);
8142
8143 stp_put32_le(0x00, v);
8144 stp_put32_le(0xffffffce, v);
8145 stp_put32_le(0x00, v);
8146 stp_put32_le(0x00, v);
8147
8148 stp_put32_le(0x00, v);
8149 }
8150
8151 /* Shinko CHC-S6245 */
8152 static const dyesub_pagesize_t shinko_chcs6245_page[] =
8153 {
8154 DEFINE_PAPER_SIMPLE( "w288h576", "8x4", PT(1236,300), PT(2464,300), DYESUB_LANDSCAPE),
8155 DEFINE_PAPER_SIMPLE( "w360h576", "8x5", PT(1536,300), PT(2464,300), DYESUB_LANDSCAPE),
8156 DEFINE_PAPER_SIMPLE( "w432h576", "8x6", PT(1836,300), PT(2464,300), DYESUB_LANDSCAPE),
8157 DEFINE_PAPER_SIMPLE( "w576h576", "8x8", PT(2436,300), PT(2464,300), DYESUB_LANDSCAPE),
8158 DEFINE_PAPER_SIMPLE( "w576h576-div2", "8x4*2", PT(2464,300), PT(2494,300), DYESUB_PORTRAIT),
8159 DEFINE_PAPER_SIMPLE( "c8x10", "8x10", PT(2464,300), PT(3036,300), DYESUB_PORTRAIT),
8160 DEFINE_PAPER_SIMPLE( "c8x10-div2", "8x5*2", PT(2464,300), PT(3094,300), DYESUB_PORTRAIT),
8161 DEFINE_PAPER_SIMPLE( "w576h864", "8x12", PT(2464,300), PT(3636,300), DYESUB_PORTRAIT),
8162 DEFINE_PAPER_SIMPLE( "w576h864-div2", "8x6*2", PT(2464,300), PT(3694,300), DYESUB_PORTRAIT),
8163 DEFINE_PAPER_SIMPLE( "w576h864-div3", "8x4*3", PT(2464,300), PT(3752,300), DYESUB_PORTRAIT),
8164 };
8165
8166 LIST(dyesub_pagesize_list_t, shinko_chcs6245_page_list, dyesub_pagesize_t, shinko_chcs6245_page);
8167
8168 static const dyesub_printsize_t shinko_chcs6245_printsize[] =
8169 {
8170 { "300x300", "w288h576", 1236, 2464},
8171 { "300x300", "w360h576", 1536, 2464},
8172 { "300x300", "w432h576", 1836, 2464},
8173 { "300x300", "w576h576", 2436, 2464},
8174 { "300x300", "w576h576-div2", 2464, 2494},
8175 { "300x300", "c8x10", 2464, 3036},
8176 { "300x300", "c8x10-div2", 2464, 3094},
8177 { "300x300", "w576h864", 2464, 3636},
8178 { "300x300", "w576h864-div2", 2464, 3694},
8179 { "300x300", "w576h864-div3", 2464, 3752},
8180 };
8181
8182 LIST(dyesub_printsize_list_t, shinko_chcs6245_printsize_list, dyesub_printsize_t, shinko_chcs6245_printsize);
8183
8184 static const overcoat_t shinko_chcs6245_overcoat[] =
8185 {
8186 {"Glossy", N_("Glossy"), {4, "\x03\x00\x00\x00"}},
8187 {"Matte", N_("Matte"), {4, "\x02\x00\x00\x00"}},
8188 {"None", N_("None"), {4, "\x01\x00\x00\x00"}},
8189 };
8190
8191 LIST(overcoat_list_t, shinko_chcs6245_overcoat_list, overcoat_t, shinko_chcs6245_overcoat);
8192
8193 static void shinko_chcs6245_printer_init(stp_vars_t *v)
8194 {
8195 dyesub_privdata_t *pd = get_privdata(v);
8196 int media = 0;
8197
8198 if (strcmp(pd->pagesize,"w288h576") == 0)
8199 media = 0x20;
8200 else if (strcmp(pd->pagesize,"w360h576") == 0)
8201 media = 0x21;
8202 else if (strcmp(pd->pagesize,"w432h576") == 0)
8203 media = 0x22;
8204 else if (strcmp(pd->pagesize,"w576h576") == 0)
8205 media = 0x23;
8206 else if (strcmp(pd->pagesize,"c8x10") == 0)
8207 media = 0x10;
8208 else if (strcmp(pd->pagesize,"w576h864") == 0)
8209 media = 0x11;
8210 else if (strcmp(pd->pagesize,"w576h576-div2") == 0)
8211 media = 0x30;
8212 else if (strcmp(pd->pagesize,"c8x10-div2") == 0)
8213 media = 0x31;
8214 else if (strcmp(pd->pagesize,"w576h864-div2") == 0)
8215 media = 0x32;
8216 else if (strcmp(pd->pagesize,"w576h864-div3") == 0)
8217 media = 0x40;
8218
8219 stp_put32_le(0x10, v);
8220 stp_put32_le(6245, v); /* Printer Model */
8221 stp_put32_le(0x01, v);
8222 stp_put32_le(0x01, v);
8223
8224 stp_put32_le(0x64, v);
8225 stp_put32_le(0x00, v);
8226 stp_put32_le(media, v);
8227 stp_put32_le(0x00, v);
8228
8229 stp_put32_le(0x00, v);
8230 stp_put32_le(0x00, v);
8231 stp_zfwrite((pd->overcoat->seq).data, 1,
8232 (pd->overcoat->seq).bytes, v); /* Lamination */
8233 stp_put32_le(0x00, v);
8234
8235 stp_put32_le(0x00, v);
8236 stp_put32_le(pd->w_size, v); /* Columns */
8237 stp_put32_le(pd->h_size, v); /* Rows */
8238 stp_put32_le(pd->copies, v); /* Copies */
8239
8240 stp_put32_le(0x00, v);
8241 stp_put32_le(0x00, v);
8242 stp_put32_le(0x00, v);
8243 stp_put32_le(0xffffffce, v);
8244
8245 stp_put32_le(0x00, v);
8246 stp_put32_le(0xffffffce, v);
8247 stp_put32_le(pd->w_dpi, v); /* Dots Per Inch */
8248 stp_put32_le(0xffffffce, v);
8249
8250 stp_put32_le(0x00, v);
8251 stp_put32_le(0xffffffce, v);
8252 stp_put32_le(0x00, v);
8253 stp_put32_le(0x00, v);
8254
8255 stp_put32_le(0x00, v);
8256 }
8257
8258 /* Shinko CHC-S6145 */
8259 static const dyesub_pagesize_t shinko_chcs6145_page[] =
8260 {
8261 DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT(634,300), PT(1844,300), DYESUB_LANDSCAPE),
8262 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1240,300), PT(1844,300), DYESUB_LANDSCAPE),
8263 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1240,300), PT(1844,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
8264 DEFINE_PAPER_SIMPLE( "w360h360", "5x5", PT(1536,300), PT(1548,300), DYESUB_LANDSCAPE),
8265 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1548,300), PT(2140,300), DYESUB_PORTRAIT),
8266 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1832,300), PT(1844,300), DYESUB_LANDSCAPE),
8267 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1844,300), PT(2434,300), DYESUB_PORTRAIT),
8268 DEFINE_PAPER( "w432h576-w432h432_w432h144", "6x6+2x6", PT(1844,300), PT1(2434,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
8269 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(1844,300), PT(2492,300), DYESUB_PORTRAIT),
8270 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1844,300), PT(2740,300), DYESUB_PORTRAIT),
8271 };
8272
8273 LIST(dyesub_pagesize_list_t, shinko_chcs6145_page_list, dyesub_pagesize_t, shinko_chcs6145_page);
8274
8275 static const dyesub_printsize_t shinko_chcs6145_printsize[] =
8276 {
8277 { "300x300", "w144h432", 634, 1844},
8278 { "300x300", "w288h432", 1240, 1844},
8279 { "300x300", "w288h432-div2", 1240, 1844},
8280 { "300x300", "w360h360", 1536, 1548},
8281 { "300x300", "w360h504", 1548, 2140},
8282 { "300x300", "w432h432", 1832, 1844},
8283 { "300x300", "w432h576", 1844, 2434},
8284 { "300x300", "w432h576-w432h432_w432h144", 1844, 2434},
8285 { "300x300", "w432h576-div2", 1844, 2492},
8286 { "300x300", "w432h648", 1844, 2740},
8287 };
8288
8289 LIST(dyesub_printsize_list_t, shinko_chcs6145_printsize_list, dyesub_printsize_t, shinko_chcs6145_printsize);
8290
8291 static const overcoat_t shinko_chcs6145_overcoat[] =
8292 {
8293 {"PrinterDefault", N_("Printer Default"), {4, "\0\0\0\0"}},
8294 {"None", N_("None"), {4, "\x01\0\0\0"}},
8295 {"Glossy", N_("Glossy"), {4, "\x02\0\0\0"}},
8296 {"Matte", N_("Matte"), {4, "\x03\0\0\0"}},
8297 };
8298
8299 LIST(overcoat_list_t, shinko_chcs6145_overcoat_list, overcoat_t, shinko_chcs6145_overcoat);
8300
8301 static void shinko_chcs6145_printer_init(stp_vars_t *v)
8302 {
8303 dyesub_privdata_t *pd = get_privdata(v);
8304
8305 int media = 0;
8306
8307 if (strcmp(pd->pagesize,"w288h432") == 0)
8308 media = 0x00;
8309 else if (strcmp(pd->pagesize,"w288h432-div2") == 0)
8310 media = 0x00;
8311 else if (strcmp(pd->pagesize,"w360h360") == 0)
8312 media = 0x08;
8313 else if (strcmp(pd->pagesize,"w360h504") == 0)
8314 media = 0x03;
8315 else if (strcmp(pd->pagesize,"w432h432") == 0)
8316 media = 0x06;
8317 else if (strcmp(pd->pagesize,"w432h576") == 0)
8318 media = 0x06;
8319 else if (strcmp(pd->pagesize,"w144h432") == 0)
8320 media = 0x07;
8321 else if (strcmp(pd->pagesize,"w432h576-w432h432_w432h144") == 0)
8322 media = 0x06;
8323 else if (strcmp(pd->pagesize,"w432h576-div2") == 0)
8324 media = 0x06;
8325 else if (strcmp(pd->pagesize,"w432h648") == 0)
8326 media = 0x05;
8327
8328 stp_put32_le(0x10, v);
8329 stp_put32_le(6145, v); /* Printer Model */
8330 if (!strcmp(pd->pagesize,"w360h360") ||
8331 !strcmp(pd->pagesize,"w360h504"))
8332 stp_put32_le(0x02, v); /* 5" media */
8333 else
8334 stp_put32_le(0x03, v); /* 6" media */
8335 stp_put32_le(0x01, v);
8336
8337 stp_put32_le(0x64, v);
8338 stp_put32_le(0x00, v);
8339 stp_put32_le(media, v); /* Media Type */
8340 stp_put32_le(0x00, v);
8341
8342 if (strcmp(pd->pagesize,"w432h576-w432h432_w432h144") == 0) {
8343 stp_put32_le(0x05, v);
8344 } else if (strcmp(pd->pagesize,"w288h432-div2") == 0) {
8345 stp_put32_le(0x04, v);
8346 } else if (strcmp(pd->pagesize,"w432h576-div2") == 0) {
8347 stp_put32_le(0x02, v);
8348 } else {
8349 stp_put32_le(0x00, v);
8350 }
8351 stp_put32_le(0x00, v); /* XXX quality; 00 == default, 0x01 == std */
8352 stp_zfwrite((pd->overcoat->seq).data, 1,
8353 (pd->overcoat->seq).bytes, v); /* Lamination */
8354 stp_put32_le(0x00, v);
8355
8356 stp_put32_le(0x00, v);
8357 stp_put32_le(pd->w_size, v); /* Columns */
8358 stp_put32_le(pd->h_size, v); /* Rows */
8359 stp_put32_le(pd->copies, v); /* Copies */
8360
8361 stp_put32_le(0x00, v);
8362 stp_put32_le(0x00, v);
8363 stp_put32_le(0x00, v);
8364 stp_put32_le(0xffffffce, v);
8365
8366 stp_put32_le(0x00, v);
8367 stp_put32_le(0xffffffce, v);
8368 stp_put32_le(pd->w_dpi, v); /* Dots Per Inch */
8369 stp_put32_le(0xffffffce, v);
8370
8371 stp_put32_le(0x00, v);
8372 stp_put32_le(0xffffffce, v);
8373 stp_put32_le(0x00, v);
8374 stp_put32_le(0x00, v);
8375
8376 #ifdef S6145_YMC
8377 stp_put32_le(0x01, v);
8378 #else
8379 stp_put32_le(0x00, v);
8380 #endif
8381 }
8382
8383 /* CHC-S2245 */
8384 static const dyesub_pagesize_t shinko_chcs2245_page[] =
8385 {
8386 DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT(634,300), PT(1844,300), DYESUB_LANDSCAPE),
8387 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1240,300), PT(1844,300), DYESUB_LANDSCAPE),
8388 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1240,300), PT(1844,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
8389 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1548,300), PT(2140,300), DYESUB_PORTRAIT),
8390 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1824,300), PT(1844,300), DYESUB_LANDSCAPE),
8391 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1844,300), PT(2434,300), DYESUB_PORTRAIT),
8392 DEFINE_PAPER( "w432h576-div4", "2x6*4", PT(1844,300), PT1(2434,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
8393 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(1844,300), PT(2492,300), DYESUB_PORTRAIT),
8394 };
8395
8396 LIST(dyesub_pagesize_list_t, shinko_chcs2245_page_list, dyesub_pagesize_t, shinko_chcs2245_page);
8397
8398 static const dyesub_printsize_t shinko_chcs2245_printsize[] =
8399 {
8400 { "300x300", "w144h432", 634, 1844},
8401 { "300x300", "w288h432", 1240, 1844},
8402 { "300x300", "w288h432-div2", 1240, 1844},
8403 { "300x300", "w360h504", 1548, 2140},
8404 { "300x300", "w432h432", 1824, 1844},
8405 { "300x300", "w432h576", 1844, 2434},
8406 { "300x300", "w432h576-div4", 1844, 2434},
8407 { "300x300", "w432h576-div2", 1844, 2492},
8408 };
8409
8410 LIST(dyesub_printsize_list_t, shinko_chcs2245_printsize_list, dyesub_printsize_t, shinko_chcs2245_printsize);
8411
8412 static const overcoat_t shinko_chcs2245_overcoat[] =
8413 {
8414 {"Glossy", N_("Glossy"), {4, "\x01\0\0\0"}},
8415 {"Matte", N_("Matte"), {4, "\x02\0\0\0"}},
8416 };
8417
8418 LIST(overcoat_list_t, shinko_chcs2245_overcoat_list, overcoat_t, shinko_chcs2245_overcoat);
8419
8420 static void shinko_chcs2245_printer_init(stp_vars_t *v)
8421 {
8422 dyesub_privdata_t *pd = get_privdata(v);
8423
8424 int media = 0;
8425
8426 if (strcmp(pd->pagesize,"w288h432") == 0)
8427 media = 0x00;
8428 else if (strcmp(pd->pagesize,"w288h432-div2") == 0)
8429 media = 0x00;
8430 else if (strcmp(pd->pagesize,"w360h504") == 0)
8431 media = 0x03;
8432 else if (strcmp(pd->pagesize,"w432h432") == 0)
8433 media = 0x08;
8434 else if (strcmp(pd->pagesize,"w432h576") == 0)
8435 media = 0x06;
8436 else if (strcmp(pd->pagesize,"w144h432") == 0)
8437 media = 0x07;
8438 else if (strcmp(pd->pagesize,"w432h576-w432h432_w432h144") == 0)
8439 media = 0x06;
8440 else if (strcmp(pd->pagesize,"w432h576-div2") == 0)
8441 media = 0x06;
8442 else if (strcmp(pd->pagesize,"w432h576-div4") == 0)
8443 media = 0x06;
8444 else if (strcmp(pd->pagesize,"w432h648") == 0)
8445 media = 0x05;
8446
8447 stp_put32_le(0x10, v);
8448 stp_put32_le(2245, v); /* Printer Model */
8449 if (!strcmp(pd->pagesize,"w360h360") ||
8450 !strcmp(pd->pagesize,"w360h504"))
8451 stp_put32_le(0x02, v); /* 5" media */
8452 else
8453 stp_put32_le(0x03, v); /* 6" media */
8454 stp_put32_le(0x01, v);
8455
8456 stp_put32_le(0x64, v);
8457 stp_put32_le(0x00, v);
8458 stp_put32_le(media, v); /* Media Type */
8459 stp_put32_le(0x00, v);
8460
8461 if (strcmp(pd->pagesize,"w432h576-div4") == 0) {
8462 stp_put32_le(0x05, v);
8463 } else if (strcmp(pd->pagesize,"w288h432-div2") == 0) {
8464 stp_put32_le(0x04, v);
8465 } else if (strcmp(pd->pagesize,"w432h576-div2") == 0) {
8466 stp_put32_le(0x02, v);
8467 } else {
8468 stp_put32_le(0x00, v);
8469 }
8470 stp_put32_le(pd->privdata.k6900.quality, v); /* Quality */
8471 stp_zfwrite((pd->overcoat->seq).data, 1,
8472 (pd->overcoat->seq).bytes, v); /* Lamination */
8473 stp_put32_le(0x00, v);
8474
8475 stp_put32_le(0x00, v);
8476 stp_put32_le(pd->w_size, v); /* Columns */
8477 stp_put32_le(pd->h_size, v); /* Rows */
8478 stp_put32_le(pd->copies, v); /* Copies */
8479
8480 stp_put32_le(0x00, v);
8481 stp_put32_le(0x00, v);
8482 stp_put32_le(0x00, v);
8483 stp_put32_le(0xffffffce, v);
8484
8485 stp_put32_le(0x00, v);
8486 stp_put32_le(0xffffffce, v);
8487 stp_put32_le(pd->w_dpi, v); /* Dots Per Inch */
8488 stp_put32_le(0xffffffce, v);
8489
8490 stp_put32_le(0x00, v);
8491 stp_put32_le(0xffffffce, v);
8492 stp_put32_le(0x00, v);
8493 stp_put32_le(0x00, v);
8494
8495 #ifdef S2245_YMC
8496 stp_put32_le(0x01, v);
8497 #else
8498 stp_put32_le(0x00, v);
8499 #endif
8500 }
8501
8502 /* Ciaat Brava 21 */
8503 static const dyesub_pagesize_t ciaat_brava21_page[] =
8504 {
8505 DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT(634,300), PT(1844,300), DYESUB_LANDSCAPE),
8506 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1240,300), PT(1844,300), DYESUB_LANDSCAPE),
8507 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1240,300), PT(1844,300), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
8508 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1548,300), PT(2140,300), DYESUB_PORTRAIT),
8509 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1844,300), PT(2434,300), DYESUB_PORTRAIT),
8510 DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT(1844,300), PT(2492,300), DYESUB_PORTRAIT),
8511 };
8512
8513 LIST(dyesub_pagesize_list_t, ciaat_brava21_page_list, dyesub_pagesize_t, ciaat_brava21_page);
8514
8515 static const dyesub_printsize_t ciaat_brava21_printsize[] =
8516 {
8517 { "300x300", "w144h432", 634, 1844},
8518 { "300x300", "w288h432", 1240, 1844},
8519 { "300x300", "w288h432-div2", 1240, 1844},
8520 { "300x300", "w360h504", 1548, 2140},
8521 { "300x300", "w432h576", 1844, 2434},
8522 { "300x300", "w432h576-div2", 1844, 2492},
8523 };
8524
8525 LIST(dyesub_printsize_list_t, ciaat_brava21_printsize_list, dyesub_printsize_t, ciaat_brava21_printsize);
8526
8527 /* Dai Nippon Printing DS40 */
8528 static const dyesub_resolution_t res_dnpds40_dpi[] =
8529 {
8530 { "300x300", 300, 300},
8531 { "300x600", 300, 600},
8532 };
8533
8534 LIST(dyesub_resolution_list_t, res_dnpds40_dpi_list, dyesub_resolution_t, res_dnpds40_dpi);
8535
8536 /* Imaging area is wider than print size, we always must supply the printer with the full imaging width. */
8537 static const dyesub_pagesize_t dnpds40_page[] =
8538 {
8539 DEFINE_PAPER( "B7", "3.5x5", PT(1088,300), PT(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE),
8540 DEFINE_PAPER( "w288h432", "4x6", PT(1240,300), PT(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
8541 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1240,300), PT(1920,300), 0, PT1(0,300), PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
8542 DEFINE_PAPER( "w360h504", "5x7", PT(1920,300), PT(2138,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
8543 DEFINE_PAPER( "w360h504-div2", "3.5x5*2", PT(1920,300), PT(2176,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
8544 DEFINE_PAPER( "w432h432", "6x6", PT(1836,300), PT(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
8545 DEFINE_PAPER( "w432h576", "6x8", PT(1920,300), PT(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
8546 DEFINE_PAPER( "w432h576-div4", "2x6*4", PT(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, PT1(0,300), DYESUB_PORTRAIT),
8547 DEFINE_PAPER( "w432h576-div2", "4x6*2", PT(1920,300), PT(2498,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
8548 DEFINE_PAPER( "w432h576-w432h432_w432h144", "6x6+2x6", PT(1920,300), PT(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
8549 DEFINE_PAPER( "w432h648", "6x9", PT(1920,300), PT(2740,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
8550 };
8551
8552 LIST(dyesub_pagesize_list_t, dnpds40_page_list, dyesub_pagesize_t, dnpds40_page);
8553
8554 static const dyesub_printsize_t dnpds40_printsize[] =
8555 {
8556 { "300x300", "B7", 1088, 1920},
8557 { "300x600", "B7", 2176, 1920},
8558 { "300x300", "w288h432", 1240, 1920},
8559 { "300x600", "w288h432", 2480, 1920},
8560 { "300x300", "w288h432-div2", 1240, 1920},
8561 { "300x600", "w288h432-div2", 2480, 1920},
8562 { "300x300", "w360h504", 1920, 2138},
8563 { "300x600", "w360h504", 1920, 4276},
8564 { "300x300", "w360h504-div2", 1920, 2176},
8565 { "300x600", "w360h504-div2", 1920, 4352},
8566 { "300x300", "w432h432", 1836, 1920},
8567 { "300x600", "w432h432", 3672, 1920},
8568 { "300x300", "w432h576", 1920, 2436},
8569 { "300x600", "w432h576", 1920, 4872},
8570 { "300x300", "w432h576-div4", 1920, 2436},
8571 { "300x600", "w432h576-div4", 1920, 4872},
8572 { "300x300", "w432h576-div2", 1920, 2498},
8573 { "300x600", "w432h576-div2", 1920, 4996},
8574 { "300x300", "w432h576-w432h432_w432h144", 1920, 2436},
8575 { "300x600", "w432h576-w432h432_w432h144", 1920, 4872},
8576 { "300x300", "w432h648", 1920, 2740},
8577 { "300x600", "w432h648", 1920, 5480},
8578 };
8579
8580 LIST(dyesub_printsize_list_t, dnpds40_printsize_list, dyesub_printsize_t, dnpds40_printsize);
8581
8582 static const overcoat_t dnpds40_overcoat[] =
8583 {
8584 {"Glossy", N_("Glossy"), {3, "000"}},
8585 {"Matte", N_("Matte"), {3, "001"}},
8586 };
8587
8588 LIST(overcoat_list_t, dnpds40_overcoat_list, overcoat_t, dnpds40_overcoat);
8589
8590 static const stp_parameter_t ds40_parameters[] =
8591 {
8592 {
8593 "NoCutWaste", N_("No Cut-Paper Waste"), "Color=No,Category=Advanced Printer Setup",
8594 N_("No Cut-Paper Waste"),
8595 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
8596 STP_PARAMETER_LEVEL_ADVANCED, 1, 0, STP_CHANNEL_NONE, 1, 0
8597 },
8598 };
8599
8600 #define ds40_parameter_count (sizeof(ds40_parameters) / sizeof(const stp_parameter_t))
8601
8602 static int
8603 ds40_load_parameters(const stp_vars_t *v, const char *name,
8604 stp_parameter_t *description)
8605 {
8606 unsigned int i;
8607 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
8608 stp_get_model_id(v));
8609
8610 if (caps->parameter_count && caps->parameters)
8611 {
8612 for (i = 0; i < caps->parameter_count; i++)
8613 if (strcmp(name, caps->parameters[i].name) == 0)
8614 {
8615 stp_fill_parameter_settings(description, &(caps->parameters[i]));
8616 break;
8617 }
8618 }
8619
8620 if (strcmp(name, "NoCutWaste") == 0)
8621 {
8622 description->is_active = 1;
8623 description->deflt.boolean = 0;
8624 }
8625 else
8626 {
8627 return 0;
8628 }
8629
8630 return 1;
8631 }
8632
8633 static int ds40_parse_parameters(stp_vars_t *v)
8634 {
8635 dyesub_privdata_t *pd = get_privdata(v);
8636
8637 int nocutwaste = stp_get_boolean_parameter(v, "NoCutWaste");
8638
8639 if (pd) {
8640 pd->privdata.dnp.nocutwaste = nocutwaste;
8641 }
8642
8643 return 1;
8644 }
8645
8646 static void dnp_printer_start_common(stp_vars_t *v)
8647 {
8648 dyesub_privdata_t *pd = get_privdata(v);
8649
8650 /* Configure Lamination */
8651 stp_zprintf(v, "\033PCNTRL OVERCOAT 0000000800000");
8652 stp_zfwrite((pd->overcoat->seq).data, 1,
8653 (pd->overcoat->seq).bytes, v); /* Lamination mode */
8654
8655 /* Set quantity.. Backend overrides as needed. */
8656 stp_zprintf(v, "\033PCNTRL QTY 00000008%07d\r", pd->copies);
8657 }
8658
8659 static void dnpds40_printer_start(stp_vars_t *v)
8660 {
8661 dyesub_privdata_t *pd = get_privdata(v);
8662
8663 /* Common code */
8664 dnp_printer_start_common(v);
8665
8666 /* Set cutter option to "normal" */
8667 if (!strcmp(pd->pagesize, "w432h576-w432h432_w432h144")) {
8668 stp_zprintf(v, "\033PCNTRL FULL_CUTTER_SET 00000016");
8669 stp_zprintf(v, "060020000000000\r");
8670 } else if (!strcmp(pd->pagesize, "w288h432-div2") ||
8671 !strcmp(pd->pagesize, "w432h576-div4")) {
8672 stp_zprintf(v, "\033PCNTRL CUTTER 00000008");
8673 stp_zprintf(v, "00000120");
8674 } else {
8675 stp_zprintf(v, "\033PCNTRL CUTTER 00000008%08d", pd->privdata.dnp.nocutwaste ? 1 : 0);
8676 }
8677
8678 /* Configure multi-cut/page size */
8679 stp_zprintf(v, "\033PIMAGE MULTICUT 00000008000000");
8680
8681 if (!strcmp(pd->pagesize, "B7")) {
8682 stp_zprintf(v, "01");
8683 } else if (!strcmp(pd->pagesize, "w288h432")) {
8684 stp_zprintf(v, "02");
8685 } else if (!strcmp(pd->pagesize, "w360h504")) {
8686 stp_zprintf(v, "03");
8687 } else if (!strcmp(pd->pagesize, "w360h504-div2")) {
8688 stp_zprintf(v, "22");
8689 } else if (!strcmp(pd->pagesize, "w432h432")) {
8690 stp_zprintf(v, "27");
8691 } else if (!strcmp(pd->pagesize, "w432h576")) {
8692 stp_zprintf(v, "04");
8693 } else if (!strcmp(pd->pagesize, "w432h576-w432h432_w432h144")) {
8694 stp_zprintf(v, "04");
8695 } else if (!strcmp(pd->pagesize, "w432h648")) {
8696 stp_zprintf(v, "05");
8697 } else if (!strcmp(pd->pagesize, "w432h576-div2")) {
8698 stp_zprintf(v, "12");
8699 } else if (!strcmp(pd->pagesize, "w288h432-div2")) {
8700 stp_zprintf(v, "02");
8701 } else if (!strcmp(pd->pagesize, "w432h576-div4")) {
8702 stp_zprintf(v, "04");
8703 } else {
8704 stp_zprintf(v, "00"); /* should be impossible. */
8705 }
8706 }
8707
8708 static void dnpds40_printer_end(stp_vars_t *v)
8709 {
8710 stp_zprintf(v, "\033PCNTRL START");
8711 dyesub_nputc(v, ' ', 19);
8712 }
8713
8714 static void dnpds40_plane_init(stp_vars_t *v)
8715 {
8716 dyesub_privdata_t *pd = get_privdata(v);
8717 int i;
8718 char p = (pd->plane == 3 ? 'Y' :
8719 (pd->plane == 2 ? 'M' :
8720 'C' ));
8721
8722 long PadSize = 10;
8723 long FSize = (pd->w_size*pd->h_size) + 1024 + 54 + PadSize;
8724
8725 /* Printer command plus length of data to follow */
8726 stp_zprintf(v, "\033PIMAGE %cPLANE %08ld", p, FSize);
8727
8728 /* Each plane is essentially a tweaked BMP file */
8729
8730 /* BMP header */
8731 stp_zprintf(v, "BM");
8732 stp_put32_le(FSize, v);
8733 dyesub_nputc(v, '\0', 4);
8734 stp_put32_le(1088, v); /* Offset to pixel data: 1024 + (14+40-10) + 10 */
8735
8736 /* DIB header */
8737 stp_put32_le(40, v); /* DIB header size */
8738 stp_put32_le(pd->w_size, v);
8739 stp_put32_le(pd->h_size, v);
8740 stp_put16_le(1, v); /* single channel */
8741 stp_put16_le(8, v); /* 8bpp */
8742 dyesub_nputc(v, '\0', 8); /* compression + image size are ignored */
8743 stp_put32_le(11808, v); /* horizontal pixels per meter, fixed at 300dpi */
8744 if (pd->h_dpi == 600)
8745 stp_put32_le(23615, v); /* vertical pixels per meter @ 600dpi */
8746 else if (pd->h_dpi == 334)
8747 stp_put32_le(13146, v); /* vertical pixels per meter @ 334dpi */
8748 else
8749 stp_put32_le(11808, v); /* vertical pixels per meter @ 300dpi */
8750 stp_put32_le(256, v); /* entries in color table */
8751 stp_put32_le(0, v); /* no important colors */
8752 for (i = 255 ; i >= 0; i--) {
8753 stp_zprintf(v, "%c%c%c%c", i, i, i, 0); /* RGB array, 256 * 4 byte entries */
8754 }
8755 dyesub_nputc(v, '\0', PadSize); /* Pading to align plane data */
8756 }
8757
8758 /* Dai Nippon Printing DS80 */
8759
8760 /* Imaging area is wider than print size, we always must supply the
8761 printer with the full imaging width. */
8762 static const dyesub_pagesize_t dnpds80_page[] =
8763 {
8764 DEFINE_PAPER( "w288h576", "8x4", PT(1236,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
8765 DEFINE_PAPER( "w360h576", "8x5", PT(1536,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
8766 DEFINE_PAPER( "w432h576", "8x6", PT(1836,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
8767 DEFINE_PAPER( "w576h576", "8x8", PT(2436,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
8768 DEFINE_PAPER( "w576h576-div2", "8x4*2", PT(2502,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
8769 DEFINE_PAPER( "w576h648-w576h360_w576h288", "8x5+8x4", PT(2560,300), PT(2802,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8770 DEFINE_PAPER( "c8x10", "8x10", PT(2560,300), PT(3036,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8771 DEFINE_PAPER( "c8x10-div2", "8x5*2", PT(2560,300), PT(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8772 DEFINE_PAPER( "c8x10-w576h432_w576h288", "8x6+8x4", PT(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, PT1(0,300), DYESUB_PORTRAIT),
8773 DEFINE_PAPER( "w576h792-w576h432_w576h360", "8x6+8x5", PT(2560,300), PT(3402,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8774 DEFINE_PAPER( "w576h842", "8x11.7", PT(2560,300), PT(3544,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8775 DEFINE_PAPER( "w576h864", "8x12", PT(2560,300), PT(3636,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8776 DEFINE_PAPER( "w576h864-div2", "8x6*2", PT(2560,300), PT(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8777 DEFINE_PAPER( "w576h864-w576h576_w576h288", "8x8+8x4", PT(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, PT1(0,300), DYESUB_PORTRAIT),
8778 DEFINE_PAPER( "w576h864-div3", "8x4*3", PT(2560,300), PT(3768,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8779 };
8780
8781 LIST(dyesub_pagesize_list_t, dnpds80_page_list, dyesub_pagesize_t, dnpds80_page);
8782
8783 static const dyesub_printsize_t dnpds80_printsize[] =
8784 {
8785 { "300x300", "w288h576", 1236, 2560},
8786 { "300x600", "w288h576", 2472, 2560},
8787 { "300x300", "w360h576", 1536, 2560},
8788 { "300x600", "w360h576", 3072, 2560},
8789 { "300x300", "w432h576", 1836, 2560},
8790 { "300x600", "w432h576", 3672, 2560},
8791 { "300x300", "w576h576", 2436, 2560},
8792 { "300x600", "w576h576", 4872, 2560},
8793 { "300x300", "w576h576-div2", 2502, 2560},
8794 { "300x600", "w576h576-div2", 5004, 2560},
8795 { "300x300", "w576h648-w576h360_w576h288", 2560, 2802},
8796 { "300x600", "w576h648-w576h360_w576h288", 2560, 5604},
8797 { "300x300", "c8x10", 2560, 3036},
8798 { "300x600", "c8x10", 2560, 6072},
8799 { "300x300", "c8x10-div2", 2560, 3102},
8800 { "300x600", "c8x10-div2", 2560, 6204},
8801 { "300x300", "c8x10-w576h432_w576h288", 2560, 3102},
8802 { "300x600", "c8x10-w576h432_w576h288", 2560, 6204},
8803 { "300x300", "w576h792-w576h432_w576h360", 2560, 3402},
8804 { "300x600", "w576h792-w576h432_w576h360", 2560, 6804},
8805 { "300x300", "w576h842", 2560, 3544},
8806 { "300x600", "w576h842", 2560, 7088},
8807 { "300x300", "w576h864", 2560, 3636},
8808 { "300x600", "w576h864", 2560, 7272},
8809 { "300x300", "w576h864-div2", 2560, 3702},
8810 { "300x600", "w576h864-div2", 2560, 7404},
8811 { "300x300", "w576h864-w576h576_w576h288", 2560, 3702},
8812 { "300x600", "w576h864-w576h576_w576h288", 2560, 7404},
8813 { "300x300", "w576h864-div3", 2560, 3768},
8814 { "300x600", "w576h864-div3", 2560, 7536},
8815 };
8816
8817 LIST(dyesub_printsize_list_t, dnpds80_printsize_list, dyesub_printsize_t, dnpds80_printsize);
8818
8819 static int dnpds80_parse_parameters(stp_vars_t *v)
8820 {
8821 const char *pagesize = stp_get_string_parameter(v, "PageSize");
8822 dyesub_privdata_t *pd = get_privdata(v);
8823 int multicut = 0;
8824 int nocutwaste = stp_get_boolean_parameter(v, "NoCutWaste");
8825
8826 if (!strcmp(pagesize, "c8x10")) {
8827 multicut = 6;
8828 } else if (!strcmp(pagesize, "w576h864")) {
8829 multicut = 7;
8830 } else if (!strcmp(pagesize, "w288h576")) {
8831 multicut = 8;
8832 } else if (!strcmp(pagesize, "w360h576")) {
8833 multicut = 9;
8834 } else if (!strcmp(pagesize, "w432h576")) {
8835 multicut = 10;
8836 } else if (!strcmp(pagesize, "w576h576")) {
8837 multicut = 11;
8838 } else if (!strcmp(pagesize, "w576h576-div2")) {
8839 multicut = 13;
8840 } else if (!strcmp(pagesize, "c8x10-div2")) {
8841 multicut = 14;
8842 } else if (!strcmp(pagesize, "w576h864-div2")) {
8843 multicut = 15;
8844 } else if (!strcmp(pagesize, "w576h648-w576h360_w576h288")) {
8845 multicut = 16;
8846 } else if (!strcmp(pagesize, "c8x10-w576h432_w576h288")) {
8847 multicut = 17;
8848 } else if (!strcmp(pagesize, "w576h792-w576h432_w576h360")) {
8849 multicut = 18;
8850 } else if (!strcmp(pagesize, "w576h864-w576h576_w576h288")) {
8851 multicut = 19;
8852 } else if (!strcmp(pagesize, "w576h864-div3")) {
8853 multicut = 20;
8854 } else if (!strcmp(pagesize, "w576h842")) {
8855 multicut = 21;
8856 } else {
8857 stp_eprintf(v, _("Illegal print size selected for roll media!\n"));
8858 return 0;
8859 }
8860
8861 /* No need to set global params if there's no privdata yet */
8862 if (pd) {
8863 pd->privdata.dnp.multicut = multicut;
8864 pd->privdata.dnp.nocutwaste = nocutwaste;
8865 }
8866
8867 return 1;
8868 }
8869
8870 static void dnpds80_printer_start(stp_vars_t *v)
8871 {
8872 dyesub_privdata_t *pd = get_privdata(v);
8873
8874 /* Common code */
8875 dnp_printer_start_common(v);
8876
8877 /* Set cutter option to "normal" */
8878 stp_zprintf(v, "\033PCNTRL CUTTER 00000008%08d", pd->privdata.dnp.nocutwaste ? 1 : 0);
8879
8880 /* Configure multi-cut/page size */
8881 stp_zprintf(v, "\033PIMAGE MULTICUT 00000008%08d", pd->privdata.dnp.multicut);
8882 }
8883
8884 /* Dai Nippon Printing DS80DX */
8885 static const dyesub_media_t dnpds80dx_medias[] =
8886 {
8887 {"Roll", N_("Roll"), {0, ""}},
8888 {"Sheet", N_("Sheet"), {0, ""}},
8889 };
8890
8891 LIST(dyesub_media_list_t, dnpds80dx_media_list, dyesub_media_t, dnpds80dx_medias);
8892
8893 static int dnpds80dx_parse_parameters(stp_vars_t *v)
8894 {
8895 const char *pagesize;
8896 const dyesub_media_t* media = NULL;
8897 const char* duplex_mode;
8898 dyesub_privdata_t *pd = get_privdata(v);
8899 int multicut = 0;
8900 int nocutwaste;
8901 int pagenum;
8902
8903 pagesize = stp_get_string_parameter(v, "PageSize");
8904 duplex_mode = stp_get_string_parameter(v, "Duplex");
8905 media = dyesub_get_mediatype(v);
8906 nocutwaste = stp_get_boolean_parameter(v, "NoCutWaste");
8907 pagenum = stp_get_int_parameter(v, "PageNumber");
8908
8909 if (!strcmp(media->name, "Roll")) {
8910 if (strcmp(duplex_mode, "None") && strcmp(duplex_mode, "Standard")) {
8911 stp_eprintf(v, _("Duplex not supported on roll media, switching to sheet media!\n"));
8912 stp_set_string_parameter(v, "MediaType", "Sheet");
8913 } else {
8914 /* If we're not using duplex and roll media, this is
8915 effectively a DS80 (non-DX) */
8916 return dnpds80_parse_parameters(v);
8917 }
8918 }
8919
8920 if (!strcmp(pagesize, "c8x10")) {
8921 multicut = 6;
8922 } else if (!strcmp(pagesize, "w576h864")) {
8923 multicut = 7;
8924 } else if (!strcmp(pagesize, "w288h576")) {
8925 multicut = 8;
8926 } else if (!strcmp(pagesize, "w360h576")) {
8927 multicut = 9;
8928 } else if (!strcmp(pagesize, "w432h576")) {
8929 multicut = 10;
8930 } else if (!strcmp(pagesize, "w576h576")) {
8931 multicut = 11;
8932 } else if (!strcmp(pagesize, "w576h774-w576h756")) {
8933 multicut = 25;
8934 } else if (!strcmp(pagesize, "w576h774")) {
8935 multicut = 26;
8936 } else if (!strcmp(pagesize, "w576h576-div2")) {
8937 multicut = 13;
8938 } else if (!strcmp(pagesize, "c8x10-div2")) {
8939 multicut = 14;
8940 } else if (!strcmp(pagesize, "w576h864-div2")) {
8941 multicut = 15;
8942 } else if (!strcmp(pagesize, "w576h864-div3sheet")) {
8943 multicut = 28;
8944 } else {
8945 stp_eprintf(v, _("Illegal print size selected for sheet media!\n"));
8946 return 0;
8947 }
8948
8949 /* No need to set global params if there's no privdata yet */
8950 if (!pd)
8951 return 1;
8952
8953 /* Add correct offset to multicut mode based on duplex state */
8954 if (!strcmp(duplex_mode, "None") || !strcmp(duplex_mode, "Standard"))
8955 multicut += 100; /* Simplex */
8956 else if (pagenum & 1)
8957 multicut += 300; /* Duplex, back */
8958 else
8959 multicut += 200; /* Duplex, front */
8960
8961 pd->privdata.dnp.multicut = multicut;
8962 pd->privdata.dnp.nocutwaste = nocutwaste;
8963
8964 return 1;
8965 }
8966
8967 /* This is the same as the DS80, except with 10.5" and 10.75" sizes
8968 only meant for sheet media. Duplex is *only* supported on sheet media.
8969
8970 Also, 8x4*3 differs depending on if you're using sheet or roll media,
8971 hence the almost-duplicated definition.
8972
8973 */
8974
8975 static const dyesub_pagesize_t dnpds80dx_page[] =
8976 {
8977 DEFINE_PAPER( "w288h576", "8x4", PT(1236,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
8978 DEFINE_PAPER( "w360h576", "8x5", PT(1536,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
8979 DEFINE_PAPER( "w432h576", "8x6", PT(1836,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
8980 DEFINE_PAPER( "w576h576", "8x8", PT(2436,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
8981 DEFINE_PAPER( "w576h576-div2", "8x4*2", PT(2502,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
8982 DEFINE_PAPER( "w576h648-w576h360_w576h288", "8x5+8x4", PT(2560,300), PT(2802,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8983 DEFINE_PAPER( "c8x10", "8x10", PT(2560,300), PT(3036,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8984 DEFINE_PAPER( "c8x10-div2", "8x5*2", PT(2560,300), PT(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8985 DEFINE_PAPER( "c8x10-w576h432_w576h288", "8x6+8x4", PT(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, PT1(0,300), DYESUB_PORTRAIT),
8986 DEFINE_PAPER( "w576h774-w576h756", "8x10.5 SHEET", PT(2560,300), PT(3186,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8987 DEFINE_PAPER( "w576h774", "8x10.75 SHEET", PT(2560,300), PT(3186,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8988 DEFINE_PAPER( "w576h792-w576h432_w576h360", "8x6+8x5", PT(2560,300), PT(3402,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8989 DEFINE_PAPER( "w576h842", "8x11.7", PT(2560,300), PT(3544,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8990 DEFINE_PAPER( "w576h864", "8x12", PT(2560,300), PT(3636,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8991 DEFINE_PAPER( "w576h864-div2", "8x6*2", PT(2560,300), PT(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8992 DEFINE_PAPER( "w576h864-w576h576_w576h288", "8x8+8x4", PT(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, PT1(0,300), DYESUB_PORTRAIT),
8993 DEFINE_PAPER( "w576h864-div3", "8x4*3", PT(2560,300), PT(3768,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
8994 DEFINE_PAPER( "w576h864-div3sheet", "8x4*3 SHEET", PT(2560,300), PT2(3702,300), PT(56,300), PT(56,300), 0, PT2(0,300), DYESUB_PORTRAIT),
8995 };
8996
8997 LIST(dyesub_pagesize_list_t, dnpds80dx_page_list, dyesub_pagesize_t, dnpds80dx_page);
8998
8999 static const dyesub_printsize_t dnpds80dx_printsize[] =
9000 {
9001 { "300x300", "w288h576", 1236, 2560},
9002 { "300x600", "w288h576", 2472, 2560},
9003 { "300x300", "w360h576", 1536, 2560},
9004 { "300x600", "w360h576", 3072, 2560},
9005 { "300x300", "w432h576", 1836, 2560},
9006 { "300x600", "w432h576", 3672, 2560},
9007 { "300x300", "w576h576", 2436, 2560},
9008 { "300x600", "w576h576", 4872, 2560},
9009 { "300x300", "w576h576-div2", 2502, 2560},
9010 { "300x600", "w576h576-div2", 5004, 2560},
9011 { "300x300", "w576h648-w576h360_w576h288", 2560, 2802},
9012 { "300x600", "w576h648-w576h360_w576h288", 2560, 5604},
9013 { "300x300", "c8x10", 2560, 3036},
9014 { "300x600", "c8x10", 2560, 6072},
9015 { "300x300", "c8x10-div2", 2560, 3102},
9016 { "300x600", "c8x10-div2", 2560, 6204},
9017 { "300x300", "c8x10-w576h432_w576h288", 2560, 3102},
9018 { "300x600", "c8x10-w576h432_w576h288", 2560, 6204},
9019 { "300x300", "w576h774", 2560, 3186},
9020 { "300x600", "w576h774", 2560, 6372},
9021 { "300x300", "w576h774-w576h756", 2560, 3186},
9022 { "300x600", "w576h774-w576h756", 2560, 6372},
9023 { "300x300", "w576h792-w576h432_w576h360", 2560, 3402},
9024 { "300x600", "w576h792-w576h432_w576h360", 2560, 6804},
9025 { "300x300", "w576h842", 2560, 3544},
9026 { "300x600", "w576h842", 2560, 7088},
9027 { "300x300", "w576h864", 2560, 3636},
9028 { "300x600", "w576h864", 2560, 7272},
9029 { "300x300", "w576h864-div2", 2560, 3702},
9030 { "300x600", "w576h864-div2", 2560, 7404},
9031 { "300x300", "w576h864-w576h576_w576h288", 2560, 3702},
9032 { "300x600", "w576h864-w576h576_w576h288", 2560, 7404},
9033 { "300x300", "w576h864-div3", 2560, 3768},
9034 { "300x600", "w576h864-div3", 2560, 7536},
9035 { "300x300", "w576h864-div3sheet", 2560, 3702},
9036 { "300x600", "w576h864-div3sheet", 2560, 7404},
9037 };
9038
9039 LIST(dyesub_printsize_list_t, dnpds80dx_printsize_list, dyesub_printsize_t, dnpds80dx_printsize);
9040
9041 /* Dai Nippon Printing DS-RX1 */
9042 /* Imaging area is wider than print size, we always must supply the
9043 printer with the full imaging width. */
9044 static const dyesub_pagesize_t dnpsrx1_page[] =
9045 {
9046 DEFINE_PAPER( "B7", "3.5x5", PT(1088,300), PT(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE),
9047 DEFINE_PAPER( "w288h432", "4x6", PT(1240,300), PT(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
9048 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1240,300), PT(1920,300), 0, PT1(0,300), PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
9049 DEFINE_PAPER( "w360h360","5x5", PT(1540,300), PT(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE),
9050 DEFINE_PAPER( "w360h504", "5x7", PT(1920,300), PT(2138,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
9051 DEFINE_PAPER( "w360h504-div2", "3.5x5*2", PT(1920,300), PT(2176,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
9052 DEFINE_PAPER( "w432h432", "6x6", PT(1836,300), PT(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
9053 DEFINE_PAPER( "w432h576", "6x8", PT(1920,300), PT(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
9054 DEFINE_PAPER( "w432h576-div4", "2x6*4", PT(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, PT1(0,300), DYESUB_PORTRAIT),
9055 DEFINE_PAPER( "w432h576-div2", "4x6*2", PT(1920,300), PT(2498,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
9056
9057 };
9058
9059 LIST(dyesub_pagesize_list_t, dnpsrx1_page_list, dyesub_pagesize_t, dnpsrx1_page);
9060
9061 static const dyesub_printsize_t dnpsrx1_printsize[] =
9062 {
9063 { "300x300", "B7", 1088, 1920},
9064 { "300x600", "B7", 2176, 1920},
9065 { "300x300", "w288h432", 1240, 1920},
9066 { "300x600", "w288h432", 2480, 1920},
9067 { "300x300", "w288h432-div2", 1240, 1920},
9068 { "300x600", "w288h432-div2", 2480, 1920},
9069 { "300x300", "w360h360", 1540, 1920},
9070 { "300x600", "w360h360", 3080, 1920},
9071 { "300x300", "w360h504", 1920, 2138},
9072 { "300x600", "w360h504", 1920, 4276},
9073 { "300x300", "w360h504-div2", 1920, 2176},
9074 { "300x600", "w360h504-div2", 1920, 4352},
9075 { "300x300", "w432h432", 1836, 1920},
9076 { "300x600", "w432h432", 3672, 1920},
9077 { "300x300", "w432h576", 1920, 2436},
9078 { "300x600", "w432h576", 1920, 4872},
9079 { "300x300", "w432h576-div4", 1920, 2436},
9080 { "300x600", "w432h576-div4", 1920, 4872},
9081 { "300x300", "w432h576-div2", 1920, 2498},
9082 { "300x600", "w432h576-div2", 1920, 4996},
9083 };
9084
9085 LIST(dyesub_printsize_list_t, dnpsrx1_printsize_list, dyesub_printsize_t, dnpsrx1_printsize);
9086
9087 static void dnpdsrx1_printer_start(stp_vars_t *v)
9088 {
9089 dyesub_privdata_t *pd = get_privdata(v);
9090
9091 /* Common code */
9092 dnp_printer_start_common(v);
9093
9094 /* Set cutter option to "normal" */
9095 if (!strcmp(pd->pagesize, "w288h432-div2") || !strcmp(pd->pagesize, "w432h576-div4")) {
9096 stp_zprintf(v, "\033PCNTRL CUTTER 0000000800000120");
9097 } else {
9098 stp_zprintf(v, "\033PCNTRL CUTTER 00000008%08d", pd->privdata.dnp.nocutwaste ? 1 : 0);
9099 }
9100
9101 /* Configure multi-cut/page size */
9102 stp_zprintf(v, "\033PIMAGE MULTICUT 00000008000000");
9103
9104 if (!strcmp(pd->pagesize, "B7")) {
9105 stp_zprintf(v, "01");
9106 } else if (!strcmp(pd->pagesize, "w288h432")) {
9107 stp_zprintf(v, "02");
9108 } else if (!strcmp(pd->pagesize, "w360h360")) {
9109 stp_zprintf(v, "29");
9110 } else if (!strcmp(pd->pagesize, "w360h504")) {
9111 stp_zprintf(v, "03");
9112 } else if (!strcmp(pd->pagesize, "w360h504-div2")) {
9113 stp_zprintf(v, "22");
9114 } else if (!strcmp(pd->pagesize, "w432h432")) {
9115 stp_zprintf(v, "27");
9116 } else if (!strcmp(pd->pagesize, "w432h576")) {
9117 stp_zprintf(v, "04");
9118 } else if (!strcmp(pd->pagesize, "w432h576-div2")) {
9119 stp_zprintf(v, "12");
9120 } else if (!strcmp(pd->pagesize, "w288h432-div2")) {
9121 stp_zprintf(v, "02");
9122 } else if (!strcmp(pd->pagesize, "w432h576-div4")) {
9123 stp_zprintf(v, "04");
9124 } else {
9125 stp_zprintf(v, "00");
9126 }
9127 }
9128
9129 /* Dai Nippon Printing DS620 */
9130 static const overcoat_t dnpds620_overcoat[] =
9131 {
9132 {"Glossy", N_("Glossy"), {3, "000"}},
9133 {"Matte", N_("Matte"), {3, "001"}},
9134 {"MatteFine", N_("Matte Fine"), {3, "021"}},
9135 {"MatteLuster", N_("Matte Luster"), {3, "022"}},
9136 {"PartialMatte", N_("Partial Matte"), {3, "101"}},
9137 {"PartialMatteFine", N_("Partial Matte Fine"), {3, "121"}},
9138 {"PartialMatteLuster", N_("Partial Matte Luster"), {3, "122"}},
9139 };
9140
9141 LIST(overcoat_list_t, dnpds620_overcoat_list, overcoat_t, dnpds620_overcoat);
9142
9143 /* Imaging area is wider than print size, we always must supply the
9144 printer with the full imaging width. */
9145 static const dyesub_pagesize_t dnpds620_page[] =
9146 {
9147 DEFINE_PAPER( "B7", "3.5x5", PT(1088,300), PT(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE),
9148 DEFINE_PAPER( "w144h432", "2x6", PT(1240,300), PT(1920,300), PT(620,300), 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
9149 DEFINE_PAPER( "w243h432", "3.375x6", PT4(1240,300), PT(1920,300), PT4(194,300), 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
9150 DEFINE_PAPER( "w252h432", "3.5x6", PT2(1240,300), PT(1920,300), PT2(96,300), 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
9151 DEFINE_PAPER( "w270h432", "3.75x6", PT3(1240,300), PT(1920,300), PT3(78,300), 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
9152 DEFINE_PAPER( "w288h432", "4x6", PT(1240,300), PT(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
9153 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1240,300), PT(1920,300), 0, PT1(0,300), PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
9154 DEFINE_PAPER( "w324h432", "4.5x6", PT(1386,300), PT(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
9155 DEFINE_PAPER( "w360h360", "5x5", PT(1540,300), PT(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE),
9156 DEFINE_PAPER( "w360h504", "5x7", PT(1920,300), PT(2138,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
9157 DEFINE_PAPER( "w360h504-div2", "3.5x5*2", PT(1920,300), PT(2176,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
9158 DEFINE_PAPER( "w360h504-w360h360_w360h144", "5x5+2x5", PT(1920,300), PT(2138,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
9159 DEFINE_PAPER( "w432h432", "6x6", PT(1836,300), PT(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
9160 DEFINE_PAPER( "w432h576", "6x8", PT(1920,300), PT(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
9161 DEFINE_PAPER( "w432h576-w432h432_w432h144", "6x6+2x6", PT(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, PT1(0,300), DYESUB_PORTRAIT),
9162 DEFINE_PAPER( "w432h576-div4", "2x6*4", PT(1920,300), PT2(2436,300), PT(38,300), PT(38,300), 0, PT2(0,300), DYESUB_PORTRAIT),
9163 DEFINE_PAPER( "w432h576-div2", "4x6*2", PT(1920,300), PT(2498,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
9164 DEFINE_PAPER( "w432h648", "6x9", PT(1920,300), PT(2740,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
9165 DEFINE_PAPER( "w432h648-div2", "4.5x6*2", PT(1920,300), PT(2802,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
9166 DEFINE_PAPER( "w432h1025", "6x14 Cont Panorama", PT(1920,300), PT(4236,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
9167 DEFINE_PAPER( "w432h1466", "6x20 Cont Panorama", PT(1920,300), PT(6036,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
9168 DEFINE_PAPER( "w432h1169", "6x16 Discrete Panorama", PT(1920,300), PT(4872,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
9169 DEFINE_PAPER( "w432h1754", "6x24 Discrete Panorama", PT(1920,300), PT(7308,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
9170 };
9171
9172 LIST(dyesub_pagesize_list_t, dnpds620_page_list, dyesub_pagesize_t, dnpds620_page);
9173
9174 static const dyesub_printsize_t dnpds620_printsize[] =
9175 {
9176 { "300x300", "B7", 1088, 1920},
9177 { "300x600", "B7", 2176, 1920},
9178 { "300x300", "w144h432", 1240, 1920},
9179 { "300x600", "w144h432", 1240, 1920},
9180 { "300x300", "w243h432", 1240, 1920},
9181 { "300x600", "w243h432", 2480, 1920},
9182 { "300x300", "w252h432", 1240, 1920},
9183 { "300x600", "w252h432", 2480, 1920},
9184 { "300x300", "w270h432", 1240, 1920},
9185 { "300x600", "w270h432", 2480, 1920},
9186 { "300x300", "w288h432", 1240, 1920},
9187 { "300x600", "w288h432", 2480, 1920},
9188 { "300x300", "w288h432-div2", 1240, 1920},
9189 { "300x600", "w288h432-div2", 2480, 1920},
9190 { "300x300", "w324h432", 1386, 1920},
9191 { "300x600", "w324h432", 2772, 1920},
9192 { "300x300", "w360h360", 1540, 1920},
9193 { "300x600", "w360h360", 3080, 1920},
9194 { "300x300", "w360h504", 1920, 2138},
9195 { "300x600", "w360h504", 1920, 4276},
9196 { "300x300", "w360h504-w360h360_w360h144", 1920, 2138},
9197 { "300x600", "w360h504-w360h360_w360h144", 1920, 4276},
9198 { "300x300", "w360h504-div2", 1920, 2176},
9199 { "300x600", "w360h504-div2", 1920, 4352},
9200 { "300x300", "w432h432", 1836, 1920},
9201 { "300x600", "w432h432", 3672, 1920},
9202 { "300x300", "w432h576", 1920, 2436},
9203 { "300x600", "w432h576", 1920, 4872},
9204 { "300x300", "w432h576-div4", 1920, 2436},
9205 { "300x600", "w432h576-div4", 1920, 4872},
9206 { "300x300", "w432h576-w432h432_w432h144", 1920, 2436},
9207 { "300x600", "w432h576-w432h432_w432h144", 1920, 4872},
9208 { "300x300", "w432h576-div2", 1920, 2498},
9209 { "300x600", "w432h576-div2", 1920, 4996},
9210 { "300x300", "w432h648", 1920, 2740},
9211 { "300x600", "w432h648", 1920, 5480},
9212 { "300x300", "w432h648-div2", 1920, 2802},
9213 { "300x600", "w432h648-div2", 1920, 5604},
9214 { "300x300", "w432h1025", 1920, 4236},
9215 { "300x600", "w432h1025", 1920, 8472},
9216 { "300x300", "w432h1466", 1920, 6036},
9217 { "300x600", "w432h1466", 1920, 12072},
9218 { "300x300", "w432h1169", 1920, 4872},
9219 { "300x600", "w432h1169", 1920, 9744},
9220 { "300x300", "w432h1754", 1920, 7308},
9221 { "300x600", "w432h1754", 1920, 14616},
9222 };
9223
9224 LIST(dyesub_printsize_list_t, dnpds620_printsize_list, dyesub_printsize_t, dnpds620_printsize);
9225
9226 static void dnpds620_printer_start(stp_vars_t *v)
9227 {
9228 dyesub_privdata_t *pd = get_privdata(v);
9229 int trim = 0; /* XXX add another parameter to control this. 0 or 12-22 for intermediate scrap on fw >= 1.20. */
9230 int cut1 = 0, cut2 = 0, cut3 = 0, cut4 = 0;
9231 int multicut = 0;
9232
9233 /* Common code */
9234 dnp_printer_start_common(v);
9235
9236 /* Multicut when 8x6 media is in use */
9237 if (!strcmp(pd->pagesize, "w432h576-div4")) {
9238 cut1 = cut2 = cut3 = cut4 = 20;
9239 } else if (!strcmp(pd->pagesize, "w432h576-w432h432_w432h144")) {
9240 cut1 = 60;
9241 cut2 = 20;
9242 } else if (!strcmp(pd->pagesize, "w360h504-w360h360_w360h144")) {
9243 cut1 = 50;
9244 cut2 = 20;
9245 } else if (!strcmp(pd->pagesize, "w288h432-div2")) {
9246 cut1 = cut2 = 20;
9247 } else if (!strcmp(pd->pagesize, "w144h432")) {
9248 cut1 = 20;
9249 } else if (!strcmp(pd->pagesize, "w243h432")) {
9250 cut1 = 34;
9251 } else if (!strcmp(pd->pagesize, "w252h432")) {
9252 cut1 = 35;
9253 } else if (!strcmp(pd->pagesize, "w270h432")) {
9254 cut1 = 37;
9255 }
9256
9257 /* Cutter control */
9258 if (cut1) {
9259 stp_zprintf(v, "\033PCNTRL FULL_CUTTER_SET 00000016");
9260 stp_zprintf(v, "%03d%03d%03d%03d%03d\r", cut1, cut2, cut3, cut4, trim);
9261 } else {
9262 stp_zprintf(v, "\033PCNTRL CUTTER 00000008%08d", pd->privdata.dnp.nocutwaste ? 1 : 0);
9263 }
9264
9265 /* Configure multi-cut/page size */
9266 if (!strcmp(pd->pagesize, "B7")) {
9267 multicut = 1;
9268 } else if (!strcmp(pd->pagesize, "w288h432") || !strcmp(pd->pagesize, "w288h432-div2") || !strcmp(pd->pagesize, "w144h432") || !strcmp(pd->pagesize, "w243h432") || !strcmp(pd->pagesize, "w252h432") || !strcmp(pd->pagesize, "w270h432")) {
9269 multicut = 2;
9270 } else if (!strcmp(pd->pagesize, "w324h432")) {
9271 multicut = 30;
9272 } else if (!strcmp(pd->pagesize, "w360h360")) {
9273 multicut = 29;
9274 } else if (!strcmp(pd->pagesize, "w360h504") || !strcmp(pd->pagesize, "w360h504-w360h360_w360h144")) {
9275 multicut = 3;
9276 } else if (!strcmp(pd->pagesize, "w360h504-div2")) {
9277 multicut = 22;
9278 } else if (!strcmp(pd->pagesize, "w432h432")) {
9279 multicut = 27;
9280 } else if (!strcmp(pd->pagesize, "w432h576") || !strcmp(pd->pagesize, "w432h576-w432h432_w432h144") || !strcmp(pd->pagesize, "w432h576-div4")) {
9281 multicut = 4;
9282 } else if (!strcmp(pd->pagesize, "w432h576-div2")) {
9283 multicut = 12;
9284 } else if (!strcmp(pd->pagesize, "w432h648")) {
9285 multicut = 5;
9286 } else if (!strcmp(pd->pagesize, "w432h648-div2")) {
9287 multicut = 31;
9288 } else if (!strcmp(pd->pagesize, "w432h1025")) {
9289 multicut = 9000;
9290 } else if (!strcmp(pd->pagesize, "w432h1466")) {
9291 multicut = 9001;
9292 } else if (!strcmp(pd->pagesize, "w432h1169")) {
9293 multicut = 9020;
9294 } else if (!strcmp(pd->pagesize, "w432h1754")) {
9295 multicut = 9021;
9296 }
9297 stp_zprintf(v, "\033PIMAGE MULTICUT 000000080000%04d", multicut);
9298 }
9299
9300 /* Dai Nippon Printing DS820 */
9301
9302 /* Imaging area is wider than print size, we always must supply the
9303 printer with the full imaging width. */
9304 static const dyesub_pagesize_t dnpds820_page[] =
9305 {
9306 DEFINE_PAPER( "w288h576", "8x4", PT(1236,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
9307 DEFINE_PAPER( "w360h576", "8x5", PT(1536,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
9308 DEFINE_PAPER( "w432h576", "8x6", PT(1836,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
9309 DEFINE_PAPER( "w504h576", "8x7", PT(2136,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
9310 DEFINE_PAPER( "w576h576", "8x8", PT(2436,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
9311 DEFINE_PAPER( "w576h576-div2", "8x4*2", PT(2502,300), PT(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
9312 DEFINE_PAPER( "w576h648", "8x9", PT(2560,300), PT(2736,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9313 DEFINE_PAPER( "w576h648-w576h360_w576h288", "8x5+8x4", PT(2560,300), PT(2802,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9314 DEFINE_PAPER( "c8x10", "8x10", PT(2560,300), PT(3036,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9315 DEFINE_PAPER( "c8x10-div2", "8x5*2", PT(2560,300), PT(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9316 DEFINE_PAPER( "c8x10-w576h432_w576h288", "8x6+8x4", PT(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, PT1(0,300), DYESUB_PORTRAIT),
9317 DEFINE_PAPER( "w576h792-w576h432_w576h360", "8x6+8x5", PT(2560,300), PT(3402,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9318 DEFINE_PAPER( "w576h842", "8x11.7", PT(2560,300), PT(3544,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9319 DEFINE_PAPER( "w576h864", "8x12", PT(2560,300), PT(3636,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9320 DEFINE_PAPER( "w576h864-div2", "8x6*2", PT(2560,300), PT(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9321 DEFINE_PAPER( "w576h864-w576h576_w576h288", "8x8+8x4", PT(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, PT1(0,300), DYESUB_PORTRAIT),
9322 DEFINE_PAPER( "w576h864-div3", "8x4*3", PT(2560,300), PT(3768,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9323 DEFINE_PAPER( "A4x4inch", "A4x4inch", PT(1236,300), PT(2560,300), 0, 0, PT(16,300), PT(16,300), DYESUB_LANDSCAPE),
9324 DEFINE_PAPER( "A4x5inch", "A4x5inch", PT(1536,300), PT(2560,300), 0, 0, PT(16,300), PT(16,300), DYESUB_LANDSCAPE),
9325 DEFINE_PAPER( "A5", "A5", PT(1784,300), PT(2560,300), 0, 0, PT(16,300), PT(16,300), DYESUB_LANDSCAPE),
9326 DEFINE_PAPER( "A4x6inch", "A4x6inch", PT(1836,300), PT(2560,300), 0, 0, PT(16,300), PT(16,300), DYESUB_LANDSCAPE),
9327 DEFINE_PAPER( "A4x8inch", "A4x8inch", PT(2436,300), PT(2560,300), 0, 0, PT(16,300), PT(16,300), DYESUB_LANDSCAPE),
9328 DEFINE_PAPER( "A4x10inch", "A4x10inch", PT(2560,300), PT(3036,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
9329 DEFINE_PAPER( "A4x10inch-div2", "A4x5inch*2", PT(2560,300), PT(3102,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
9330 DEFINE_PAPER( "A4", "A4", PT(2560,300), PT(3544,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
9331 DEFINE_PAPER( "A4-div2", "A5*2", PT(2560,300), PT(3598,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
9332 /* Panorama sizes */
9333 DEFINE_PAPER( "w576h1305", "8x18 Cont Panorama", PT(2560,300), PT(5436,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9334 DEFINE_PAPER( "w576h1881", "8x26 Cont Panorama", PT(2560,300), PT(7836,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9335 DEFINE_PAPER( "w576h1593", "8x22 Cont Panorama", PT(2560,300), PT(6636,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9336 DEFINE_PAPER( "w576h2312", "8x32 Cont Panorama", PT(2560,300), PT(9636,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9337
9338 DEFINE_PAPER( "w576h1440", "8x20 Discrete Panorama", PT(2560,300), PT(6072,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9339 DEFINE_PAPER( "w576h2160", "8x30 Discrete Panorama", PT(2560,300), PT(9108,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9340 DEFINE_PAPER( "w576h1728", "8x24 Discrete Panorama", PT(2560,300), PT(7272,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9341 DEFINE_PAPER( "w576h2592", "8x36 Discrete Panorama", PT(2560,300), PT(10908,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
9342
9343 // DEFINE_PAPER( "A4x2C", "A4*2 Cont Panorama", PT(2560,300), PT(6452,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
9344 // DEFINE_PAPER( "A4x3C", "A4*3 Cont Panorama", PT(2560,300), PT(9360,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
9345 DEFINE_PAPER( "A4x2", "A4*2 Discrete Panorama", PT(2560,300), PT(7088,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
9346 DEFINE_PAPER( "A4x3", "A4*3 Discrete Panorama", PT(2560,300), PT(10632,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
9347
9348 /* Note: Continuous panoramas ONLY work with 8x12/8x10 media and sizes! */
9349 };
9350
9351 LIST(dyesub_pagesize_list_t, dnpds820_page_list, dyesub_pagesize_t, dnpds820_page);
9352
9353 static const dyesub_printsize_t dnpds820_printsize[] =
9354 {
9355 { "300x300", "w288h576", 1236, 2560},
9356 { "300x600", "w288h576", 2472, 2560},
9357 { "300x300", "w360h576", 1536, 2560},
9358 { "300x600", "w360h576", 3072, 2560},
9359 { "300x300", "w432h576", 1836, 2560},
9360 { "300x600", "w432h576", 3672, 2560},
9361 { "300x300", "w504h576", 2136, 2560},
9362 { "300x600", "w504h576", 4272, 2560},
9363 { "300x300", "w576h576", 2436, 2560},
9364 { "300x600", "w576h576", 4872, 2560},
9365 { "300x300", "w576h576-div2", 2502, 2560},
9366 { "300x600", "w576h576-div2", 5004, 2560},
9367 { "300x300", "w576h648", 2560, 2736},
9368 { "300x600", "w576h648", 2560, 5472},
9369 { "300x300", "w576h648-w576h360_w576h288", 2560, 2802},
9370 { "300x600", "w576h648-w576h360_w576h288", 2560, 5604},
9371 { "300x300", "c8x10", 2560, 3036},
9372 { "300x600", "c8x10", 2560, 6072},
9373 { "300x300", "c8x10-div2", 2560, 3102},
9374 { "300x600", "c8x10-div2", 2560, 6204},
9375 { "300x300", "c8x10-w576h432_w576h288", 2560, 3102},
9376 { "300x600", "c8x10-w576h432_w576h288", 2560, 6204},
9377 { "300x300", "w576h792-w576h432_w576h360", 2560, 3402},
9378 { "300x600", "w576h792-w576h432_w576h360", 2560, 6804},
9379 { "300x300", "w576h842", 2560, 3544},
9380 { "300x600", "w576h842", 2560, 7088},
9381 { "300x300", "w576h864", 2560, 3636},
9382 { "300x600", "w576h864", 2560, 7272},
9383 { "300x300", "w576h864-div2", 2560, 3702},
9384 { "300x600", "w576h864-div2", 2560, 7404},
9385 { "300x300", "w576h864-w576h576_w576h288", 2560, 3702},
9386 { "300x600", "w576h864-w576h576_w576h288", 2560, 7404},
9387 { "300x300", "w576h864-div3", 2560, 3768},
9388 { "300x600", "w576h864-div3", 2560, 7536},
9389 { "300x300", "A4x4inch", 1236, 2560},
9390 { "300x600", "A4x4inch", 2472, 2560},
9391 { "300x300", "A4x5inch", 1536, 2560},
9392 { "300x600", "A4x5inch", 3072, 2560},
9393 { "300x300", "A5", 1784, 2560},
9394 { "300x600", "A5", 3568, 2560},
9395 { "300x300", "A4x6inch", 1836, 2560},
9396 { "300x600", "A4x6inch", 3672, 2560},
9397 { "300x300", "A4x8inch", 2436, 2560},
9398 { "300x600", "A4x8inch", 4872, 2560},
9399 { "300x300", "A4x10inch", 2560, 3036},
9400 { "300x600", "A4x10inch", 2560, 6072},
9401 { "300x300", "A4x10inch-div2", 2560, 3102},
9402 { "300x600", "A4x10inch-div2", 2560, 6204},
9403 { "300x300", "A4", 2560, 3544},
9404 { "300x600", "A4", 2560, 7088},
9405 { "300x300", "A4-div2", 2560, 3598},
9406 { "300x600", "A4-div2", 2560, 7196},
9407 /* Panorama sizes */
9408
9409 { "300x300", "w576h1305", 2560, 5436},
9410 { "300x600", "w576h1305", 2560, 10872},
9411 { "300x300", "w576h1881", 2560, 7836},
9412 { "300x600", "w576h1881", 2560, 15672},
9413 { "300x300", "w576h1593", 2560, 6636},
9414 { "300x600", "w576h1593", 2560, 13272},
9415 { "300x300", "w576h2312", 2560, 9636},
9416 { "300x600", "w576h2312", 2560, 19272},
9417
9418 { "300x300", "w576h1440", 2560, 6072},
9419 { "300x600", "w576h1440", 2560, 12144},
9420 { "300x300", "w576h2160", 2560, 9108},
9421 { "300x600", "w576h2160", 2560, 18216},
9422 { "300x300", "w576h1728", 2560, 7272},
9423 { "300x600", "w576h1728", 2560, 14544},
9424 { "300x300", "w576h2592", 2560, 10908},
9425 { "300x600", "w576h2592", 2560, 21816},
9426
9427 // { "300x300", "A4x2C", 2560, 6452},
9428 // { "300x600", "A4x2C", 2560, 12904},
9429 // { "300x300", "A4x3C", 2560, 9360},
9430 // { "300x600", "A4x3C", 2560, 18720},
9431 { "300x300", "A4x2", 2560, 7088},
9432 { "300x600", "A4x2", 2560, 14176},
9433 { "300x300", "A4x3", 2560, 10632},
9434 { "300x600", "A4x3", 2560, 21264},
9435 };
9436
9437 LIST(dyesub_printsize_list_t, dnpds820_printsize_list, dyesub_printsize_t, dnpds820_printsize);
9438
9439 static void dnpds820_printer_start(stp_vars_t *v)
9440 {
9441 dyesub_privdata_t *pd = get_privdata(v);
9442
9443 int trim = 0; /* XXX add another parameter to control this. 0 or 12-22 for intermediate scrap */
9444 int cut1 = 0, cut2 = 0, cut3 = 0, cut4 = 0, cut5 = 0, cut6 = 0;
9445 int mcut = 0;
9446
9447 /* Common code */
9448 dnp_printer_start_common(v);
9449
9450 /* Configure multi-cut/page size */
9451 if (!strcmp(pd->pagesize, "c8x10")) {
9452 mcut = 6;
9453 } else if (!strcmp(pd->pagesize, "w576h864")) {
9454 mcut = 7;
9455 } else if (!strcmp(pd->pagesize, "w288h576")) {
9456 mcut = 8;
9457 } else if (!strcmp(pd->pagesize, "w360h576")) {
9458 mcut = 9;
9459 } else if (!strcmp(pd->pagesize, "w432h576")) {
9460 mcut = 10;
9461 } else if (!strcmp(pd->pagesize, "w576h576")) {
9462 mcut = 11;
9463 } else if (!strcmp(pd->pagesize, "w576h576-div2")) {
9464 mcut = 13;
9465 } else if (!strcmp(pd->pagesize, "c8x10-div2")) {
9466 mcut = 14;
9467 } else if (!strcmp(pd->pagesize, "w576h864-div2")) {
9468 mcut = 15;
9469 } else if (!strcmp(pd->pagesize, "w576h648-w576h360_w576h288")) {
9470 mcut = 16;
9471 } else if (!strcmp(pd->pagesize, "c8x10-w576h432_w576h288")) {
9472 mcut = 17;
9473 } else if (!strcmp(pd->pagesize, "w576h792-w576h432_w576h360")) {
9474 mcut = 18;
9475 } else if (!strcmp(pd->pagesize, "w576h864-w576h576_w576h288")) {
9476 mcut = 19;
9477 } else if (!strcmp(pd->pagesize, "w576h864-div3")) {
9478 mcut = 20;
9479 } else if (!strcmp(pd->pagesize, "w576h842")) {
9480 mcut = 21;
9481 } else if (!strcmp(pd->pagesize, "w504h576")) {
9482 mcut = 32;
9483 } else if (!strcmp(pd->pagesize, "w576h648")) {
9484 mcut = 33;
9485 } else if (!strcmp(pd->pagesize, "A5")) {
9486 mcut = 34;
9487 } else if (!strcmp(pd->pagesize, "A4x4inch")) {
9488 mcut = 36;
9489 } else if (!strcmp(pd->pagesize, "A4x5inch")) {
9490 mcut = 37;
9491 } else if (!strcmp(pd->pagesize, "A4x6inch")) {
9492 mcut = 38;
9493 } else if (!strcmp(pd->pagesize, "A4x8inch")) {
9494 mcut = 39;
9495 } else if (!strcmp(pd->pagesize, "A4x10inch")) {
9496 mcut = 40;
9497 } else if (!strcmp(pd->pagesize, "A4x10inch-div2")) {
9498 mcut = 43;
9499 } else if (!strcmp(pd->pagesize, "A4")) {
9500 mcut = 41;
9501 } else if (!strcmp(pd->pagesize, "A4-div2")) {
9502 mcut = 35;
9503 } else if (!strcmp(pd->pagesize, "w576h1305")) {
9504 mcut = 9010;
9505 } else if (!strcmp(pd->pagesize, "w576h1881")) {
9506 mcut = 9011;
9507 } else if (!strcmp(pd->pagesize, "w576h1593")) {
9508 mcut = 9012;
9509 } else if (!strcmp(pd->pagesize, "w576h2312")) {
9510 mcut = 9013;
9511 } else if (!strcmp(pd->pagesize, "w576h1440")) {
9512 mcut = 9030;
9513 } else if (!strcmp(pd->pagesize, "w576h2160")) {
9514 mcut = 9031;
9515 } else if (!strcmp(pd->pagesize, "w576h1728")) {
9516 mcut = 9032;
9517 } else if (!strcmp(pd->pagesize, "w576h2592")) {
9518 mcut = 9033;
9519 // } else if (!strcmp(pd->pagesize, "A4x2C")) {
9520 // mcut = 9014;
9521 // } else if (!strcmp(pd->pagesize, "A4x3C")) {
9522 // mcut = 9015;
9523 } else if (!strcmp(pd->pagesize, "A4x2")) {
9524 mcut = 9034;
9525 } else if (!strcmp(pd->pagesize, "A4x3")) {
9526 mcut = 9035;
9527 }
9528
9529 stp_zprintf(v, "\033PIMAGE MULTICUT 000000080000%04u", mcut);
9530
9531 /* Cutter control */
9532 if (cut1) {
9533 stp_zprintf(v, "\033PCNTRL FULL_CUTTER_SET 00000024");
9534 stp_zprintf(v, "%03d%03d%03d%03d%03d%03d%03d\r", cut1, cut2, cut3, cut4, cut5, cut6, trim);
9535 dyesub_nputc(v, '\0', 3);
9536 } else {
9537 stp_zprintf(v, "\033PCNTRL CUTTER 00000008%08d", pd->privdata.dnp.nocutwaste ? 1 : 0);
9538 }
9539
9540 if (!strcmp(pd->privdata.dnp.print_speed, "LowSpeed")) {
9541 stp_zprintf(v, "\033PCNTRL PRINTSPEED 0000000800000020");
9542 } else if (!strcmp(pd->privdata.dnp.print_speed, "HighDensity")) {
9543 stp_zprintf(v, "\033PCNTRL PRINTSPEED 0000000800000030");
9544 }
9545 }
9546
9547 static const dyesub_stringitem_t dnpds820_print_speeds[] =
9548 {
9549 { "Normal", N_ ("Normal") },
9550 { "LowSpeed", N_ ("Low Speed") },
9551 { "HighDensity", N_ ("High Density") }
9552 };
9553 LIST(dyesub_stringlist_t, dnpds820_printspeeds_list, dyesub_stringitem_t, dnpds820_print_speeds);
9554
9555 static const stp_parameter_t ds820_parameters[] =
9556 {
9557 {
9558 "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
9559 N_("Print Speed"),
9560 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
9561 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
9562 },
9563 {
9564 "NoCutWaste", N_("No Cut-Paper Waste"), "Color=No,Category=Advanced Printer Setup",
9565 N_("No Cut-Paper Waste"),
9566 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
9567 STP_PARAMETER_LEVEL_ADVANCED, 1, 0, STP_CHANNEL_NONE, 1, 0
9568 },
9569 };
9570 #define ds820_parameter_count (sizeof(ds820_parameters) / sizeof(const stp_parameter_t))
9571
9572 static int
9573 ds820_load_parameters(const stp_vars_t *v, const char *name,
9574 stp_parameter_t *description)
9575 {
9576 unsigned int i;
9577 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
9578 stp_get_model_id(v));
9579
9580 if (caps->parameter_count && caps->parameters)
9581 {
9582 for (i = 0; i < caps->parameter_count; i++)
9583 if (strcmp(name, caps->parameters[i].name) == 0)
9584 {
9585 stp_fill_parameter_settings(description, &(caps->parameters[i]));
9586 break;
9587 }
9588 }
9589
9590 if (strcmp(name, "PrintSpeed") == 0)
9591 {
9592 description->bounds.str = stp_string_list_create();
9593
9594 const dyesub_stringlist_t *mlist = &dnpds820_printspeeds_list;
9595 for (i = 0; i < mlist->n_items; i++)
9596 {
9597 const dyesub_stringitem_t *m = &(mlist->item[i]);
9598 stp_string_list_add_string(description->bounds.str,
9599 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
9600 }
9601 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
9602 description->is_active = 1;
9603 }
9604 else if (strcmp(name, "NoCutWaste") == 0)
9605 {
9606 description->is_active = 1;
9607 description->deflt.boolean = 0;
9608 }
9609 else
9610 {
9611 return 0;
9612 }
9613 return 1;
9614 }
9615
9616 static int ds820_parse_parameters(stp_vars_t *v)
9617 {
9618 dyesub_privdata_t *pd = get_privdata(v);
9619 const char *print_speed = stp_get_string_parameter(v, "PrintSpeed");
9620 int nocutwaste = stp_get_boolean_parameter(v, "NoCutWaste");
9621
9622 if (pd) {
9623 pd->privdata.dnp.print_speed = print_speed;
9624 pd->privdata.dnp.nocutwaste = nocutwaste;
9625 }
9626
9627 return 1;
9628 }
9629
9630 /* DNP QW410 */
9631 static const overcoat_t dnp_qw410_overcoat[] =
9632 {
9633 {"Glossy", N_("Glossy"), {3, "000"}},
9634 {"Matte", N_("Matte"), {3, "001"}},
9635 {"PartialMatte", N_("Partial Matte"), {3, "101"}},
9636 };
9637
9638 LIST(overcoat_list_t, dnp_qw410_overcoat_list, overcoat_t, dnp_qw410_overcoat);
9639
9640 /* Imaging area is wider than print size, we always must supply the
9641 printer with the full imaging width. */
9642 static const dyesub_pagesize_t dnp_qw410_page[] =
9643 {
9644 DEFINE_PAPER( "w288h288", "4x4", PT(1236,300), PT(1408,300), 0, 0, PT(71,300), PT(71,300), DYESUB_LANDSCAPE),
9645 DEFINE_PAPER( "w288h288-div2", "2x4*2", PT1(1236,300), PT(1408,300), 0, PT1(0,300), PT(71,300), PT(71,300), DYESUB_LANDSCAPE),
9646 DEFINE_PAPER( "w288h216", "4x3", PT(1836,300), PT(1408,300), PT(900,300), 0, PT(71,300), PT(71,300), DYESUB_LANDSCAPE),
9647 DEFINE_PAPER( "w288h288_w288h144", "4x4+4x2", PT(1408,300), PT1(1836,300), PT(71,300), PT(71,300), 0, PT1(0,300), DYESUB_PORTRAIT),
9648 DEFINE_PAPER( "w288h432", "4x6", PT(1408,300), PT(1836,300), PT(71,300), PT(71,300), 0, 0, DYESUB_PORTRAIT),
9649 DEFINE_PAPER( "w288h432-div2", "4x3*2", PT(1408,300), PT2(1836,300), PT(71,300), PT(71,300), 0, PT2(0,300), DYESUB_PORTRAIT),
9650 DEFINE_PAPER( "w288h432-div3", "2x4*3", PT(1408,300), PT3(1836,300), PT(71,300), PT(71,300), 0, PT3(0,300), DYESUB_PORTRAIT),
9651 DEFINE_PAPER( "w288h576", "4x8", PT(1408,300), PT(2436,300), PT(71,300), PT(71,300), 0, 0, DYESUB_PORTRAIT),
9652 DEFINE_PAPER( "w288h432_w288h144", "4x6+4x2", PT(1408,300), PT1(2436,300), PT(71,300), PT(71,300), 0, PT1(0,300), DYESUB_PORTRAIT),
9653 DEFINE_PAPER( "w288h432-div2_w288h144", "4x3*2+4x2", PT(1408,300), PT2(2436,300), PT(71,300), PT(71,300), 0, PT2(0,300), DYESUB_PORTRAIT),
9654 DEFINE_PAPER( "w288h576-div2", "4x4*2", PT(1408,300), PT3(2436,300), PT(71,300), PT(71,300), 0, PT3(0,300), DYESUB_PORTRAIT),
9655 DEFINE_PAPER( "w288h576-div4", "2x4*4", PT(1408,300), PT4(2436,300), PT(71,300), PT(71,300), 0, PT4(0,300), DYESUB_PORTRAIT),
9656 DEFINE_PAPER( "w324h216", "4.5x3", PT(1836,300), PT(1408,300), PT(900,300), 0, 0, 0, DYESUB_LANDSCAPE),
9657 DEFINE_PAPER( "w324h288", "4.5x4", PT(1836,300), PT(1408,300), PT(600,300), 0, 0, 0, DYESUB_LANDSCAPE),
9658 DEFINE_PAPER( "w324h324", "4.5x4.5", PT(1386,300), PT(1408,300), 0, 0, 0, 0, DYESUB_LANDSCAPE),
9659 DEFINE_PAPER( "w324h432", "4.5x6", PT(1408,300), PT(1836,300), 0, 0, 0, 0, DYESUB_PORTRAIT),
9660 DEFINE_PAPER( "w324h432-div2", "4.5x3*2", PT(1408,300), PT1(1836,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
9661 DEFINE_PAPER( "w324h486", "4.5x6.75", PT(1408,300), PT(2436,300), 0, 0, PT(375,300), 0, DYESUB_PORTRAIT),
9662 // XXX 4.5x4.5 + 4.5x2 / 4.5x3 / 4.5x3.5 ?
9663 DEFINE_PAPER( "w324h432-div3", "4.5x2*3", PT(1408,300), PT2(1836,300), 0, 0, 0, PT2(0,300), DYESUB_PORTRAIT),
9664 DEFINE_PAPER( "w324h576", "4.5x8", PT(1408,300), PT(2436,300), 0, 0, 0, 0, DYESUB_PORTRAIT),
9665 DEFINE_PAPER( "w324h576-div2", "4.5x4*2", PT(1408,300), PT1(2436,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
9666 DEFINE_PAPER( "w324h576-div4", "4.5x2*4", PT(1408,300), PT2(2436,300), 0, 0, 0, PT2(0,300), DYESUB_PORTRAIT),
9667 DEFINE_PAPER( "w324h432_w324h144", "4.5x6+4.5x2", PT(1408,300), PT3(2436,300), 0, 0, 0, PT3(0,300), DYESUB_PORTRAIT),
9668 DEFINE_PAPER( "w324h432-div2_w324h144", "4.5x3*2+4.5x2", PT(1408,300), PT4(2436,300), 0, 0, 0, PT4(0,300), DYESUB_PORTRAIT),
9669 };
9670
9671 LIST(dyesub_pagesize_list_t, dnp_qw410_page_list, dyesub_pagesize_t, dnp_qw410_page);
9672
9673 static const dyesub_printsize_t dnp_qw410_printsize[] =
9674 {
9675 { "300x300", "w288h288", 1236, 1408},
9676 { "300x300", "w288h288-div2", 1236, 1408},
9677 { "300x300", "w288h288_w288h144", 1408, 1836},
9678 { "300x300", "w288h216", 1836, 1408},
9679 { "300x300", "w288h432", 1408, 1836},
9680 { "300x300", "w288h432-div2", 1408, 1836},
9681 { "300x300", "w288h432-div3", 1408, 1836},
9682 { "300x300", "w288h576", 1408, 2436},
9683 { "300x300", "w288h432_w288h144", 1408, 2436},
9684 { "300x300", "w288h432-div2_w288h144", 1408, 2436},
9685 { "300x300", "w288h576-div2", 1408, 2436},
9686 { "300x300", "w288h576-div4", 1408, 2436},
9687 { "300x300", "w324h216", 1836, 1408},
9688 { "300x300", "w324h288", 1836, 1408},
9689 { "300x300", "w324h324", 1386, 1408},
9690 { "300x300", "w324h432", 1408, 1836},
9691 { "300x300", "w324h432-div2", 1408, 1836},
9692 { "300x300", "w324h432-div3", 1408, 1836},
9693 { "300x300", "w324h486", 1408, 2436},
9694 { "300x300", "w324h576", 1408, 2436},
9695 { "300x300", "w324h576-div2", 1408, 2436},
9696 { "300x300", "w324h576-div4", 1408, 2436},
9697 { "300x300", "w324h432_w324h144", 1408, 2436},
9698 { "300x300", "w324h432-div2_w324h144", 1408, 2436},
9699 };
9700
9701 LIST(dyesub_printsize_list_t, dnp_qw410_printsize_list, dyesub_printsize_t, dnp_qw410_printsize);
9702
9703 static void dnp_qw410_printer_start(stp_vars_t *v)
9704 {
9705 dyesub_privdata_t *pd = get_privdata(v);
9706 int trim = 0; /* XXX add another parameter to control this. 0 or 22 for intermediate scrap on qw410. */
9707 int cut1 = 0, cut2 = 0, cut3 = 0, cut4 = 0;
9708 int multicut = 0;
9709
9710 /* Common code */
9711 dnp_printer_start_common(v);
9712
9713 if (!strcmp(pd->pagesize, "w288h216") || !strcmp(pd->pagesize, "w324h216")) {
9714 cut1 = 30;
9715 } else if (!strcmp(pd->pagesize, "w324h288")) {
9716 cut1 = 40;
9717 } else if (!strcmp(pd->pagesize, "w324h486")) {
9718 cut1 = 67;
9719 } else if (!strcmp(pd->pagesize, "w288h288-div2")) {
9720 cut1 = cut2 = 20;
9721 } else if (!strcmp(pd->pagesize, "w288h432-div2") || !strcmp(pd->pagesize, "w324h432-div2")) {
9722 cut1 = cut2 = 30;
9723 } else if (!strcmp(pd->pagesize, "w288h576-div2") || !strcmp(pd->pagesize, "w324h576-div2")) {
9724 cut1 = cut2 = 40;
9725 } else if (!strcmp(pd->pagesize, "w288h432-div3") || !strcmp(pd->pagesize, "w324h432-div3")) {
9726 cut1 = cut2 = cut3 = 20;
9727 } else if (!strcmp(pd->pagesize, "w288h576-div4") || !strcmp(pd->pagesize, "w324h576-div4")) {
9728 cut1 = cut2 = cut3 = cut4 = 20;
9729 } else if (!strcmp(pd->pagesize, "w288h288_w288h144")) {
9730 cut1 = 40;
9731 cut2 = 20;
9732 } else if (!strcmp(pd->pagesize, "w288h432_w288h144") || !strcmp(pd->pagesize, "w324h432_w324h144")) {
9733 cut1 = 60;
9734 cut2 = 20;
9735 } else if (!strcmp(pd->pagesize, "w288h432-div2_w288h144") || !strcmp(pd->pagesize, "w324h432-div2_w324h144")) {
9736 cut1 = 30;
9737 cut2 = 30;
9738 cut3 = 20;
9739 }
9740
9741 /* Cutter control */
9742 if (cut1) {
9743 stp_zprintf(v, "\033PCNTRL FULL_CUTTER_SET 00000016");
9744 stp_zprintf(v, "%03d%03d%03d%03d%03d\r", cut1, cut2, cut3, cut4, trim);
9745 } else {
9746 stp_zprintf(v, "\033PCNTRL CUTTER 00000008%08d", pd->privdata.dnp.nocutwaste ? 1 : 0);
9747 }
9748
9749 /* Configure multi-cut/page size */
9750 if (!strcmp(pd->pagesize, "w288h288") || !strcmp(pd->pagesize, "w288h288-div2")) {
9751 multicut = 47;
9752 } else if (!strcmp(pd->pagesize, "w288h432") || !strcmp(pd->pagesize, "w288h216") || !strcmp(pd->pagesize, "w288h432-div2") || !strcmp(pd->pagesize, "w288h432-div3")) {
9753 multicut = 48;
9754 } else if (!strcmp(pd->pagesize, "w288h576") || !strcmp(pd->pagesize, "w288h576-div2") || !strcmp(pd->pagesize, "w288h576-div4") || !strcmp(pd->pagesize, "w288h432_w288h144") || !strcmp(pd->pagesize, "w288h432-div2_w288h144") ) {
9755 multicut = 49;
9756 } else if (!strcmp(pd->pagesize, "w324h324")) {
9757 multicut = 50;
9758 } else if (!strcmp(pd->pagesize, "w324h432") || !strcmp(pd->pagesize, "w324h216") || !strcmp(pd->pagesize, "w324h288") || !strcmp(pd->pagesize, "w324h432-div2") || !strcmp(pd->pagesize, "w324h432-div3")) {
9759 multicut = 51;
9760 } else if (!strcmp(pd->pagesize, "w324h576") || !strcmp(pd->pagesize, "w324h576-div2") || !strcmp(pd->pagesize, "w324h576-div4") || !strcmp(pd->pagesize, "w324h432_w324h144") || !strcmp(pd->pagesize, "w324h432-div2_w324h144")) {
9761 multicut = 52;
9762 }
9763
9764 stp_zprintf(v, "\033PIMAGE MULTICUT 00000008000000%02d", multicut);
9765
9766 if (!strcmp(pd->privdata.dnp.print_speed, "LowSpeed")) {
9767 stp_zprintf(v, "\033PCNTRL PRINTSPEED 0000000800000020");
9768 }
9769
9770 stp_zprintf(v, "\033PCNTRL DECURL 00000012%02d00000000%02d", pd->privdata.dnp.decurl, pd->privdata.dnp.decurl);
9771
9772 }
9773
9774 static const dyesub_stringitem_t dnp_qw410_print_speeds[] =
9775 {
9776 { "Normal", N_ ("Normal") },
9777 { "LowSpeed", N_ ("Low Speed") }
9778 };
9779 LIST(dyesub_stringlist_t, dnp_qw410_printspeeds_list, dyesub_stringitem_t, dnp_qw410_print_speeds);
9780
9781 static const stp_parameter_t qw410_parameters[] =
9782 {
9783 {
9784 "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
9785 N_("Print Speed"),
9786 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
9787 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
9788 },
9789 {
9790 "NoCutWaste", N_("No Cut-Paper Waste"), "Color=No,Category=Advanced Printer Setup",
9791 N_("No Cut-Paper Waste"),
9792 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
9793 STP_PARAMETER_LEVEL_ADVANCED, 1, 0, STP_CHANNEL_NONE, 1, 0
9794 },
9795 {
9796 "DeCurl", N_("De-Curl Control"), "Color=No,Category=Advanced Printer Setup",
9797 N_("De-Curl Control"),
9798 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
9799 STP_PARAMETER_LEVEL_ADVANCED, 1, 0, STP_CHANNEL_NONE, 1, 0
9800 },
9801 };
9802 #define qw410_parameter_count (sizeof(qw410_parameters) / sizeof(const stp_parameter_t))
9803
9804 static int
9805 qw410_load_parameters(const stp_vars_t *v, const char *name,
9806 stp_parameter_t *description)
9807 {
9808 unsigned int i;
9809 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
9810 stp_get_model_id(v));
9811
9812 if (caps->parameter_count && caps->parameters)
9813 {
9814 for (i = 0; i < caps->parameter_count; i++)
9815 if (strcmp(name, caps->parameters[i].name) == 0)
9816 {
9817 stp_fill_parameter_settings(description, &(caps->parameters[i]));
9818 break;
9819 }
9820 }
9821
9822 if (strcmp(name, "PrintSpeed") == 0)
9823 {
9824 description->bounds.str = stp_string_list_create();
9825
9826 const dyesub_stringlist_t *mlist = &dnp_qw410_printspeeds_list;
9827 for (i = 0; i < mlist->n_items; i++)
9828 {
9829 const dyesub_stringitem_t *m = &(mlist->item[i]);
9830 stp_string_list_add_string(description->bounds.str,
9831 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
9832 }
9833 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
9834 description->is_active = 1;
9835 }
9836 else if (strcmp(name, "NoCutWaste") == 0)
9837 {
9838 description->is_active = 1;
9839 description->deflt.boolean = 0;
9840 }
9841 else if (strcmp(name, "DeCurl") == 0)
9842 {
9843 description->is_active = 1;
9844 description->deflt.boolean = 1;
9845 }
9846 else
9847 {
9848 return 0;
9849 }
9850 return 1;
9851 }
9852
9853 static int qw410_parse_parameters(stp_vars_t *v)
9854 {
9855 dyesub_privdata_t *pd = get_privdata(v);
9856 const char *print_speed = stp_get_string_parameter(v, "PrintSpeed");
9857 int nocutwaste = stp_get_boolean_parameter(v, "NoCutWaste");
9858 int decurl = stp_get_boolean_parameter(v, "DeCurl");
9859
9860 if (pd) {
9861 pd->privdata.dnp.print_speed = print_speed;
9862 pd->privdata.dnp.nocutwaste = nocutwaste;
9863 pd->privdata.dnp.decurl = decurl;
9864 }
9865
9866 return 1;
9867 }
9868
9869 /* Citizen CW-01 */
9870 static const dyesub_resolution_t res_citizen_cw01_dpi[] =
9871 {
9872 { "334x334", 334, 334},
9873 { "334x600", 334, 600},
9874 };
9875
9876 LIST(dyesub_resolution_list_t, res_citizen_cw01_dpi_list, dyesub_resolution_t,res_citizen_cw01_dpi);
9877
9878 static const dyesub_pagesize_t citizen_cw01_page[] =
9879 {
9880 DEFINE_PAPER( "w252h338", "3.5x4.7", PT(1210,334), PT(2048,334), 0, 0, PT(225,334), PT(225,334), DYESUB_LANDSCAPE),
9881 DEFINE_PAPER( "B7", "3.5x5", PT(1210,334), PT(2048,334), 0, 0, PT(169,334), PT(169,334), DYESUB_LANDSCAPE),
9882 DEFINE_PAPER( "w288h432", "4x6", PT(1380,334), PT(2048,334), 0, 0, PT(5,334), PT(5,334), DYESUB_LANDSCAPE),
9883 DEFINE_PAPER( "w338h504", "4.7x7", PT(2048,334), PT(2380,334), PT(225,334), PT(225,334), 0, 0, DYESUB_PORTRAIT),
9884 DEFINE_PAPER( "w360h504", "5x7", PT(2048,334), PT(2380,334), PT(169,334), PT(169,334), 0, 0, DYESUB_PORTRAIT),
9885 DEFINE_PAPER( "w432h576", "6x8", PT(2048,334), PT(2710,300), PT(5,334), PT(5,334), 0, 0, DYESUB_PORTRAIT),
9886 DEFINE_PAPER( "w432h648", "6x9", PT(2048,334), PT(3050,334), PT(5,334), PT(5,334), 0, 0, DYESUB_PORTRAIT),
9887 };
9888
9889 LIST(dyesub_pagesize_list_t, citizen_cw01_page_list, dyesub_pagesize_t, citizen_cw01_page);
9890
9891 static const dyesub_printsize_t citizen_cw01_printsize[] =
9892 {
9893 { "334x334", "w252h338", 1210, 2048},
9894 { "334x600", "w252h338", 2176, 2048},
9895 { "334x334", "B7", 1210, 2048},
9896 { "334x600", "B7", 2176, 2048},
9897 { "334x334", "w288h432", 1380, 2048},
9898 { "334x600", "w288h432", 2480, 2048},
9899 { "334x334", "w338h504", 2048, 2380},
9900 { "334x600", "w338h504", 2048, 4276},
9901 { "334x334", "w360h504", 2048, 2380},
9902 { "334x600", "w360h504", 2048, 4276},
9903 { "334x334", "w432h576", 2048, 2710},
9904 { "334x600", "w432h576", 2048, 4870},
9905 { "334x334", "w432h648", 2048, 3050},
9906 { "334x600", "w432h648", 2048, 5480},
9907 };
9908
9909 LIST(dyesub_printsize_list_t, citizen_cw01_printsize_list, dyesub_printsize_t, citizen_cw01_printsize);
9910
9911 static void citizen_cw01_printer_start(stp_vars_t *v)
9912 {
9913 dyesub_privdata_t *pd = get_privdata(v);
9914 /* Set quantity.. Backend overrides as needed. */
9915 stp_zprintf(v, "\033PCNTRL QTY 00000008%07d\r", pd->copies);
9916 /* Set cutter, nothing fancy */
9917 stp_zprintf(v, "\033PCNTRL CUTTER 0000000800000000");
9918
9919 /* CW-01 has no other smarts. No multicut, no matte. */
9920 }
9921
9922 /* HiTi P520L */
9923 static const dyesub_pagesize_t hiti_p520l_page[] =
9924 {
9925 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1072,300), PT(1548,300), DYESUB_LANDSCAPE),
9926 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1240,300), PT(1844,300), DYESUB_LANDSCAPE),
9927 DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT(1248,300), PT(1844,300), DYESUB_LANDSCAPE),
9928 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1548,300), PT(2140,300), DYESUB_PORTRAIT),
9929 DEFINE_PAPER( "w360h504-div2", "3.5x5*2", PT(1548,300), PT1(2140,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
9930 DEFINE_PAPER_SIMPLE( "w360h432", "6x5", PT(1588,300), PT(1844,300), DYESUB_LANDSCAPE),
9931 DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT(1844,300), PT(1844,300), DYESUB_PORTRAIT),
9932 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1844,300), PT(2434,300), DYESUB_PORTRAIT),
9933 DEFINE_PAPER( "w432h576-div2", "4x6*2", PT(1844,300), PT1(2434,300), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
9934 DEFINE_PAPER( "w432h576-div4", "2x6*4", PT(1844,300), PT2(2434,300), 0, 0, 0, PT2(0,300), DYESUB_PORTRAIT),
9935 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1844,300), PT(2740,300), DYESUB_PORTRAIT),
9936 };
9937
9938 LIST(dyesub_pagesize_list_t, hiti_p520l_page_list, dyesub_pagesize_t, hiti_p520l_page);
9939
9940 static const dyesub_printsize_t hiti_p520l_printsize[] =
9941 {
9942 { "300x300", "B7", 1072, 1548},
9943 { "300x300", "w288h432", 1240, 1844},
9944 { "300x300", "w288h432-div2", 1248, 1844},
9945 { "300x300", "w360h504", 1548, 2140},
9946 { "300x300", "w360h504-div2", 1548, 2152},
9947 { "300x300", "w360h432", 1588, 1844},
9948 { "300x300", "w432h432", 1844, 1844},
9949 { "300x300", "w432h576", 1844, 2434},
9950 { "300x300", "w432h576-div2", 1844, 2492},
9951 { "300x300", "w432h576-div4", 1844, 2492},
9952 { "300x300", "w432h648", 1844, 2740},
9953 };
9954
9955 LIST(dyesub_printsize_list_t, hiti_p520l_printsize_list, dyesub_printsize_t, hiti_p520l_printsize);
9956
9957 static const overcoat_t hiti_p520l_overcoat[] =
9958 {
9959 {"Glossy", N_("Glossy"), {4, "\x00\x00\x00\x00"}},
9960 {"Matte", N_("Matte"), {4, "\x01\x00\x00\x00"}},
9961 };
9962
9963 LIST(overcoat_list_t, hiti_p520l_overcoat_list, overcoat_t, hiti_p520l_overcoat);
9964
9965 static void hiti_printer_start(stp_vars_t *v, int model)
9966 {
9967 dyesub_privdata_t *pd = get_privdata(v);
9968
9969 int pgcode;
9970 int flags = 0;
9971
9972 if (!pd->privdata.hiti.use_lut)
9973 flags |= 0x02;
9974 if (pd->privdata.hiti.mediaver) {
9975 flags |= 0x04;
9976 flags |= (pd->privdata.hiti.mediaver << 24);
9977 }
9978 if (pd->privdata.hiti.mediatype) {
9979 flags |= 0x08;
9980 flags |= (pd->privdata.hiti.mediatype << 24);
9981 }
9982
9983 if (!strcmp(pd->pagesize, "B7"))
9984 pgcode = 8;
9985 else if (!strcmp(pd->pagesize, "w288h432"))
9986 pgcode = 0;
9987 else if (!strcmp(pd->pagesize, "w288h432-div2"))
9988 pgcode = 9;
9989 else if (!strcmp(pd->pagesize, "w360h504"))
9990 pgcode = 2;
9991 else if (!strcmp(pd->pagesize, "w360h504-div2"))
9992 pgcode = 11;
9993 else if (!strcmp(pd->pagesize, "w360h432"))
9994 pgcode = 20;
9995 else if (!strcmp(pd->pagesize, "w432h432"))
9996 pgcode = 21;
9997 else if (!strcmp(pd->pagesize, "w432h576"))
9998 pgcode = 3;
9999 else if (!strcmp(pd->pagesize, "w432h576-div2"))
10000 pgcode = 7;
10001 else if (!strcmp(pd->pagesize, "w432h576-div4"))
10002 pgcode = 17;
10003 else if (!strcmp(pd->pagesize, "w432h648"))
10004 pgcode = 6;
10005 else
10006 pgcode = -1;
10007
10008 stp_put32_le(0x54485047, v);
10009 stp_put32_le(13 * 4, v);
10010 stp_put32_le(model, v);
10011 stp_put32_le(pd->w_size, v);
10012 stp_put32_le(pd->h_size, v);
10013 stp_put32_le(pd->w_dpi, v);
10014 stp_put32_le(pd->h_dpi, v);
10015 stp_put32_le(pd->copies, v);
10016 stp_put32_le(pd->privdata.hiti.quality, v);
10017 stp_put32_le(pgcode, v);
10018 stp_zfwrite((pd->overcoat->seq).data, 1,
10019 (pd->overcoat->seq).bytes, v);
10020
10021 stp_put32_le(flags, v); /* ie BGR packed */
10022 stp_put32_le(pd->w_size * pd->h_size * 3, v);
10023 }
10024
10025 static void hiti_p520l_printer_start(stp_vars_t *v)
10026 {
10027 hiti_printer_start(v, 520);
10028 }
10029
10030 static const dyesub_stringitem_t hiti_520l_media_types[] =
10031 {
10032 { "Standard", N_ ("Standard") },
10033 { "Metallic", N_ ("Metallic") },
10034 { "HighDensity", N_ ("High Density") },
10035 { "Transparent", N_ ("Transparent") }
10036 };
10037 LIST(dyesub_stringlist_t, hiti_520l_media_types_list, dyesub_stringitem_t, hiti_520l_media_types);
10038
10039 static const stp_parameter_t hiti_p520l_parameters[] =
10040 {
10041 {
10042 "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
10043 N_("Use Internal Color Correction"),
10044 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
10045 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
10046 },
10047 {
10048 "MediaType", N_("Media Type"), "Color=No,Category=Advanced Printer Setup",
10049 N_("Media Type"),
10050 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
10051 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
10052 },
10053 };
10054 #define hiti_p520l_parameter_count (sizeof(hiti_p520l_parameters) / sizeof(const stp_parameter_t))
10055
10056 static int
10057 hiti_p520l_load_parameters(const stp_vars_t *v, const char *name,
10058 stp_parameter_t *description)
10059 {
10060 unsigned int i;
10061 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
10062 stp_get_model_id(v));
10063
10064 if (caps->parameter_count && caps->parameters)
10065 {
10066 for (i = 0; i < caps->parameter_count; i++)
10067 if (strcmp(name, caps->parameters[i].name) == 0)
10068 {
10069 stp_fill_parameter_settings(description, &(caps->parameters[i]));
10070 break;
10071 }
10072 }
10073
10074 if (strcmp(name, "UseLUT") == 0)
10075 {
10076 description->deflt.boolean = 1;
10077 description->is_active = 1;
10078 }
10079 else if (strcmp(name, "MediaType") == 0)
10080 {
10081 description->bounds.str = stp_string_list_create();
10082
10083 const dyesub_stringlist_t *mlist = &hiti_520l_media_types_list;
10084 for (i = 0; i < mlist->n_items; i++)
10085 {
10086 const dyesub_stringitem_t *m = &(mlist->item[i]);
10087 stp_string_list_add_string(description->bounds.str,
10088 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
10089 }
10090 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
10091 description->is_active = 1;
10092 }
10093 else
10094 {
10095 return 0;
10096 }
10097 return 1;
10098 }
10099
10100 static int hiti_p520l_parse_parameters(stp_vars_t *v)
10101 {
10102 dyesub_privdata_t *pd = get_privdata(v);
10103 const char *media = stp_get_string_parameter(v, "MediaType");
10104
10105 /* No need to set global params if there's no privdata yet */
10106 if (!pd)
10107 return 1;
10108
10109 if (strcmp(media, "Standard") == 0) {
10110 pd->privdata.hiti.mediatype = 0;
10111 } else if (strcmp(media, "Metallic") == 0) {
10112 pd->privdata.hiti.mediatype = 5;
10113 } else if (strcmp(media, "HighDensity") == 0) {
10114 pd->privdata.hiti.mediatype = 6;
10115 } else if (strcmp(media, "Transparent") == 0) {
10116 pd->privdata.hiti.mediatype = 7;
10117 }
10118
10119 pd->privdata.hiti.use_lut = stp_get_boolean_parameter(v, "UseLUT");
10120
10121 return 1;
10122 }
10123
10124 /* HiTi P720L/P750L */
10125 static void hiti_p720l_printer_start(stp_vars_t *v)
10126 {
10127 hiti_printer_start(v, 720);
10128 }
10129
10130 static const stp_parameter_t hiti_p720l_parameters[] =
10131 {
10132 {
10133 "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
10134 N_("Use Internal Color Correction"),
10135 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
10136 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
10137 },
10138 {
10139 "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
10140 N_("Print Speed"),
10141 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
10142 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
10143 },
10144 };
10145 #define hiti_p720l_parameter_count (sizeof(hiti_p720l_parameters) / sizeof(const stp_parameter_t))
10146
10147 static const dyesub_stringitem_t hiti_p720l_qualities[] =
10148 {
10149 { "Standard", N_ ("Standard") },
10150 { "Fine", N_ ("Fine") },
10151 };
10152
10153 LIST(dyesub_stringlist_t, hiti_p720l_quality_list, dyesub_stringitem_t, hiti_p720l_qualities);
10154
10155
10156 static int
10157 hiti_p720l_load_parameters(const stp_vars_t *v, const char *name,
10158 stp_parameter_t *description)
10159 {
10160 unsigned int i;
10161 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
10162 stp_get_model_id(v));
10163
10164 if (caps->parameter_count && caps->parameters)
10165 {
10166 for (i = 0; i < caps->parameter_count; i++)
10167 if (strcmp(name, caps->parameters[i].name) == 0)
10168 {
10169 stp_fill_parameter_settings(description, &(caps->parameters[i]));
10170 break;
10171 }
10172 }
10173
10174 if (strcmp(name, "UseLUT") == 0)
10175 {
10176 description->deflt.boolean = 1;
10177 description->is_active = 1;
10178 }
10179 else if (strcmp(name, "PrintSpeed") == 0)
10180 {
10181 description->bounds.str = stp_string_list_create();
10182
10183 const dyesub_stringlist_t *mlist = &hiti_p720l_quality_list;
10184 for (i = 0; i < mlist->n_items; i++)
10185 {
10186 const dyesub_stringitem_t *m = &(mlist->item[i]);
10187 stp_string_list_add_string(description->bounds.str,
10188 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
10189 }
10190 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
10191 description->is_active = 1;
10192 }
10193 else
10194 {
10195 return 0;
10196 }
10197 return 1;
10198 }
10199
10200 static int hiti_p720l_parse_parameters(stp_vars_t *v)
10201 {
10202 dyesub_privdata_t *pd = get_privdata(v);
10203 const char *quality = stp_get_string_parameter(v, "PrintSpeed");
10204
10205 /* No need to set global params if there's no privdata yet */
10206 if (!pd)
10207 return 1;
10208
10209 /* Parse options */
10210 if (strcmp(quality, "Fine") == 0) {
10211 pd->privdata.hiti.quality = 1;
10212 } else {
10213 pd->privdata.hiti.quality = 0;
10214 }
10215
10216 pd->privdata.hiti.use_lut = stp_get_boolean_parameter(v, "UseLUT");
10217
10218 return 1;
10219 }
10220
10221 /* HiTi P51x series */
10222 static const dyesub_pagesize_t hiti_p510l_page[] =
10223 {
10224 DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT(1072,301), PT(1548,301), DYESUB_LANDSCAPE),
10225 DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT(1240,301), PT(1844,301), DYESUB_LANDSCAPE),
10226 DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1248,301), PT(1844,301), 0, PT1(0,300), 0, 0, DYESUB_LANDSCAPE),
10227 DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT(1548,301), PT(2140,301), DYESUB_PORTRAIT),
10228 DEFINE_PAPER( "w360h504-div2", "3.5x5*2", PT(1548,301), PT1(2140,301), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
10229 DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT(1844,301), PT(2434,301), DYESUB_PORTRAIT),
10230 DEFINE_PAPER( "w432h576-div2", "4x6*2", PT(1844,301), PT1(2434,301), 0, 0, 0, PT1(0,300), DYESUB_PORTRAIT),
10231 DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT(1844,301), PT(2740,301), DYESUB_PORTRAIT),
10232 };
10233
10234 LIST(dyesub_pagesize_list_t, hiti_p510l_page_list, dyesub_pagesize_t, hiti_p510l_page);
10235
10236 static const dyesub_printsize_t hiti_p510l_printsize[] =
10237 {
10238 { "301x301", "B7", 1072, 1548},
10239 { "301x301", "w288h432", 1240, 1844},
10240 { "301x301", "w288h432-div2", 1248, 1844},
10241 { "301x301", "w360h504", 1548, 2140},
10242 { "301x301", "w360h504-div2", 1548, 2152},
10243 { "301x301", "w432h576", 1844, 2434},
10244 { "301x301", "w432h576-div2", 1844, 2492},
10245 { "301x301", "w432h648", 1844, 2740},
10246 };
10247
10248 LIST(dyesub_printsize_list_t, hiti_p510l_printsize_list, dyesub_printsize_t, hiti_p510l_printsize);
10249
10250 static void hiti_p510l_printer_start(stp_vars_t *v)
10251 {
10252 hiti_printer_start(v, 510);
10253 }
10254
10255 /* HiTi P461 series */
10256 static const dyesub_pagesize_t hiti_p461_page[] =
10257 {
10258 DEFINE_PAPER( "w288h432", "4x6", PT(1280,300), PT(1818,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
10259 };
10260
10261 LIST(dyesub_pagesize_list_t, hiti_p461_page_list, dyesub_pagesize_t, hiti_p461_page);
10262
10263 static const dyesub_printsize_t hiti_p461_printsize[] =
10264 {
10265 { "300x300", "w288h432", 1280, 1818},
10266 };
10267
10268 LIST(dyesub_printsize_list_t, hiti_p461_printsize_list, dyesub_printsize_t, hiti_p461_printsize);
10269
10270 static void hiti_p461_printer_start(stp_vars_t *v)
10271 {
10272 hiti_printer_start(v, 461);
10273 }
10274
10275 static const stp_parameter_t hiti_p461_parameters[] =
10276 {
10277 {
10278 "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
10279 N_("Use Internal Color Correction"),
10280 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
10281 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
10282 },
10283 {
10284 "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
10285 N_("Print Speed"),
10286 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
10287 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
10288 },
10289 {
10290 "MediaVer", N_("Media Version"), "Color=No,Category=Advanced Printer Setup",
10291 N_("Printer media version"),
10292 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
10293 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
10294 },
10295
10296 };
10297 #define hiti_p461_parameter_count (sizeof(hiti_p461_parameters) / sizeof(const stp_parameter_t))
10298
10299 static const dyesub_stringitem_t hiti_p461_qualities[] =
10300 {
10301 { "Standard", N_ ("Standard") },
10302 { "Fine", N_ ("Fine") },
10303 };
10304
10305 LIST(dyesub_stringlist_t, hiti_p461_quality_list, dyesub_stringitem_t, hiti_p461_qualities);
10306
10307
10308 static int
10309 hiti_p461_load_parameters(const stp_vars_t *v, const char *name,
10310 stp_parameter_t *description)
10311 {
10312 unsigned int i;
10313 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
10314 stp_get_model_id(v));
10315
10316 if (caps->parameter_count && caps->parameters)
10317 {
10318 for (i = 0; i < caps->parameter_count; i++)
10319 if (strcmp(name, caps->parameters[i].name) == 0)
10320 {
10321 stp_fill_parameter_settings(description, &(caps->parameters[i]));
10322 break;
10323 }
10324 }
10325
10326 if (strcmp(name, "UseLUT") == 0)
10327 {
10328 description->deflt.boolean = 1;
10329 description->is_active = 1;
10330 }
10331 else if (strcmp(name, "PrintSpeed") == 0)
10332 {
10333 description->bounds.str = stp_string_list_create();
10334
10335 const dyesub_stringlist_t *mlist = &hiti_p461_quality_list;
10336 for (i = 0; i < mlist->n_items; i++)
10337 {
10338 const dyesub_stringitem_t *m = &(mlist->item[i]);
10339 stp_string_list_add_string(description->bounds.str,
10340 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
10341 }
10342 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
10343 description->is_active = 1;
10344 }
10345 else if (strcmp(name, "MediaVer") == 0)
10346 {
10347 description->deflt.integer = 0;
10348 description->bounds.integer.lower = 0;
10349 description->bounds.integer.upper = 4;
10350 description->is_active = 1;
10351 }
10352 else
10353 {
10354 return 0;
10355 }
10356 return 1;
10357 }
10358
10359 static int hiti_p461_parse_parameters(stp_vars_t *v)
10360 {
10361 dyesub_privdata_t *pd = get_privdata(v);
10362 const char *quality = stp_get_string_parameter(v, "PrintSpeed");
10363
10364 /* No need to set global params if there's no privdata yet */
10365 if (!pd)
10366 return 1;
10367
10368 /* Parse options */
10369 if (strcmp(quality, "Fine") == 0) {
10370 pd->privdata.hiti.quality = 1;
10371 } else {
10372 pd->privdata.hiti.quality = 0;
10373 }
10374
10375 pd->privdata.hiti.use_lut = stp_get_boolean_parameter(v, "UseLUT");
10376 pd->privdata.hiti.mediaver = stp_get_int_parameter(v, "MediaVer");
10377
10378 return 1;
10379 }
10380
10381 /* HiTi P630 series */
10382 static void hiti_p630_printer_start(stp_vars_t *v)
10383 {
10384 hiti_printer_start(v, 630);
10385 }
10386
10387 /* Magicard Series */
10388 static const dyesub_pagesize_t magicard_page[] =
10389 {
10390 DEFINE_PAPER( "w155h244", "ID-1/CR80", PT(672,300), PT(1016,300), PT(15, 300), PT(15,300), 0, 0, DYESUB_PORTRAIT),
10391 };
10392
10393 LIST(dyesub_pagesize_list_t, magicard_page_list, dyesub_pagesize_t, magicard_page);
10394
10395 static const dyesub_printsize_t magicard_printsize[] =
10396 {
10397 { "300x300", "w155h244", 672, 1016},
10398 };
10399
10400 LIST(dyesub_printsize_list_t, magicard_printsize_list, dyesub_printsize_t, magicard_printsize);
10401
10402 static const overcoat_t magicard_overcoat[] =
10403 {
10404 {"Off", N_("Off"), {3, "OFF"}},
10405 {"On", N_("On"), {2, "ON"}},
10406 };
10407
10408 LIST(overcoat_list_t, magicard_overcoat_list, overcoat_t, magicard_overcoat);
10409
10410 static void magicard_printer_init(stp_vars_t *v)
10411 {
10412 dyesub_privdata_t *pd = get_privdata(v);
10413
10414 dyesub_nputc(v, 0x05, 64); /* ATTN/Clear */
10415 stp_putc(0x01, v); /* Start command sequence */
10416 stp_zprintf(v, ",NOC1");
10417 stp_zprintf(v, ",VER%d.%d.%d", STP_MAJOR_VERSION, STP_MINOR_VERSION, STP_MICRO_VERSION); // XXX include "pre" or other tag.
10418 stp_zprintf(v, ",LANENG"); // Dunno about other options.
10419 stp_zprintf(v, ",TDT%08X", (unsigned int)stpi_time(NULL)); /* Some sort of timestamp. Unknown epoch. */
10420 // stp_zprintf(v, ",LC%d", 1); // Force media type. LC1/LC3/LC6/LC8 for YMCKO/MONO/KO/YMCKOK
10421 stp_zprintf(v, ",REJ%s", pd->privdata.magicard.reject ? "ON" : "OFF"); /* Faulty card rejection. */
10422 stp_zprintf(v, ",ESS%d", pd->copies); /* Number of copies */
10423 stp_zprintf(v, ",KEE,RT2");
10424 if (pd->duplex_mode &&
10425 strcmp(pd->duplex_mode, "None") &&
10426 strcmp(pd->duplex_mode, "Standard")) /* Duplex enabled? */
10427 {
10428 stp_zprintf(v, ",DPXON,PAG%d", 1 + (pd->page_number & 1));
10429 if (!(pd->page_number & 1))
10430 {
10431 /* Color format of BACk side -- eg CKO or KO or C or CO or K. We don't support K/KO-only! */
10432 stp_zprintf(v, ",BAC%s%s",
10433 pd->privdata.magicard.resin_k ? "CK" : "C",
10434 pd->privdata.magicard.overcoat ? "O" : "");
10435 }
10436 }
10437 else
10438 {
10439 stp_zprintf(v, ",DPXOFF,PAG1");
10440 }
10441 stp_zprintf(v, ",SLW%s", pd->privdata.magicard.colorsure ? "ON" : "OFF"); /* "Colorsure printing" */
10442 stp_zprintf(v, ",IMF%s", "BGR"); /* Image format -- as opposed to K, BGRK and others. */
10443 stp_zprintf(v, ",XCO0,YCO0"); // ??
10444 stp_zprintf(v, ",WID%u,HGT%u", (unsigned int)pd->h_size, (unsigned int)pd->w_size - 30); /* Width & Height */
10445
10446 /* Overcoat options are unique per-side */
10447 if (!(pd->page_number & 1))
10448 {
10449 stp_zprintf(v, ",OVR%s", pd->privdata.magicard.overcoat ? "ON" : "OFF" );
10450 if (pd->privdata.magicard.overcoat && pd->privdata.magicard.overcoat_hole)
10451 {
10452 if (!strcmp("SmartCard", pd->privdata.magicard.overcoat_hole))
10453 stp_zprintf(v, ",NCT%d,%d,%d,%d", 90, 295, 260, 450);
10454 else if (!strcmp("SmartCardLarge", pd->privdata.magicard.overcoat_hole))
10455 stp_zprintf(v, ",NCT%d,%d,%d,%d", 75, 275, 280, 470);
10456 else if (!strcmp("MagStripe", pd->privdata.magicard.overcoat_hole))
10457 stp_zprintf(v, ",NCT%d,%d,%d,%d", 0, 420, 1025, 590);
10458 else if (!strcmp("MagStripeLarge", pd->privdata.magicard.overcoat_hole))
10459 stp_zprintf(v, ",NCT%d,%d,%d,%d", 0, 400, 1025, 610);
10460 /* XXX TODO: Add ability to specify custom hole sizes */
10461 }
10462 } else {
10463 stp_zprintf(v, ",OVR%s", pd->privdata.magicard.overcoat_dpx ? "ON" : "OFF" );
10464 if (pd->privdata.magicard.overcoat_dpx && pd->privdata.magicard.overcoat_hole_dpx)
10465 {
10466 if (!strcmp("SmartCard", pd->privdata.magicard.overcoat_hole_dpx))
10467 stp_zprintf(v, ",NCT%d,%d,%d,%d", 90, 295, 260, 450);
10468 else if (!strcmp("SmartCardLarge", pd->privdata.magicard.overcoat_hole_dpx))
10469 stp_zprintf(v, ",NCT%d,%d,%d,%d", 75, 275, 280, 470);
10470 else if (!strcmp("MagStripe", pd->privdata.magicard.overcoat_hole_dpx))
10471 stp_zprintf(v, ",NCT%d,%d,%d,%d", 0, 420, 1025, 590);
10472 else if (!strcmp("MagStripeLarge", pd->privdata.magicard.overcoat_hole_dpx))
10473 stp_zprintf(v, ",NCT%d,%d,%d,%d", 0, 400, 1025, 610);
10474 /* XXX TODO: Add ability to specify custom hole sizes */
10475 }
10476 }
10477 stp_zprintf(v, ",NNNOFF"); // ??
10478 if (!(pd->page_number & 1))
10479 {
10480 stp_zprintf(v, ",USF%s", pd->privdata.magicard.holokote ? "ON" : "OFF"); /* Disable Holokote. */
10481 if (pd->privdata.magicard.holokote)
10482 {
10483 stp_zprintf(v, ",HKT%d", pd->privdata.magicard.holokote);
10484 stp_zprintf(v, ",CKI%s", pd->privdata.magicard.holokote_custom? "ON" : "OFF");
10485 stp_zprintf(v, ",HKMFFFFFF,TRO0"); // HKM == area. each bit is a separate area, 1-24. Not sure about TRO
10486 }
10487
10488 if (pd->privdata.magicard.holopatch)
10489 {
10490 stp_zprintf(v, ",HPHON,PAT%d", pd->privdata.magicard.holopatch);
10491 }
10492 } else {
10493 stp_zprintf(v, ",USFOFF"); /* Disable Holokote on duplex side. */
10494 }
10495
10496 /* Magnetic stripe. Only program on the FRONT side. */
10497 if (!(pd->page_number & 1))
10498 {
10499 if (pd->privdata.magicard.mag1[0]) {
10500 stp_zprintf(v, ",MAG1,BPI210,MPC7,COE%c,%s",
10501 pd->privdata.magicard.mag_coer ? 'H': 'L',
10502 pd->privdata.magicard.mag1);
10503 }
10504 if (pd->privdata.magicard.mag2[0]) {
10505 stp_zprintf(v, ",MAG2,BPI75,MPC5,COE%c,%s",
10506 pd->privdata.magicard.mag_coer ? 'H': 'L',
10507 pd->privdata.magicard.mag2);
10508 }
10509 if (pd->privdata.magicard.mag3[0]) {
10510 stp_zprintf(v, ",MAG3,BPI210,MPC7,COE%c,%s",
10511 pd->privdata.magicard.mag_coer ? 'H': 'L',
10512 pd->privdata.magicard.mag3);
10513 }
10514 }
10515
10516 stp_zprintf(v, ",PCT%d,%d,%d,%d", 0, 0, 1025, 641); // print area? (seen 1025/1015/999,641)
10517 stp_zprintf(v, ",ICC%d", pd->privdata.magicard.gamma); /* Gamma curve. 0-2 */
10518 if (pd->privdata.magicard.power_color != 50)
10519 stp_zprintf(v, ",CPW%d", pd->privdata.magicard.power_color); /* RGB/Color power. 0-100 */
10520 if (pd->privdata.magicard.power_overcoat != 50)
10521 stp_zprintf(v, ",OPW%d", pd->privdata.magicard.power_overcoat); /* Overcoat power. 0-100 */
10522 if (pd->privdata.magicard.power_resin != 50)
10523 stp_zprintf(v, ",KPW%d", pd->privdata.magicard.power_resin); /* Black/Resin power. 0-100 */
10524 if (pd->privdata.magicard.align_start != 50)
10525 stp_zprintf(v, ",SOI%d", pd->privdata.magicard.align_start); /* Card Start alignment, 0-100 */
10526 if (pd->privdata.magicard.align_end != 50)
10527 stp_zprintf(v, ",EOI%d", pd->privdata.magicard.align_end); /* Card End alignment, 0-100 */
10528 stp_zprintf(v, ",DDD50"); // ??
10529 stp_zprintf(v, ",X-GP-8"); /* GP extension, tells backend data is 8bpp */
10530 if (pd->privdata.magicard.resin_k)
10531 stp_zprintf(v, ",X-GP-RK"); /* GP extension, tells backend to extract resin-K layer */
10532 stp_zprintf(v, ",SZB%d", (int)(pd->w_size * pd->h_size)); /* 8bpp, needs to be 6bpp */
10533 stp_zprintf(v, ",SZG%d", (int)(pd->w_size * pd->h_size));
10534 stp_zprintf(v, ",SZR%d", (int)(pd->w_size * pd->h_size));
10535 // stp_zprintf(v, ",SZK%d", (int)(pd->w_size * pd->h_size)); /* 8bpp, needs to be 1bpp */
10536 stp_putc(0x1c, v); /* Terminate command data */
10537 }
10538
10539 static void magicard_printer_end(stp_vars_t *v)
10540 {
10541 stp_putc(0x03, v); /* Terminate the command sequence */
10542 }
10543
10544 static void magicard_plane_end(stp_vars_t *v)
10545 {
10546 dyesub_privdata_t *pd = get_privdata(v);
10547
10548 stp_putc(0x1c, v); /* Terminate the image data */
10549 switch (pd->plane)
10550 {
10551 case 3:
10552 stp_putc(0x42, v); /* Blue */
10553 break;
10554 case 2:
10555 stp_putc(0x47, v); /* Green */
10556 break;
10557 case 1:
10558 stp_putc(0x52, v); /* Red */
10559 break;
10560 default:
10561 // stp_putc(0x4b, v); /* Black/Resin */
10562 break;
10563 }
10564 stp_putc(0x3a, v);
10565 }
10566
10567 static const dyesub_stringitem_t magicard_black_types[] =
10568 {
10569 { "Composite", N_ ("Composite (CMY)") },
10570 { "Resin", N_ ("Resin Black") },
10571 };
10572 LIST(dyesub_stringlist_t, magicard_black_types_list, dyesub_stringitem_t, magicard_black_types);
10573
10574 static const dyesub_stringitem_t magicard_mag_coer[] =
10575 {
10576 { "Low", N_ ("Low") },
10577 { "High", N_ ("High") },
10578 };
10579 LIST(dyesub_stringlist_t, magicard_mag_coer_list, dyesub_stringitem_t, magicard_mag_coer);
10580
10581 static const stp_parameter_t magicard_parameters[] =
10582 {
10583 {
10584 "BlackType", N_("Black Type"), "Color=No,Category=Advanced Printer Setup",
10585 N_("Black Type"),
10586 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
10587 STP_PARAMETER_LEVEL_BASIC, 1, 0, STP_CHANNEL_NONE, 1, 0
10588 },
10589 {
10590 "RejectBad", N_("Reject Bad Cards"), "Color=No,Category=Advanced Printer Setup",
10591 N_("Reject Bad Cards"),
10592 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
10593 STP_PARAMETER_LEVEL_BASIC, 1, 0, STP_CHANNEL_NONE, 1, 0
10594 },
10595 {
10596 "ColorSure", N_("Enable Colorsure"), "Color=No,Category=Advanced Printer Setup",
10597 N_("Enable Colorsure"),
10598 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
10599 STP_PARAMETER_LEVEL_BASIC, 1, 0, STP_CHANNEL_NONE, 1, 0
10600 },
10601 {
10602 "GammaCurve", N_("Printer Gamma Curve"), "Color=No,Category=Advanced Printer Setup",
10603 N_("Internal Gamma Curve to apply (0 is none)"),
10604 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
10605 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10606 },
10607 {
10608 "PowerColor", N_("Color Power Level"), "Color=No,Category=Advanced Printer Setup",
10609 N_("Power level for color passes"),
10610 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
10611 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10612 },
10613 {
10614 "PowerBlack", N_("Black Power Level"), "Color=No,Category=Advanced Printer Setup",
10615 N_("Power level for black pass"),
10616 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
10617 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10618 },
10619 {
10620 "PowerOC", N_("Overcoat Power Level"), "Color=No,Category=Advanced Printer Setup",
10621 N_("Power level for overcoat pass"),
10622 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
10623 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10624 },
10625 {
10626 "AlignStart", N_("Card Start Alignment"), "Color=No,Category=Advanced Printer Setup",
10627 N_("Fine-tune card start position"),
10628 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
10629 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10630 },
10631 {
10632 "AlignEnd", N_("Card End Alignment"), "Color=No,Category=Advanced Printer Setup",
10633 N_("Fine-tune card end position"),
10634 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
10635 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10636 },
10637 {
10638 "CardOffset", N_("Horizontal Card offset"), "Color=No,Category=Advanced Printer Setup",
10639 N_("Fine-tune card horizontal centering"),
10640 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
10641 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10642 },
10643 {
10644 "Holokote", N_("Holokote"), "Color=No,Category=Advanced Printer Setup",
10645 N_("Holokote option"),
10646 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
10647 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10648 },
10649 {
10650 "HolokoteCustom", N_("Custom Holokote Key"), "Color=No,Category=Advanced Printer Setup",
10651 N_("Use an optional custom Holokote key"),
10652 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
10653 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10654 },
10655 {
10656 "Holopatch", N_("HoloPatch"), "Color=No,Category=Advanced Printer Setup",
10657 N_("Position of the HoloPatch"),
10658 STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
10659 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10660 },
10661 {
10662 "OvercoatHole", N_("Overcoat Hole"), "Color=No,Category=Advanced Printer Setup",
10663 N_("Area to not cover with an overcoat layer"),
10664 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
10665 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10666 },
10667 {
10668 "OvercoatHoleDuplex", N_("Overcoat Hole Duplex"), "Color=No,Category=Advanced Printer Setup",
10669 N_("Area to not cover with an overcoat layer"),
10670 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
10671 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10672 },
10673 { /* Note this is called "LaminateDuplex" rather than "OvercoatDuplex"
10674 to align with the mis-named "Laminate" option.
10675 */
10676 "LaminateDuplex", N_("Overcoat Pattern Duplex"), "Color=No,Category=Advanced Printer Setup",
10677 N_("Overcoat Pattern Duplex"),
10678 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
10679 STP_PARAMETER_LEVEL_ADVANCED, 1, 0, STP_CHANNEL_NONE, 1, 0
10680 },
10681 {
10682 "MagCoer", N_("Magnetic Stripe Coercivity"), "Color=No,Category=Advanced Printer Setup",
10683 N_("Magnetic Stripe Coercivity Type"),
10684 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
10685 STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
10686 },
10687 {
10688 "MagStripe1", N_("Magnetic Stripe Row 1"), "Color=No,Category=Advanced Printer Setup",
10689 N_("ISO 7811 alphanumeric data to be encoded in the first magnetic stripe row (0-79 characters)"),
10690 STP_PARAMETER_TYPE_RAW, STP_PARAMETER_CLASS_FEATURE,
10691 STP_PARAMETER_LEVEL_ADVANCED, 0, 1, STP_CHANNEL_NONE, 1, 0
10692 },
10693 {
10694 "MagStripe2", N_("Magnetic Stripe Row 2"), "Color=No,Category=Advanced Printer Setup",
10695 N_("ISO 7811 alphanumeric data to be encoded in the second magnetic stripe row (0-40 digits)"),
10696 STP_PARAMETER_TYPE_RAW, STP_PARAMETER_CLASS_FEATURE,
10697 STP_PARAMETER_LEVEL_ADVANCED, 0, 1, STP_CHANNEL_NONE, 1, 0
10698 },
10699 {
10700 "MagStripe3", N_("Magnetic Stripe Row 3"), "Color=No,Category=Advanced Printer Setup",
10701 N_("ISO 7811 alphanumeric data to be encoded in the third magnetic stripe row (0-107 digits)"),
10702 STP_PARAMETER_TYPE_RAW, STP_PARAMETER_CLASS_FEATURE,
10703 STP_PARAMETER_LEVEL_ADVANCED, 0, 1, STP_CHANNEL_NONE, 1, 0
10704 },
10705 };
10706 #define magicard_parameter_count (sizeof(magicard_parameters) / sizeof(const stp_parameter_t))
10707
10708 static const dyesub_stringitem_t magicard_holokotes[] =
10709 {
10710 { "Off", N_ ("Off") },
10711 { "UltraSecure", N_ ("Ultra Secure") },
10712 { "Rings", N_ ("Interlocking Rings") },
10713 { "Flex", N_ ("Flex") },
10714 };
10715 LIST(dyesub_stringlist_t, magicard_holokotes_list, dyesub_stringitem_t, magicard_holokotes);
10716
10717 static const dyesub_stringitem_t magicard_overcoat_holes[] =
10718 {
10719 { "None", N_ ("None") },
10720 { "SmartCard", N_ ("Smart Card Chip") },
10721 { "SmartCardLarge", N_ ("Smart Card Chip (Large)") },
10722 { "MagStripe", N_ ("Magnetic Stripe") },
10723 { "MagStripeLarge", N_ ("Magnetic Stripe (Large)") },
10724 };
10725 LIST(dyesub_stringlist_t, magicard_overcoat_holes_list, dyesub_stringitem_t, magicard_overcoat_holes);
10726
10727 static int
10728 magicard_load_parameters(const stp_vars_t *v, const char *name,
10729 stp_parameter_t *description)
10730 {
10731 unsigned int i;
10732 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
10733 stp_get_model_id(v));
10734
10735 if (caps->parameter_count && caps->parameters)
10736 {
10737 for (i = 0; i < caps->parameter_count; i++)
10738 if (strcmp(name, caps->parameters[i].name) == 0)
10739 {
10740 stp_fill_parameter_settings(description, &(caps->parameters[i]));
10741 break;
10742 }
10743 }
10744
10745 if (strcmp(name, "BlackType") == 0)
10746 {
10747 description->bounds.str = stp_string_list_create();
10748
10749 const dyesub_stringlist_t *mlist = &magicard_black_types_list;
10750 for (i = 0; i < mlist->n_items; i++)
10751 {
10752 const dyesub_stringitem_t *m = &(mlist->item[i]);
10753 stp_string_list_add_string(description->bounds.str,
10754 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
10755 }
10756 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
10757 description->is_active = 1;
10758 }
10759 else if (strcmp(name, "RejectBad") == 0)
10760 {
10761 description->deflt.boolean = 0;
10762 description->is_active = 1;
10763 }
10764 else if (strcmp(name, "ColorSure") == 0)
10765 {
10766 description->deflt.boolean = 1;
10767 description->is_active = 1;
10768 }
10769 else if (strcmp(name, "GammaCurve") == 0)
10770 {
10771 description->deflt.integer = 1;
10772 description->bounds.integer.lower = 0;
10773 description->bounds.integer.upper = 2;
10774 description->is_active = 1;
10775 }
10776 else if (strcmp(name, "PowerColor") == 0)
10777 {
10778 description->deflt.integer = 0;
10779 description->bounds.integer.lower = -50;
10780 description->bounds.integer.upper = 50;
10781 description->is_active = 1;
10782 }
10783 else if (strcmp(name, "PowerBlack") == 0)
10784 {
10785 description->deflt.integer = 0;
10786 description->bounds.integer.lower = -50;
10787 description->bounds.integer.upper = 50;
10788 description->is_active = 1;
10789 }
10790 else if (strcmp(name, "PowerOC") == 0)
10791 {
10792 description->deflt.integer = 0;
10793 description->bounds.integer.lower = -50;
10794 description->bounds.integer.upper = 50;
10795 description->is_active = 1;
10796 }
10797 else if (strcmp(name, "AlignStart") == 0)
10798 {
10799 description->deflt.integer = 0;
10800 description->bounds.integer.lower = -50;
10801 description->bounds.integer.upper = 50;
10802 description->is_active = 1;
10803 }
10804 else if (strcmp(name, "AlignEnd") == 0)
10805 {
10806 description->deflt.integer = 0;
10807 description->bounds.integer.lower = -50;
10808 description->bounds.integer.upper = 50;
10809 description->is_active = 1;
10810 }
10811 else if (strcmp(name, "CardOffset") == 0)
10812 {
10813 description->deflt.integer = 0;
10814 description->bounds.integer.lower = -15;
10815 description->bounds.integer.upper = 15;
10816 description->is_active = 1;
10817 }
10818 else if (strcmp(name, "Holokote") == 0)
10819 {
10820 description->bounds.str = stp_string_list_create();
10821
10822 const dyesub_stringlist_t *mlist = &magicard_holokotes_list;
10823 for (i = 0; i < mlist->n_items; i++)
10824 {
10825 const dyesub_stringitem_t *m = &(mlist->item[i]);
10826 stp_string_list_add_string(description->bounds.str,
10827 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
10828 }
10829 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
10830 description->is_active = 1;
10831 }
10832 else if (strcmp(name, "HolokoteCustom") == 0)
10833 {
10834 description->deflt.boolean = 0;
10835 description->is_active = 1;
10836 }
10837 else if (strcmp(name, "Holopatch") == 0)
10838 {
10839 description->deflt.integer = 0;
10840 description->bounds.integer.lower = 0;
10841 description->bounds.integer.upper = 24;
10842 description->is_active = 1;
10843 }
10844 else if (strcmp(name, "OvercoatHole") == 0)
10845 {
10846 description->bounds.str = stp_string_list_create();
10847
10848 const dyesub_stringlist_t *mlist = &magicard_overcoat_holes_list;
10849 for (i = 0; i < mlist->n_items; i++)
10850 {
10851 const dyesub_stringitem_t *m = &(mlist->item[i]);
10852 stp_string_list_add_string(description->bounds.str,
10853 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
10854 }
10855 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
10856 description->is_active = 1;
10857 }
10858 else if (strcmp(name, "OvercoatHoleDuplex") == 0)
10859 {
10860 description->bounds.str = stp_string_list_create();
10861
10862 const dyesub_stringlist_t *mlist = &magicard_overcoat_holes_list;
10863 for (i = 0; i < mlist->n_items; i++)
10864 {
10865 const dyesub_stringitem_t *m = &(mlist->item[i]);
10866 stp_string_list_add_string(description->bounds.str,
10867 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
10868 }
10869 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
10870 /* This feature only applies if the printer is duplexing! */
10871 if (dyesub_feature(caps, DYESUB_FEATURE_DUPLEX))
10872 description->is_active = 1;
10873 }
10874 else if (strcmp(name, "OvercoatDuplex") == 0)
10875 {
10876 description->bounds.str = stp_string_list_create();
10877 if (caps->overcoat)
10878 {
10879 const overcoat_list_t *llist = caps->overcoat;
10880
10881 for (i = 0; i < llist->n_items; i++)
10882 {
10883 const overcoat_t *l = &(llist->item[i]);
10884 stp_string_list_add_string(description->bounds.str,
10885 l->name, gettext(l->text));
10886 }
10887 description->deflt.str =
10888 stp_string_list_param(description->bounds.str, 0)->name;
10889 /* This feature only applies if the printer is duplexing! */
10890 if (dyesub_feature(caps, DYESUB_FEATURE_DUPLEX))
10891 description->is_active = 1;
10892 } else {
10893 description->is_active = 0;
10894 }
10895 }
10896 else if (strcmp(name, "MagCoer") == 0)
10897 {
10898 description->bounds.str = stp_string_list_create();
10899
10900 const dyesub_stringlist_t *mlist = &magicard_mag_coer_list;
10901 for (i = 0; i < mlist->n_items; i++)
10902 {
10903 const dyesub_stringitem_t *m = &(mlist->item[i]);
10904 stp_string_list_add_string(description->bounds.str,
10905 m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
10906 }
10907 description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
10908 description->is_active = 1;
10909 }
10910 else if (strcmp(name, "MagStripe1") == 0)
10911 {
10912 description->is_active = 1;
10913 }
10914 else if (strcmp(name, "MagStripe2") == 0)
10915 {
10916 description->is_active = 1;
10917 }
10918 else if (strcmp(name, "MagStripe3") == 0)
10919 {
10920 description->is_active = 1;
10921 }
10922 else
10923 {
10924 return 0;
10925 }
10926 return 1;
10927 }
10928
10929 static int magicard_parse_parameters(stp_vars_t *v)
10930 {
10931 dyesub_privdata_t *pd = get_privdata(v);
10932
10933 const char *lpar = stp_get_string_parameter(v, "Laminate");
10934 const char *lpar_dpx = stp_get_string_parameter(v, "LaminateDuplex");
10935 const char *mag_coer = stp_get_string_parameter(v, "MagCoer");
10936 const char *holokote = stp_get_string_parameter(v, "Holokote");
10937 int holopatch = stp_get_int_parameter(v, "Holopatch");
10938 const char *overcoat_hole = stp_get_string_parameter(v, "OvercoatHole");
10939 const char *overcoat_hole_dpx = stp_get_string_parameter(v, "OvercoatHoleDuplex");
10940 int holokote_custom = stp_get_boolean_parameter(v, "HolokoteCustom");
10941 const char *blacktype = stp_get_string_parameter(v, "BlackType");
10942 const stp_raw_t *magstripe1 = NULL;
10943 const stp_raw_t *magstripe2 = NULL;
10944 const stp_raw_t *magstripe3 = NULL;
10945
10946 if (overcoat_hole && !strcmp("None", overcoat_hole))
10947 overcoat_hole = NULL;
10948
10949 /* If overcoat is off, we can't use holokote or holopatch */
10950 if (lpar && strcmp("On", lpar)) {
10951 if ((holokote && strcmp(holokote, "Off")) || holopatch || overcoat_hole || holokote_custom) {
10952 stp_eprintf(v, _("Holokote, Holopatch, and Overcoat hole features require Overcoat to be enabled!\n"));
10953 return 0;
10954 }
10955 }
10956
10957 /* Sanity check magstripe */
10958 if (stp_check_raw_parameter(v, "MagStripe1", STP_PARAMETER_ACTIVE)) {
10959 magstripe1 = stp_get_raw_parameter(v, "MagStripe1");
10960 if (magstripe1->bytes >= 79) {
10961 stp_eprintf(v, _("StpMagStripe1 must be between 0 and 78 bytes!\n"));
10962 return 0;
10963 }
10964 }
10965 if (stp_check_raw_parameter(v, "MagStripe2", STP_PARAMETER_ACTIVE)) {
10966 magstripe2 = stp_get_raw_parameter(v, "MagStripe2");
10967 if (magstripe2->bytes >= 40) {
10968 stp_eprintf(v, _("StpMagStripe2 must be between 0 and 39 bytes!\n"));
10969 return 0;
10970 }
10971 }
10972 if (stp_check_raw_parameter(v, "MagStripe3", STP_PARAMETER_ACTIVE)) {
10973 magstripe1 = stp_get_raw_parameter(v, "MagStripe3");
10974 if (magstripe1->bytes >= 107) {
10975 stp_eprintf(v, _("StpMagStripe3 must be between 0 and 106 bytes!\n"));
10976 return 0;
10977 }
10978 }
10979
10980 /* No need to set global params if there's no privdata yet */
10981 if (!pd)
10982 return 1;
10983
10984 pd->privdata.magicard.overcoat = lpar && !strcmp("On", lpar);
10985 pd->privdata.magicard.overcoat_dpx = lpar_dpx && !strcmp("On", lpar_dpx);
10986 pd->privdata.magicard.resin_k = blacktype && !strcmp("Resin",blacktype);
10987 pd->privdata.magicard.reject = stp_get_boolean_parameter(v, "RejectBad");
10988 pd->privdata.magicard.colorsure = stp_get_boolean_parameter(v, "ColorSure");
10989 pd->privdata.magicard.gamma = stp_get_int_parameter(v, "GammaCurve");
10990 pd->privdata.magicard.power_color = stp_get_int_parameter(v, "PowerColor") + 50;
10991 pd->privdata.magicard.power_resin = stp_get_int_parameter(v, "PowerBlack") + 50;
10992 pd->privdata.magicard.power_overcoat = stp_get_int_parameter(v, "PowerOC") + 50;
10993 pd->privdata.magicard.align_start = stp_get_int_parameter(v, "AlignStart") + 50;
10994 pd->privdata.magicard.align_end = stp_get_int_parameter(v, "AlignEnd") + 50;
10995 pd->privdata.magicard.holopatch = holopatch;
10996 pd->privdata.magicard.overcoat_hole = overcoat_hole;
10997 pd->privdata.magicard.overcoat_hole_dpx = overcoat_hole_dpx;
10998
10999 pd->horiz_offset = stp_get_int_parameter(v, "CardOffset");
11000
11001 pd->privdata.magicard.holokote = 0;
11002 if (holokote) {
11003 if (!strcmp(holokote, "UltraSecure")) {
11004 pd->privdata.magicard.holokote = 1;
11005 } else if (!strcmp(holokote, "InterlockingRings")) {
11006 pd->privdata.magicard.holokote = 2;
11007 } else if (!strcmp(holokote, "Flex")) {
11008 pd->privdata.magicard.holokote = 3;
11009 }
11010 }
11011 pd->privdata.magicard.holokote_custom = holokote_custom;
11012
11013 pd->privdata.magicard.mag_coer = mag_coer && !strcmp("High", mag_coer);
11014
11015 if (magstripe1 && magstripe1->bytes) {
11016 unsigned int i;
11017 memcpy(pd->privdata.magicard.mag1, magstripe1->data, magstripe1->bytes);
11018 pd->privdata.magicard.mag1[magstripe1->bytes] = 0;
11019 for (i = 0 ; i < magstripe1->bytes ; i++) {
11020 if (pd->privdata.magicard.mag1[i] < 0x20 ||
11021 pd->privdata.magicard.mag1[i] > 0x5f) {
11022 stp_eprintf(v, _("Illegal Alphanumeric in Magstripe, 0x20->0x5F ASCII only\n"));
11023 return 0;
11024 }
11025 }
11026 if (pd->privdata.magicard.mag1[0] != '%') {
11027 stp_eprintf(v, _("Magstripe alphanumeric data must start with '%%'\n"));
11028 return 0;
11029 }
11030 if (pd->privdata.magicard.mag1[magstripe1->bytes - 1] != '?') {
11031 stp_eprintf(v, _("Magstripe string must end with '?'\n"));
11032 return 0;
11033 }
11034 }
11035 if (magstripe2 && magstripe2->bytes) {
11036 unsigned int i;
11037 memcpy(pd->privdata.magicard.mag2, magstripe2->data, magstripe2->bytes);
11038 pd->privdata.magicard.mag2[magstripe2->bytes] = 0;
11039 for (i = 0 ; i < magstripe2->bytes ; i++) {
11040 if (pd->privdata.magicard.mag2[i] < 0x30 ||
11041 pd->privdata.magicard.mag2[i] > 0x3f) {
11042 stp_eprintf(v, _("Illegal Numeric in Magstripe, 0x30->0x3F ASCII only\n"));
11043 return 0;
11044 }
11045 }
11046 if (pd->privdata.magicard.mag2[0] != ';') {
11047 stp_eprintf(v, _("Magstripe numeric data must start with ';'\n"));
11048 return 0;
11049 }
11050 if (pd->privdata.magicard.mag2[magstripe2->bytes - 1] != '?') {
11051 stp_eprintf(v, _("Magstripe data must end with '?'\n"));
11052 return 0;
11053 }
11054 }
11055 if (magstripe3 && magstripe3->bytes) {
11056 unsigned int i;
11057 memcpy(pd->privdata.magicard.mag3, magstripe3->data, magstripe3->bytes);
11058 pd->privdata.magicard.mag3[magstripe3->bytes] = 0;
11059 for (i = 0 ; i < magstripe3->bytes ; i++) {
11060 if (pd->privdata.magicard.mag3[i] < 0x30 ||
11061 pd->privdata.magicard.mag3[i] > 0x3f) {
11062 stp_eprintf(v, _("Illegal Numeric in Magstripe, 0x30->0x3F ASCII only\n"));
11063 return 0;
11064 }
11065 }
11066 if (pd->privdata.magicard.mag3[0] != ';') {
11067 stp_eprintf(v, _("Magstripe numeric data must start with ';'\n"));
11068 return 0;
11069 }
11070 if (pd->privdata.magicard.mag3[magstripe3->bytes - 1] != '?') {
11071 stp_eprintf(v, _("Magstripe data must end with '?'\n"));
11072 return 0;
11073 }
11074 }
11075 return 1;
11076 }
11077
11078 /* Model capabilities */
11079
11080 static const dyesub_cap_t dyesub_model_capabilities[] =
11081 {
11082 { /* Olympus P-10, P-11 */
11083 2,
11084 &rgb_ink_list,
11085 &res_310dpi_list,
11086 &p10_page_list,
11087 &p10_printsize_list,
11088 SHRT_MAX,
11089 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11090 | DYESUB_FEATURE_PLANE_INTERLACE,
11091 &p10_printer_init_func, &p10_printer_end_func,
11092 NULL, NULL,
11093 &p10_block_init_func, NULL,
11094 &p10_overcoat_list, NULL,
11095 NULL, NULL,
11096 NULL, 0, NULL, NULL,
11097 },
11098 { /* Olympus P-200 */
11099 4,
11100 &ymc_ink_list,
11101 &res_320dpi_list,
11102 &p200_page_list,
11103 &p200_printsize_list,
11104 SHRT_MAX,
11105 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_BLOCK_ALIGN
11106 | DYESUB_FEATURE_PLANE_INTERLACE,
11107 &p200_printer_init_func, &p200_printer_end_func,
11108 &p200_plane_init_func, NULL,
11109 NULL, NULL,
11110 NULL, NULL,
11111 NULL, NULL,
11112 NULL, 0, NULL, NULL,
11113 },
11114 { /* Olympus P-300 */
11115 0,
11116 &ymc_ink_list,
11117 &p300_res_list,
11118 &p300_page_list,
11119 &p300_printsize_list,
11120 16,
11121 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_BLOCK_ALIGN
11122 | DYESUB_FEATURE_PLANE_INTERLACE,
11123 &p300_printer_init_func, NULL,
11124 NULL, &p300_plane_end_func,
11125 &p300_block_init_func, NULL,
11126 NULL, NULL,
11127 NULL, NULL,
11128 NULL, 0, NULL, NULL,
11129 },
11130 { /* Olympus P-400 */
11131 1,
11132 &ymc_ink_list,
11133 &res_314dpi_list,
11134 &p400_page_list,
11135 &p400_printsize_list,
11136 180,
11137 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11138 | DYESUB_FEATURE_PLANE_INTERLACE,
11139 &p400_printer_init_func, NULL,
11140 &p400_plane_init_func, &p400_plane_end_func,
11141 &p400_block_init_func, NULL,
11142 NULL, NULL,
11143 NULL, NULL,
11144 NULL, 0, NULL, NULL,
11145 },
11146 { /* Olympus P-440 */
11147 3,
11148 &bgr_ink_list,
11149 &res_314dpi_list,
11150 &p440_page_list,
11151 &p440_printsize_list,
11152 128,
11153 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
11154 &p440_printer_init_func, &p440_printer_end_func,
11155 NULL, NULL,
11156 &p440_block_init_func, &p440_block_end_func,
11157 &p10_overcoat_list, NULL,
11158 NULL, NULL,
11159 NULL, 0, NULL, NULL,
11160 },
11161 { /* Olympus P-S100 */
11162 20,
11163 &bgr_ink_list,
11164 &res_306dpi_list,
11165 &ps100_page_list,
11166 &ps100_printsize_list,
11167 1808,
11168 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
11169 &ps100_printer_init_func, &ps100_printer_end_func,
11170 NULL, NULL,
11171 NULL, NULL,
11172 NULL, NULL,
11173 NULL, NULL,
11174 NULL, 0, NULL, NULL,
11175 },
11176 { /* Canon CP-10 */
11177 1002,
11178 &ymc_ink_list,
11179 &res_300dpi_list,
11180 &cp10_page_list,
11181 &cp10_printsize_list,
11182 SHRT_MAX,
11183 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11184 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
11185 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11186 &cp10_printer_init_func, NULL,
11187 &cpx00_plane_init_func, NULL,
11188 NULL, NULL,
11189 NULL, NULL,
11190 NULL, NULL,
11191 NULL, 0, NULL, NULL,
11192 },
11193 { /* Canon CP-100, CP-200, CP-300 */
11194 1000,
11195 &ymc_ink_list,
11196 &res_300dpi_list,
11197 &cpx00_page_list,
11198 &cpx00_printsize_list,
11199 SHRT_MAX,
11200 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11201 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
11202 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11203 &cpx00_printer_init_func, NULL,
11204 &cpx00_plane_init_func, NULL,
11205 NULL, NULL,
11206 NULL, NULL,
11207 NULL, NULL,
11208 NULL, 0, NULL, NULL,
11209 },
11210 { /* Canon CP-220, CP-330, SELPHY CP400, SELPHY CP500, SELPHY CP510,
11211 SELPHY CP520, SELPHY CP530, SELPHY CP600, SELPHY CP710,
11212 SELPHY CP720, SELPHY CP730, SELPHY CP740, SELPHY CP750,
11213 SELPHY CP760, SELPHY CP770, SELPHY CP780 */
11214 1001,
11215 &ymc_ink_list,
11216 &res_300dpi_list,
11217 &cp220_page_list,
11218 &cp220_printsize_list,
11219 SHRT_MAX,
11220 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11221 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
11222 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11223 &cpx00_printer_init_func, NULL,
11224 &cpx00_plane_init_func, NULL,
11225 NULL, NULL,
11226 NULL, NULL,
11227 NULL, NULL,
11228 NULL, 0, NULL, NULL,
11229 },
11230 { /* Canon SELPHY ES1 */
11231 1003,
11232 &ymc_ink_list,
11233 &res_300dpi_list,
11234 &cpx00_page_list,
11235 &cpx00_printsize_list,
11236 SHRT_MAX,
11237 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11238 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
11239 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11240 &es1_printer_init_func, NULL,
11241 &es1_plane_init_func, NULL,
11242 NULL, NULL,
11243 NULL, NULL,
11244 NULL, NULL,
11245 NULL, 0, NULL, NULL,
11246 },
11247 { /* Canon SELPHY ES2, SELPHY ES20 */
11248 1005,
11249 &ymc_ink_list,
11250 &res_300dpi_list,
11251 &cpx00_page_list,
11252 &cpx00_printsize_list,
11253 SHRT_MAX,
11254 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11255 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
11256 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11257 &es2_printer_init_func, NULL,
11258 &es2_plane_init_func, NULL,
11259 NULL, NULL,
11260 NULL, NULL,
11261 NULL, NULL,
11262 NULL, 0, NULL, NULL,
11263 },
11264 { /* Canon SELPHY ES3, SELPHY ES30 */
11265 1006,
11266 &ymc_ink_list,
11267 &res_300dpi_list,
11268 &cpx00_page_list,
11269 &cpx00_printsize_list,
11270 SHRT_MAX,
11271 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11272 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
11273 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11274 &es3_printer_init_func, &es3_printer_end_func,
11275 &es2_plane_init_func, NULL,
11276 NULL, NULL,
11277 NULL, NULL,
11278 NULL, NULL,
11279 NULL, 0, NULL, NULL,
11280 },
11281 { /* Canon SELPHY ES40 */
11282 1007,
11283 &ymc_ink_list,
11284 &res_300dpi_list,
11285 &cpx00_page_list,
11286 &cpx00_printsize_list,
11287 SHRT_MAX,
11288 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11289 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
11290 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11291 &es40_printer_init_func, &es3_printer_end_func,
11292 &es2_plane_init_func, NULL,
11293 NULL, NULL,
11294 NULL, NULL,
11295 NULL, NULL,
11296 NULL, 0, NULL, NULL,
11297 },
11298 { /* Canon SELPHY CP790 */
11299 1008,
11300 &ymc_ink_list,
11301 &res_300dpi_list,
11302 &cp220_page_list,
11303 &cp220_printsize_list,
11304 SHRT_MAX,
11305 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11306 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
11307 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11308 &cp790_printer_init_func, &es3_printer_end_func,
11309 &es2_plane_init_func, NULL,
11310 NULL, NULL,
11311 NULL, NULL,
11312 NULL, NULL,
11313 NULL, 0, NULL, NULL,
11314 },
11315 { /* Canon SELPHY CP800 */
11316 1009,
11317 &ymc_ink_list,
11318 &res_300dpi_list,
11319 &cpx00_page_list,
11320 &cpx00_printsize_list,
11321 SHRT_MAX,
11322 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11323 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
11324 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11325 &cpx00_printer_init_func, NULL,
11326 &cpx00_plane_init_func, NULL,
11327 NULL, NULL,
11328 NULL, NULL,
11329 NULL, NULL,
11330 NULL, 0, NULL, NULL,
11331 },
11332 { /* Canon SELPHY CP900 */
11333 1010,
11334 &ymc_ink_list,
11335 &res_300dpi_list,
11336 &cpx00_page_list,
11337 &cpx00_printsize_list,
11338 SHRT_MAX,
11339 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11340 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
11341 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11342 &cpx00_printer_init_func, &cp900_printer_end_func,
11343 &cpx00_plane_init_func, NULL,
11344 NULL, NULL,
11345 NULL, NULL,
11346 NULL, NULL,
11347 NULL, 0, NULL, NULL,
11348 },
11349 { /* Canon CP820, CP910, CP1000, CP1200, CP1300, CP1500 */
11350 1011,
11351 &cmy_ink_list,
11352 &res_300dpi_list,
11353 &cp910_page_list,
11354 &cp910_printsize_list,
11355 SHRT_MAX,
11356 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11357 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
11358 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11359 &cp910_printer_init_func, NULL,
11360 NULL, NULL,
11361 NULL, NULL,
11362 NULL, NULL,
11363 NULL, NULL,
11364 NULL, 0, NULL, NULL,
11365 },
11366 { /* Sony UP-DP10 */
11367 2000,
11368 &cmy_ink_list,
11369 &res_300dpi_list,
11370 &updp10_page_list,
11371 &updp10_printsize_list,
11372 SHRT_MAX,
11373 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11374 | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11375 &updp10_printer_init_func, &updp10_printer_end_func,
11376 NULL, NULL,
11377 NULL, NULL,
11378 &updp10_overcoat_list, NULL,
11379 NULL, NULL,
11380 NULL, 0, NULL, NULL,
11381 },
11382 { /* Sony UP-DR150 */
11383 2001,
11384 &rgb_ink_list,
11385 &res_334dpi_list,
11386 &updr150_page_list,
11387 &updr150_printsize_list,
11388 SHRT_MAX,
11389 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11390 &updr150_printer_init_func, &updr150_printer_end_func,
11391 NULL, NULL,
11392 NULL, NULL,
11393 &updp10_overcoat_list, NULL,
11394 NULL, NULL,
11395 NULL, 0, NULL, NULL,
11396 },
11397 { /* Sony DPP-EX5, DPP-EX7 */
11398 2002,
11399 &rgb_ink_list,
11400 &res_403dpi_list,
11401 &dppex5_page_list,
11402 &dppex5_printsize_list,
11403 100,
11404 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11405 | DYESUB_FEATURE_BORDERLESS,
11406 &dppex5_printer_init, &dppex5_printer_end,
11407 NULL, NULL,
11408 &dppex5_block_init, NULL,
11409 &dppex5_overcoat_list, NULL,
11410 NULL, NULL,
11411 NULL, 0, NULL, NULL,
11412 },
11413 { /* Sony UP-DR100 */
11414 2003,
11415 &rgb_ink_list,
11416 &res_334dpi_list,
11417 &updr100_page_list,
11418 &updr100_printsize_list,
11419 SHRT_MAX,
11420 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
11421 &updr100_printer_init_func, &updr100_printer_end_func,
11422 NULL, NULL,
11423 NULL, NULL,
11424 &updr100_overcoat_list, NULL,
11425 NULL, NULL,
11426 NULL, 0, NULL, NULL,
11427 },
11428 { /* Sony UP-DR200 */
11429 2004,
11430 &rgb_ink_list,
11431 &res_334dpi_list,
11432 &updr200_page_list,
11433 &updr200_printsize_list,
11434 SHRT_MAX,
11435 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11436 &updr200_printer_init_func, &updr200_printer_end_func,
11437 NULL, NULL,
11438 NULL, NULL,
11439 &updr200_overcoat_list, NULL,
11440 NULL, NULL,
11441 NULL, 0, NULL, NULL,
11442 },
11443 { /* Sony UP-CR10L / DNP SL10 */
11444 2005,
11445 &rgb_ink_list,
11446 &res_300dpi_list,
11447 &upcr10_page_list,
11448 &upcr10_printsize_list,
11449 SHRT_MAX,
11450 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11451 &upcr10_printer_init_func, &upcr10_printer_end_func,
11452 NULL, NULL,
11453 NULL, NULL,
11454 NULL, NULL,
11455 NULL, NULL,
11456 NULL, 0, NULL, NULL,
11457 },
11458 { /* Sony UP-D895 Family */
11459 2006,
11460 &w_ink_list,
11461 &res_325dpi_list,
11462 &sony_d89x_page_list,
11463 &sony_d89x_printsize_list,
11464 SHRT_MAX,
11465 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11466 | DYESUB_FEATURE_MONOCHROME | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11467 &sony_upd895_printer_init_func, &sony_upd895_printer_end_func,
11468 NULL, NULL,
11469 NULL, NULL, /* No block funcs */
11470 NULL, NULL,
11471 NULL, NULL,
11472 sony_upd895_parameters,
11473 sony_upd895_parameter_count,
11474 sony_upd895_load_parameters,
11475 sony_upd895_parse_parameters,
11476 },
11477 { /* Sony UP-D897 Family */
11478 2007,
11479 &w_ink_list,
11480 &res_325dpi_list,
11481 &sony_d89x_page_list,
11482 &sony_d89x_printsize_list,
11483 SHRT_MAX,
11484 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11485 | DYESUB_FEATURE_MONOCHROME | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11486 &sony_upd897_printer_init_func, &sony_upd897_printer_end_func,
11487 NULL, NULL,
11488 NULL, NULL, /* No block funcs */
11489 NULL, NULL,
11490 NULL, NULL,
11491 sony_upd897_parameters,
11492 sony_upd897_parameter_count,
11493 sony_upd897_load_parameters,
11494 sony_upd897_parse_parameters,
11495 },
11496 { /* Sony UP-D898 Family */
11497 2008,
11498 &w_ink_list,
11499 &res_325dpi_list,
11500 &sony_d898_page_list,
11501 &sony_d898_printsize_list,
11502 SHRT_MAX,
11503 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11504 | DYESUB_FEATURE_MONOCHROME | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11505 &sony_upd898_printer_init_func, &sony_updneo_printer_end_func,
11506 NULL, NULL,
11507 NULL, NULL, /* No block funcs */
11508 NULL, NULL,
11509 NULL, NULL,
11510 sony_upd898_parameters,
11511 sony_upd898_parameter_count,
11512 sony_upd898_load_parameters,
11513 sony_upd898_parse_parameters,
11514 },
11515 { /* Sony UP-CR20L */
11516 2009,
11517 &rgb_ink_list,
11518 &res_334dpi_list,
11519 &upcr20_page_list,
11520 &upcr20_printsize_list,
11521 SHRT_MAX,
11522 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11523 &sony_upcr20_printer_init_func, &sony_updneo_printer_end_func,
11524 NULL, NULL,
11525 NULL, NULL,
11526 &upcr20_overcoat_list, NULL,
11527 NULL, NULL,
11528 NULL, 0, NULL, NULL,
11529 },
11530 { /* Sony UP-DR80 series */
11531 2010,
11532 &rgb_ink_list,
11533 &res_301dpi_list,
11534 &updr80md_page_list,
11535 &updr80md_printsize_list,
11536 SHRT_MAX,
11537 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11538 &sony_updr80md_printer_init_func, &sony_updneo_printer_end_func,
11539 NULL, NULL,
11540 NULL, NULL,
11541 NULL, NULL,
11542 NULL, NULL,
11543 NULL, 0, NULL, NULL,
11544 },
11545 { /* Sony UP-CX1 */
11546 2011,
11547 &rgb_ink_list,
11548 &res_300dpi_list,
11549 &upcr10_page_list,
11550 &upcr10_printsize_list,
11551 SHRT_MAX,
11552 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11553 &upcx1_printer_init_func, &upcx1_printer_end_func,
11554 NULL, NULL,
11555 NULL, NULL,
11556 &upcx1_overcoat_list, NULL,
11557 NULL, NULL,
11558 NULL, 0, NULL, NULL,
11559 },
11560 { /* Sony UP-971AD/UP-991AD */
11561 2012,
11562 &w_ink_list,
11563 &res_325dpi_list,
11564 &sony_up971_page_list,
11565 &sony_up971_printsize_list,
11566 SHRT_MAX,
11567 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11568 | DYESUB_FEATURE_MONOCHROME | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11569 &sony_up971_printer_init_func, &sony_updneo_printer_end_func,
11570 NULL, NULL,
11571 NULL, NULL, /* No block funcs */
11572 NULL, NULL,
11573 NULL, NULL,
11574 sony_upd898_parameters,
11575 sony_upd898_parameter_count,
11576 sony_upd898_load_parameters,
11577 sony_upd898_parse_parameters,
11578 },
11579 { /* Sony UP-D711 Family */
11580 2013,
11581 &w_ink_list,
11582 &res_300dpi_list,
11583 &sony_d711_page_list,
11584 &sony_d711_printsize_list,
11585 SHRT_MAX,
11586 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11587 | DYESUB_FEATURE_MONOCHROME | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11588 &sony_upd711_printer_init_func, &sony_upd711_printer_end_func,
11589 NULL, NULL,
11590 NULL, NULL, /* No block funcs */
11591 NULL, NULL,
11592 NULL, NULL,
11593 sony_upd711_parameters,
11594 sony_upd711_parameter_count,
11595 sony_upd711_load_parameters,
11596 sony_upd711_parse_parameters,
11597 },
11598 { /* Fujifilm Printpix CX-400 */
11599 3000,
11600 &rgb_ink_list,
11601 &res_310dpi_list,
11602 &cx400_page_list,
11603 &cx400_printsize_list,
11604 SHRT_MAX,
11605 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11606 | DYESUB_FEATURE_BORDERLESS,
11607 &cx400_printer_init_func, NULL,
11608 NULL, NULL,
11609 NULL, NULL,
11610 NULL, NULL,
11611 NULL, NULL,
11612 NULL, 0, NULL, NULL,
11613 },
11614 { /* Fujifilm Printpix CX-550 */
11615 3001,
11616 &rgb_ink_list,
11617 &res_310dpi_list,
11618 &cx400_page_list,
11619 &cx400_printsize_list,
11620 SHRT_MAX,
11621 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11622 | DYESUB_FEATURE_BORDERLESS,
11623 &cx400_printer_init_func, NULL,
11624 NULL, NULL,
11625 NULL, NULL,
11626 NULL, NULL,
11627 NULL, NULL,
11628 NULL, 0, NULL, NULL,
11629 },
11630 { /* Fujifilm FinePix NX-500 */
11631 3002,
11632 &rgb_ink_list,
11633 &res_306dpi_list,
11634 &nx500_page_list,
11635 &nx500_printsize_list,
11636 SHRT_MAX,
11637 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
11638 &nx500_printer_init_func, NULL,
11639 NULL, NULL,
11640 NULL, NULL,
11641 NULL, NULL,
11642 NULL, NULL,
11643 NULL, 0, NULL, NULL,
11644 },
11645 { /* Kodak Easyshare Dock family */
11646 4000,
11647 &ymc_ink_list,
11648 &res_300dpi_list,
11649 &kodak_dock_page_list,
11650 &kodak_dock_printsize_list,
11651 SHRT_MAX,
11652 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11653 | DYESUB_FEATURE_PLANE_INTERLACE,
11654 &kodak_dock_printer_init, NULL,
11655 &kodak_dock_plane_init, NULL,
11656 NULL, NULL,
11657 NULL, NULL,
11658 NULL, NULL,
11659 NULL, 0, NULL, NULL,
11660 },
11661 { /* Kodak Photo Printer 6800 */
11662 4001,
11663 &rgb_ink_list,
11664 &res_300dpi_list,
11665 &kodak_6800_page_list,
11666 &kodak_6800_printsize_list,
11667 SHRT_MAX,
11668 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11669 &kodak_68xx_printer_init, NULL,
11670 NULL, NULL, /* No plane funcs */
11671 NULL, NULL, /* No block funcs */
11672 &kodak_6800_overcoat_list, NULL,
11673 NULL, NULL,
11674 NULL, 0, NULL, NULL,
11675 },
11676 { /* Kodak Photo Printer 6850 */
11677 4002,
11678 &rgb_ink_list,
11679 &res_300dpi_list,
11680 &kodak_6850_page_list,
11681 &kodak_6850_printsize_list,
11682 SHRT_MAX,
11683 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11684 &kodak_68xx_printer_init, NULL,
11685 NULL, NULL, /* No plane funcs */
11686 NULL, NULL, /* No block funcs */
11687 &kodak_6800_overcoat_list, NULL,
11688 NULL, NULL,
11689 NULL, 0, NULL, NULL,
11690 },
11691 { /* Kodak Photo Printer 605 */
11692 4003,
11693 &rgb_ink_list,
11694 &res_300dpi_list,
11695 &kodak_605_page_list,
11696 &kodak_605_printsize_list,
11697 SHRT_MAX,
11698 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11699 &kodak_605_printer_init, NULL,
11700 NULL, NULL, /* No plane funcs */
11701 NULL, NULL, /* No block funcs */
11702 &kodak_605_overcoat_list, NULL,
11703 NULL, NULL,
11704 NULL, 0, NULL, NULL,
11705 },
11706 { /* Kodak Professional 1400 */
11707 4004,
11708 &bgr_ink_list,
11709 &res_301dpi_list,
11710 &kodak_1400_page_list,
11711 &kodak_1400_printsize_list,
11712 SHRT_MAX,
11713 DYESUB_FEATURE_FULL_WIDTH
11714 | DYESUB_FEATURE_WHITE_BORDER
11715 | DYESUB_FEATURE_ROW_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11716 &kodak_1400_printer_init, NULL,
11717 NULL, NULL,
11718 NULL, NULL,
11719 &kodak_6800_overcoat_list, &kodak_1400_media_list,
11720 NULL, NULL,
11721 NULL, 0, NULL, NULL,
11722 },
11723 { /* Kodak Photo Printer 805 */
11724 4005,
11725 &bgr_ink_list,
11726 &res_301dpi_list,
11727 &kodak_805_page_list,
11728 &kodak_805_printsize_list,
11729 SHRT_MAX,
11730 DYESUB_FEATURE_FULL_WIDTH
11731 | DYESUB_FEATURE_WHITE_BORDER
11732 | DYESUB_FEATURE_ROW_INTERLACE | DYESUB_FEATURE_HASBACKEND,
11733 &kodak_805_printer_init, NULL,
11734 NULL, NULL, /* No plane funcs */
11735 NULL, NULL, /* No block funcs */
11736 &kodak_6800_overcoat_list, NULL,
11737 NULL, NULL,
11738 NULL, 0, NULL, NULL,
11739 },
11740 { /* Kodak Professional 9810 (and 8800) */
11741 4006,
11742 &bgr_ink_list,
11743 &res_300dpi_list,
11744 &kodak_9810_page_list,
11745 &kodak_9810_printsize_list,
11746 SHRT_MAX,
11747 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11748 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11749 &kodak_9810_printer_init, &kodak_9810_printer_end,
11750 &kodak_9810_plane_init, NULL,
11751 NULL, NULL, /* No block funcs */
11752 &kodak_9810_overcoat_list, NULL,
11753 NULL, NULL,
11754 kodak_9810_parameters,
11755 kodak_9810_parameter_count,
11756 kodak_9810_load_parameters,
11757 kodak_9810_parse_parameters,
11758 },
11759 { /* Kodak 8810 */
11760 4007,
11761 &rgb_ink_list,
11762 &res_300dpi_list,
11763 &kodak_8810_page_list,
11764 &kodak_8810_printsize_list,
11765 SHRT_MAX,
11766 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11767 &kodak_8810_printer_init, NULL,
11768 NULL, NULL,
11769 NULL, NULL, /* No block funcs */
11770 &kodak_8810_overcoat_list, NULL,
11771 NULL, NULL,
11772 NULL, 0, NULL, kodak_8810_parse_paramters,
11773 },
11774 { /* Kodak 7000/7010 */
11775 4008,
11776 &rgb_ink_list,
11777 &res_300dpi_list,
11778 &kodak_7000_page_list,
11779 &kodak_7000_printsize_list,
11780 SHRT_MAX,
11781 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11782 &kodak_70xx_printer_init, NULL,
11783 NULL, NULL,
11784 NULL, NULL, /* No block funcs */
11785 &kodak_8810_overcoat_list, NULL,
11786 NULL, NULL,
11787 NULL, 0, NULL, NULL,
11788 },
11789 { /* Kodak 6900 */
11790 4010,
11791 &rgb_ink_list,
11792 &res_300dpi_list,
11793 &kodak_6900_page_list,
11794 &kodak_6900_printsize_list,
11795 SHRT_MAX,
11796 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11797 &kodak_6900_printer_init, NULL,
11798 NULL, NULL, /* No planes */
11799 NULL, NULL, /* No blocks */
11800 &kodak_6900_overcoat_list, NULL,
11801 NULL, NULL,
11802 kodak6900_parameters,
11803 kodak6900_parameter_count,
11804 kodak6900_load_parameters,
11805 kodak6900_parse_parameters,
11806 },
11807 { /* Kodak 7015 */
11808 4009,
11809 &rgb_ink_list,
11810 &res_300dpi_list,
11811 &kodak_7015_page_list,
11812 &kodak_7015_printsize_list,
11813 SHRT_MAX,
11814 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11815 &kodak_70xx_printer_init, NULL,
11816 NULL, NULL,
11817 NULL, NULL, /* No block funcs */
11818 &kodak_8810_overcoat_list, NULL,
11819 NULL, NULL,
11820 NULL, 0, NULL, NULL,
11821 },
11822 { /* Kodak Professional 8500 */
11823 4100,
11824 &bgr_ink_list,
11825 &res_314dpi_list,
11826 &kodak_8500_page_list,
11827 &kodak_8500_printsize_list,
11828 SHRT_MAX,
11829 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11830 &kodak_8500_printer_init, &kodak_8500_printer_end,
11831 NULL, NULL, /* No plane funcs */
11832 NULL, NULL, /* No block funcs */
11833 &kodak_8500_overcoat_list, &kodak_8500_media_list,
11834 NULL, NULL,
11835 kodak_8500_parameters,
11836 kodak_8500_parameter_count,
11837 kodak_8500_load_parameters,
11838 kodak_8500_parse_parameters,
11839 },
11840 { /* Mitsubishi CP3020D/DU/DE */
11841 4101,
11842 &ymc_ink_list,
11843 &res_314dpi_list,
11844 &mitsu_cp3020d_page_list,
11845 &mitsu_cp3020d_printsize_list,
11846 SHRT_MAX,
11847 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11848 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11849 &mitsu_cp3020d_printer_init, &mitsu_cp3020d_printer_end,
11850 &mitsu_cp3020d_plane_init, &mitsu_cp3020d_plane_end,
11851 NULL, NULL, /* No block funcs */
11852 NULL, NULL,
11853 NULL, NULL,
11854 NULL, 0, NULL, NULL,
11855 },
11856 { /* Mitsubishi CP3020DA/DAE */
11857 4102,
11858 &bgr_ink_list,
11859 &res_314dpi_list,
11860 &mitsu_cp3020d_page_list,
11861 &mitsu_cp3020d_printsize_list,
11862 SHRT_MAX,
11863 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11864 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11865 &mitsu_cp3020da_printer_init, &mitsu_cp3020da_printer_end,
11866 &mitsu_cp3020da_plane_init, NULL,
11867 NULL, NULL, /* No block funcs */
11868 NULL, NULL,
11869 NULL, NULL,
11870 NULL, 0, NULL, NULL,
11871 },
11872 { /* Mitsubishi CP9550D */
11873 4103,
11874 &rgb_ink_list,
11875 &res_346dpi_list,
11876 &mitsu_cp9550_page_list,
11877 &mitsu_cp9550_printsize_list,
11878 SHRT_MAX,
11879 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
11880 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11881 &mitsu_cp9550_printer_init, &mitsu_cp9550_printer_end,
11882 &mitsu_cp3020da_plane_init, NULL,
11883 NULL, NULL, /* No block funcs */
11884 NULL, NULL,
11885 NULL, NULL,
11886 mitsu9550_parameters,
11887 mitsu9550_parameter_count,
11888 mitsu9550_load_parameters,
11889 mitsu9550_parse_parameters,
11890 },
11891 { /* Mitsubishi CP9810D */
11892 4104,
11893 &bgr_ink_list,
11894 &res_300dpi_list,
11895 &mitsu_cp9810_page_list,
11896 &mitsu_cp9810_printsize_list,
11897 SHRT_MAX,
11898 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11899 &mitsu_cp9810_printer_init, &mitsu_cp9810_printer_end,
11900 NULL, NULL,
11901 NULL, NULL, /* No block funcs */
11902 &mitsu_cp9810_overcoat_list, NULL,
11903 NULL, NULL,
11904 mitsu98xx_parameters,
11905 mitsu98xx_parameter_count,
11906 mitsu98xx_load_parameters,
11907 mitsu98xx_parse_parameters,
11908 },
11909 { /* Mitsubishi CPD70D */
11910 4105,
11911 &bgr_ink_list,
11912 &res_300dpi_list,
11913 &mitsu_cpd70x_page_list,
11914 &mitsu_cpd70x_printsize_list,
11915 SHRT_MAX,
11916 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_WHITE_BORDER | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11917 &mitsu_cpd70x_printer_init, NULL,
11918 NULL, NULL,
11919 NULL, NULL, /* No block funcs */
11920 &mitsu_cpd70x_overcoat_list, NULL,
11921 mitsu_cpd70k60_job_start, NULL,
11922 mitsu70x_parameters,
11923 mitsu70x_parameter_count,
11924 mitsu70x_load_parameters,
11925 mitsu70x_parse_parameters,
11926 },
11927 { /* Mitsubishi CPK60D */
11928 4106,
11929 &bgr_ink_list,
11930 &res_300dpi_list,
11931 &mitsu_cpk60_page_list,
11932 &mitsu_cpk60_printsize_list,
11933 SHRT_MAX,
11934 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11935 &mitsu_cpk60_printer_init, NULL,
11936 NULL, NULL,
11937 NULL, NULL, /* No block funcs */
11938 &mitsu_cpd70x_overcoat_list, NULL,
11939 mitsu_cpd70k60_job_start, NULL,
11940 mitsu70x_parameters,
11941 mitsu70x_parameter_count,
11942 mitsu_k60_load_parameters,
11943 mitsu70x_parse_parameters,
11944 },
11945 { /* Mitsubishi CPD80D */
11946 4107,
11947 &bgr_ink_list,
11948 &res_300dpi_list,
11949 &mitsu_cpd80_page_list,
11950 &mitsu_cpd80_printsize_list,
11951 SHRT_MAX,
11952 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_WHITE_BORDER | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11953 &mitsu_cpd70x_printer_init, NULL,
11954 NULL, NULL,
11955 NULL, NULL, /* No block funcs */
11956 &mitsu_cpd70x_overcoat_list, NULL,
11957 mitsu_cpd70k60_job_start, NULL,
11958 mitsu70x_parameters,
11959 mitsu70x_parameter_count,
11960 mitsu70x_load_parameters,
11961 mitsu70x_parse_parameters,
11962 },
11963 { /* Kodak 305 */
11964 4108,
11965 &bgr_ink_list,
11966 &res_300dpi_list,
11967 &kodak305_page_list,
11968 &kodak305_printsize_list,
11969 SHRT_MAX,
11970 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11971 &kodak305_printer_init, NULL,
11972 NULL, NULL,
11973 NULL, NULL, /* No block funcs */
11974 &mitsu_cpd70x_overcoat_list, NULL,
11975 mitsu_cpd70k60_job_start, NULL,
11976 mitsu70x_parameters,
11977 mitsu70x_parameter_count,
11978 mitsu_k60_load_parameters,
11979 mitsu70x_parse_parameters,
11980 },
11981 { /* Mitsubishi CPD90D */
11982 4109,
11983 &rgb_ink_list,
11984 &res_300dpi_list,
11985 &mitsu_cpd90_page_list,
11986 &mitsu_cpd90_printsize_list,
11987 SHRT_MAX,
11988 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
11989 &mitsu_cpd90_printer_init, NULL,
11990 NULL, NULL,
11991 NULL, NULL, /* No block funcs */
11992 &mitsu_cpd70x_overcoat_list, NULL,
11993 NULL, mitsu_cpd90_job_end,
11994 mitsu_d90_parameters,
11995 mitsu_d90_parameter_count,
11996 mitsu_d90_load_parameters,
11997 mitsu_d90_parse_parameters,
11998 },
11999 { /* Mitsubishi CP9600D */
12000 4110,
12001 &rgb_ink_list,
12002 &res_mitsu9600_dpi_list,
12003 &mitsu_cp9600_page_list,
12004 &mitsu_cp9600_printsize_list,
12005 SHRT_MAX,
12006 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
12007 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12008 &mitsu_cp9600_printer_init, &mitsu_cp9600_printer_end,
12009 &mitsu_cp3020da_plane_init, NULL,
12010 NULL, NULL, /* No block funcs */
12011 NULL, NULL,
12012 NULL, NULL,
12013 NULL, 0, NULL, NULL,
12014 },
12015 { /* Mitsubishi CP9550DW-S */
12016 4111,
12017 &rgb_ink_list,
12018 &res_346dpi_list,
12019 &mitsu_cp9550s_page_list,
12020 &mitsu_cp9550s_printsize_list,
12021 SHRT_MAX,
12022 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
12023 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12024 &mitsu_cp9550_printer_init, &mitsu_cp9550s_printer_end,
12025 &mitsu_cp3020da_plane_init, NULL,
12026 NULL, NULL, /* No block funcs */
12027 NULL, NULL,
12028 NULL, NULL,
12029 mitsu9550_parameters,
12030 mitsu9550_parameter_count,
12031 mitsu9550_load_parameters,
12032 mitsu9550_parse_parameters,
12033 },
12034 { /* Fujifilm ASK-300 */
12035 4112,
12036 &bgr_ink_list,
12037 &res_300dpi_list,
12038 &fuji_ask300_page_list,
12039 &fuji_ask300_printsize_list,
12040 SHRT_MAX,
12041 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_WHITE_BORDER | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12042 &fuji_ask300_printer_init, NULL,
12043 NULL, NULL,
12044 NULL, NULL, /* No block funcs */
12045 &mitsu_cpd70x_overcoat_list, NULL,
12046 mitsu_cpd70k60_job_start, NULL,
12047 mitsu70x_parameters,
12048 mitsu70x_parameter_count,
12049 mitsu_k60_load_parameters,
12050 mitsu70x_parse_parameters,
12051 },
12052 { /* Mitsubishi CP9800D */
12053 4113,
12054 &bgr_ink_list,
12055 &res_300dpi_list,
12056 &mitsu_cp9810_page_list,
12057 &mitsu_cp9810_printsize_list,
12058 SHRT_MAX,
12059 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12060 &mitsu_cp9800_printer_init, &mitsu_cp9810_printer_end,
12061 NULL, NULL,
12062 NULL, NULL, /* No block funcs */
12063 NULL, NULL,
12064 NULL, NULL,
12065 mitsu98xx_parameters,
12066 mitsu98xx_parameter_count,
12067 mitsu98xx_load_parameters,
12068 mitsu98xx_parse_parameters,
12069 },
12070 { /* Mitsubishi P95D/DW */
12071 4114,
12072 &w_ink_list,
12073 &res_325dpi_list,
12074 &mitsu_p95d_page_list,
12075 &mitsu_p95d_printsize_list,
12076 SHRT_MAX,
12077 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
12078 | DYESUB_FEATURE_MONOCHROME | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12079 &mitsu_p95d_printer_init, &mitsu_p95d_printer_end,
12080 &mitsu_p95d_plane_start, NULL,
12081 NULL, NULL, /* No block funcs */
12082 NULL, &mitsu_p95d_media_list,
12083 NULL, NULL,
12084 mitsu_p95d_parameters,
12085 mitsu_p95d_parameter_count,
12086 mitsu_p95d_load_parameters,
12087 mitsu_p95d_parse_parameters,
12088 },
12089 { /* Mitsubishi CP9500D */
12090 4115,
12091 &rgb_ink_list,
12092 &res_m9500_list,
12093 &mitsu_cp9500_page_list,
12094 &mitsu_cp9500_printsize_list,
12095 SHRT_MAX,
12096 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
12097 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12098 &mitsu_cp9500_printer_init, &mitsu_cp9500_printer_end,
12099 &mitsu_cp3020da_plane_init, NULL,
12100 NULL, NULL, /* No block funcs */
12101 NULL, NULL,
12102 NULL, NULL,
12103 mitsu9500_parameters,
12104 mitsu9500_parameter_count,
12105 mitsu9500_load_parameters,
12106 mitsu9500_parse_parameters,
12107 },
12108 { /* Mitsubishi P93D/DW */
12109 4116,
12110 &w_ink_list,
12111 &res_325dpi_list,
12112 &mitsu_p95d_page_list,
12113 &mitsu_p95d_printsize_list,
12114 SHRT_MAX,
12115 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
12116 | DYESUB_FEATURE_MONOCHROME | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12117 &mitsu_p93d_printer_init, &mitsu_p95d_printer_end,
12118 &mitsu_p95d_plane_start, NULL,
12119 NULL, NULL, /* No block funcs */
12120 NULL, &mitsu_p93d_media_list,
12121 NULL, NULL,
12122 mitsu_p93d_parameters,
12123 mitsu_p93d_parameter_count,
12124 mitsu_p93d_load_parameters,
12125 mitsu_p93d_parse_parameters,
12126 },
12127 { /* Mitsubishi CPD707D */
12128 4117,
12129 &bgr_ink_list,
12130 &res_300dpi_list,
12131 &mitsu_cpd70x_page_list,
12132 &mitsu_cpd70x_printsize_list,
12133 SHRT_MAX,
12134 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_WHITE_BORDER | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12135 &mitsu_cpd70x_printer_init, NULL,
12136 NULL, NULL,
12137 NULL, NULL, /* No block funcs */
12138 &mitsu_cpd70x_overcoat_list, NULL,
12139 mitsu_cpd70k60_job_start, NULL,
12140 mitsu707_parameters,
12141 mitsu707_parameter_count,
12142 mitsu707_load_parameters,
12143 mitsu70x_parse_parameters,
12144 },
12145 { /* Mitsubishi CP-M1 family */
12146 4118,
12147 &rgb_ink_list,
12148 &res_300dpi_list,
12149 &mitsu_cpm1_page_list,
12150 &mitsu_cpm1_printsize_list,
12151 SHRT_MAX,
12152 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12153 &mitsu_cpm1_printer_init, NULL, // change
12154 NULL, NULL,
12155 NULL, NULL, /* No block funcs */
12156 &mitsu_cpm1_overcoat_list, NULL,
12157 NULL, mitsu_cpd90_job_end,
12158 mitsu_cpm1_parameters,
12159 mitsu_cpm1_parameter_count,
12160 mitsu_cpm1_load_parameters,
12161 mitsu_cpm1_parse_parameters,
12162 },
12163 { /* Mitsubishi CP30 family */
12164 4119,
12165 &rgb_ink_list,
12166 &res_423dpi_list,
12167 &mitsu_cp30_page_list,
12168 &mitsu_cp30_printsize_list,
12169 SHRT_MAX,
12170 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND | DYESUB_FEATURE_PLANE_INTERLACE,
12171 &mitsu_cp30_printer_init, &mitsu_cp30_printer_end,
12172 &mitsu_cp3020da_plane_init, NULL,
12173 NULL, NULL, /* No block funcs */
12174 NULL, NULL,
12175 NULL, NULL,
12176 mitsu_cp30_parameters,
12177 mitsu_cp30_parameter_count,
12178 mitsu_cp30_load_parameters,
12179 mitsu_cp30_parse_parameters,
12180 },
12181 { /* Mitsubishi CP-W5000 family */
12182 4120,
12183 &rgb_ink_list,
12184 &res_300dpi_list,
12185 &mitsu_cpw5k_page_list,
12186 &mitsu_cpw5k_printsize_list,
12187 SHRT_MAX,
12188 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_DUPLEX | DYESUB_FEATURE_HASBACKEND,
12189 mitsu_cpw5k_printer_init, NULL,
12190 NULL, NULL,
12191 NULL, NULL, /* No block funcs */
12192 &mitsu_cpw5k_overcoat_list, NULL,
12193 NULL, mitsu_cpw5k_job_end,
12194 mitsu_cpw5k_parameters,
12195 mitsu_cpw5k_parameter_count,
12196 mitsu_cpw5k_load_parameters,
12197 mitsu_cpw5k_parse_parameters,
12198 },
12199 { /* Fujifilm ASK-2000/2500 */
12200 4200,
12201 &ymc_ink_list,
12202 &res_300dpi_list,
12203 &fuji_ask2000_page_list,
12204 &fuji_ask2000_printsize_list,
12205 SHRT_MAX,
12206 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
12207 &fuji_ask2000_printer_init, &fuji_ask2000_printer_end,
12208 NULL, NULL,
12209 NULL, NULL, /* No block funcs */
12210 NULL, NULL,
12211 NULL, NULL,
12212 NULL, 0, NULL, NULL,
12213 },
12214 { /* Fujifilm ASK-4000 */
12215 4201,
12216 &ymc_ink_list,
12217 &res_300dpi_list,
12218 &fuji_ask4000_page_list,
12219 &fuji_ask4000_printsize_list,
12220 SHRT_MAX,
12221 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_HASBACKEND,
12222 &fuji_ask4000_printer_init, &fuji_ask4000_printer_end,
12223 NULL, NULL,
12224 NULL, NULL, /* No block funcs */
12225 NULL, NULL,
12226 NULL, NULL,
12227 NULL, 0, NULL, NULL,
12228 },
12229 { /* DNP DS480 */
12230 4121,
12231 &bgr_ink_list,
12232 &res_300dpi_list,
12233 &dnp_ds480_page_list,
12234 &dnp_ds480_printsize_list,
12235 SHRT_MAX,
12236 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES,
12237 &dnp_ds4x0_printer_init, NULL,
12238 NULL, NULL,
12239 NULL, NULL, /* No block funcs */
12240 &mitsu_cpd70x_overcoat_list, NULL,
12241 NULL, NULL,
12242 mitsu70x_parameters,
12243 mitsu70x_parameter_count,
12244 dnp_ds4x0_load_parameters,
12245 mitsu70x_parse_parameters,
12246 },
12247 { /* DNP DS680 */
12248 4122,
12249 &bgr_ink_list,
12250 &res_300dpi_list,
12251 &dnp_ds680_page_list,
12252 &dnp_ds680_printsize_list,
12253 SHRT_MAX,
12254 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES,
12255 &dnp_ds4x0_printer_init, NULL,
12256 NULL, NULL,
12257 NULL, NULL, /* No block funcs */
12258 &mitsu_cpd70x_overcoat_list, NULL,
12259 NULL, NULL,
12260 mitsu70x_parameters,
12261 mitsu70x_parameter_count,
12262 dnp_ds4x0_load_parameters,
12263 mitsu70x_parse_parameters,
12264 },
12265 { /* Shinko CHC-S9045 (experimental) */
12266 5000,
12267 &rgb_ink_list,
12268 &res_300dpi_list,
12269 &shinko_chcs9045_page_list,
12270 &shinko_chcs9045_printsize_list,
12271 SHRT_MAX,
12272 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
12273 &shinko_chcs9045_printer_init, NULL,
12274 NULL, NULL,
12275 NULL, NULL,
12276 NULL, NULL,
12277 NULL, NULL,
12278 NULL, 0, NULL, NULL,
12279 },
12280 { /* Shinko/Sinfonia CHC-S2145 */
12281 5001,
12282 &rgb_ink_list,
12283 &res_300dpi_list,
12284 &shinko_chcs2145_page_list,
12285 &shinko_chcs2145_printsize_list,
12286 SHRT_MAX,
12287 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12288 &shinko_chcs2145_printer_init, &shinko_chcs2145_printer_end,
12289 NULL, NULL, /* No planes */
12290 NULL, NULL, /* No blocks */
12291 &shinko_chcs2145_overcoat_list, NULL,
12292 NULL, NULL,
12293 NULL, 0, NULL, NULL,
12294 },
12295 { /* Shinko/Sinfonia CHC-S1245 */
12296 5002,
12297 &rgb_ink_list,
12298 &res_300dpi_list,
12299 &shinko_chcs1245_page_list,
12300 &shinko_chcs1245_printsize_list,
12301 SHRT_MAX,
12302 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12303 &shinko_chcs1245_printer_init, &shinko_chcs2145_printer_end,
12304 NULL, NULL, /* No planes */
12305 NULL, NULL, /* No blocks */
12306 &shinko_chcs1245_overcoat_list, NULL,
12307 NULL, NULL,
12308 shinko_chcs1245_parameters,
12309 shinko_chcs1245_parameter_count,
12310 shinko_chcs1245_load_parameters,
12311 shinko_chcs1245_parse_parameters,
12312 },
12313 { /* Shinko/Sinfonia CHC-S6245 */
12314 5003,
12315 &rgb_ink_list,
12316 &res_300dpi_list,
12317 &shinko_chcs6245_page_list,
12318 &shinko_chcs6245_printsize_list,
12319 SHRT_MAX,
12320 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12321 &shinko_chcs6245_printer_init, &shinko_chcs2145_printer_end,
12322 NULL, NULL, /* No planes */
12323 NULL, NULL, /* No blocks */
12324 &shinko_chcs6245_overcoat_list, NULL,
12325 NULL, NULL,
12326 NULL, 0, NULL, NULL,
12327 },
12328 { /* Shinko/Sinfonia CHC-S6145 */
12329 5004,
12330 #ifdef S6145_YMC
12331 &ymc_ink_list,
12332 #else
12333 &rgb_ink_list,
12334 #endif
12335 &res_300dpi_list,
12336 &shinko_chcs6145_page_list,
12337 &shinko_chcs6145_printsize_list,
12338 SHRT_MAX,
12339 #ifdef S6145_YMC
12340 DYESUB_FEATURE_PLANE_INTERLACE |
12341 #endif
12342 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12343 &shinko_chcs6145_printer_init, &shinko_chcs2145_printer_end,
12344 NULL, NULL, /* No planes */
12345 NULL, NULL, /* No blocks */
12346 &shinko_chcs6145_overcoat_list, NULL,
12347 NULL, NULL,
12348 NULL, 0, NULL, NULL,
12349 },
12350 { /* CIAAT Brava 21 (aka CHC-S6145D) */
12351 5005,
12352 #ifdef S6145_YMC
12353 &ymc_ink_list,
12354 #else
12355 &rgb_ink_list,
12356 #endif
12357 &res_300dpi_list,
12358 &ciaat_brava21_page_list,
12359 &ciaat_brava21_printsize_list,
12360 SHRT_MAX,
12361 #ifdef S6145_YMC
12362 DYESUB_FEATURE_PLANE_INTERLACE |
12363 #endif
12364 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12365 &shinko_chcs6145_printer_init, &shinko_chcs2145_printer_end,
12366 NULL, NULL, /* No planes */
12367 NULL, NULL, /* No blocks */
12368 &shinko_chcs6145_overcoat_list, NULL,
12369 NULL, NULL,
12370 NULL, 0, NULL, NULL,
12371 },
12372 { /* Shinko/Sinfonia CHC-S2245 */
12373 5006,
12374 #ifdef S2245_YMC
12375 &ymc_ink_list,
12376 #else
12377 &rgb_ink_list,
12378 #endif
12379 &res_300dpi_list,
12380 &shinko_chcs2245_page_list,
12381 &shinko_chcs2245_printsize_list,
12382 SHRT_MAX,
12383 #ifdef S2245_YMC
12384 DYESUB_FEATURE_PLANE_INTERLACE |
12385 #endif
12386 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12387 &shinko_chcs2245_printer_init, &shinko_chcs2145_printer_end,
12388 NULL, NULL, /* No planes */
12389 NULL, NULL, /* No blocks */
12390 &shinko_chcs2245_overcoat_list, NULL,
12391 NULL, NULL,
12392 kodak6900_parameters,
12393 kodak6900_parameter_count,
12394 kodak6900_load_parameters,
12395 kodak6900_parse_parameters,
12396 },
12397 { /* Dai Nippon Printing DS40 */
12398 6000,
12399 &bgr_ink_list,
12400 &res_dnpds40_dpi_list,
12401 &dnpds40_page_list,
12402 &dnpds40_printsize_list,
12403 SHRT_MAX,
12404 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
12405 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12406 &dnpds40_printer_start, &dnpds40_printer_end,
12407 &dnpds40_plane_init, NULL,
12408 NULL, NULL,
12409 &dnpds40_overcoat_list, NULL,
12410 NULL, NULL,
12411 ds40_parameters,
12412 ds40_parameter_count,
12413 ds40_load_parameters,
12414 ds40_parse_parameters,
12415 },
12416 { /* Dai Nippon Printing DS80 */
12417 6001,
12418 &bgr_ink_list,
12419 &res_dnpds40_dpi_list,
12420 &dnpds80_page_list,
12421 &dnpds80_printsize_list,
12422 SHRT_MAX,
12423 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
12424 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12425 &dnpds80_printer_start, &dnpds40_printer_end,
12426 &dnpds40_plane_init, NULL,
12427 NULL, NULL,
12428 &dnpds40_overcoat_list, NULL,
12429 NULL, NULL,
12430 ds40_parameters,
12431 ds40_parameter_count,
12432 ds40_load_parameters,
12433 dnpds80_parse_parameters,
12434 },
12435 { /* Dai Nippon Printing DSRX1 */
12436 6002,
12437 &bgr_ink_list,
12438 &res_dnpds40_dpi_list,
12439 &dnpsrx1_page_list,
12440 &dnpsrx1_printsize_list,
12441 SHRT_MAX,
12442 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
12443 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12444 &dnpdsrx1_printer_start, &dnpds40_printer_end,
12445 &dnpds40_plane_init, NULL,
12446 NULL, NULL,
12447 &dnpds40_overcoat_list, NULL,
12448 NULL, NULL,
12449 ds40_parameters,
12450 ds40_parameter_count,
12451 ds40_load_parameters,
12452 ds40_parse_parameters,
12453 },
12454 { /* Dai Nippon Printing DS620 */
12455 6003,
12456 &bgr_ink_list,
12457 &res_dnpds40_dpi_list,
12458 &dnpds620_page_list,
12459 &dnpds620_printsize_list,
12460 SHRT_MAX,
12461 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
12462 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12463 &dnpds620_printer_start, &dnpds40_printer_end,
12464 &dnpds40_plane_init, NULL,
12465 NULL, NULL,
12466 &dnpds620_overcoat_list, NULL,
12467 NULL, NULL,
12468 ds40_parameters,
12469 ds40_parameter_count,
12470 ds40_load_parameters,
12471 ds40_parse_parameters,
12472 },
12473 { /* Citizen CW-01 */
12474 6005,
12475 &bgr_ink_list,
12476 &res_citizen_cw01_dpi_list,
12477 &citizen_cw01_page_list,
12478 &citizen_cw01_printsize_list,
12479 SHRT_MAX,
12480 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
12481 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12482 &citizen_cw01_printer_start, &dnpds40_printer_end,
12483 &dnpds40_plane_init, NULL,
12484 NULL, NULL,
12485 NULL, NULL,
12486 NULL, NULL,
12487 NULL, 0, NULL, NULL,
12488 },
12489 { /* Dai Nippon Printing DS80DX */
12490 6006,
12491 &bgr_ink_list,
12492 &res_dnpds40_dpi_list,
12493 &dnpds80dx_page_list,
12494 &dnpds80dx_printsize_list,
12495 SHRT_MAX,
12496 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
12497 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_DUPLEX | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12498 &dnpds80_printer_start, &dnpds40_printer_end,
12499 &dnpds40_plane_init, NULL,
12500 NULL, NULL,
12501 &dnpds40_overcoat_list, &dnpds80dx_media_list,
12502 NULL, NULL,
12503 ds40_parameters,
12504 ds40_parameter_count,
12505 ds40_load_parameters,
12506 dnpds80dx_parse_parameters,
12507 },
12508 { /* Dai Nippon Printing DS820 */
12509 6007,
12510 &bgr_ink_list,
12511 &res_dnpds40_dpi_list,
12512 &dnpds820_page_list,
12513 &dnpds820_printsize_list,
12514 SHRT_MAX,
12515 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
12516 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND ,
12517 &dnpds820_printer_start, &dnpds40_printer_end,
12518 &dnpds40_plane_init, NULL,
12519 NULL, NULL,
12520 &dnpds620_overcoat_list, NULL,
12521 NULL, NULL,
12522 ds820_parameters,
12523 ds820_parameter_count,
12524 ds820_load_parameters,
12525 ds820_parse_parameters,
12526 },
12527 { /* Dai Nippon Printing QW410 */
12528 6008,
12529 &bgr_ink_list,
12530 &res_300dpi_list,
12531 &dnp_qw410_page_list,
12532 &dnp_qw410_printsize_list,
12533 SHRT_MAX,
12534 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
12535 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND ,
12536 &dnp_qw410_printer_start, &dnpds40_printer_end,
12537 &dnpds40_plane_init, NULL,
12538 NULL, NULL,
12539 &dnp_qw410_overcoat_list, NULL,
12540 NULL, NULL,
12541 qw410_parameters,
12542 qw410_parameter_count,
12543 qw410_load_parameters,
12544 qw410_parse_parameters,
12545 },
12546 { /* HiTi P520L/P525L */
12547 6500,
12548 &bgr_ink_list,
12549 &res_300dpi_list,
12550 &hiti_p520l_page_list,
12551 &hiti_p520l_printsize_list,
12552 SHRT_MAX,
12553 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
12554 | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12555 &hiti_p520l_printer_start, NULL,
12556 NULL, NULL,
12557 NULL, NULL,
12558 &hiti_p520l_overcoat_list, NULL,
12559 NULL, NULL,
12560 hiti_p520l_parameters,
12561 hiti_p520l_parameter_count,
12562 hiti_p520l_load_parameters,
12563 hiti_p520l_parse_parameters,
12564 },
12565 { /* HiTi P720L/P750L */
12566 6501,
12567 &bgr_ink_list,
12568 &res_300dpi_list,
12569 &hiti_p520l_page_list,
12570 &hiti_p520l_printsize_list,
12571 SHRT_MAX,
12572 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
12573 | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12574 &hiti_p720l_printer_start, NULL,
12575 NULL, NULL,
12576 NULL, NULL,
12577 &hiti_p520l_overcoat_list, NULL,
12578 NULL, NULL,
12579 hiti_p720l_parameters,
12580 hiti_p720l_parameter_count,
12581 hiti_p720l_load_parameters,
12582 hiti_p720l_parse_parameters,
12583 },
12584 { /* HiTi P510/P518 series */
12585 6502,
12586 &bgr_ink_list,
12587 &res_301dpi_list,
12588 &hiti_p510l_page_list,
12589 &hiti_p510l_printsize_list,
12590 SHRT_MAX,
12591 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
12592 | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12593 &hiti_p510l_printer_start, NULL,
12594 NULL, NULL,
12595 NULL, NULL,
12596 &hiti_p520l_overcoat_list, NULL,
12597 NULL, NULL,
12598 hiti_p720l_parameters,
12599 hiti_p720l_parameter_count,
12600 hiti_p720l_load_parameters,
12601 hiti_p720l_parse_parameters,
12602 },
12603 { /* HiTi P461 Prinhome */
12604 6503,
12605 &bgr_ink_list,
12606 &res_300dpi_list,
12607 &hiti_p461_page_list,
12608 &hiti_p461_printsize_list,
12609 SHRT_MAX,
12610 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
12611 | DYESUB_FEATURE_WHITE_BORDER
12612 | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12613 &hiti_p461_printer_start, NULL,
12614 NULL, NULL,
12615 NULL, NULL,
12616 &hiti_p520l_overcoat_list, NULL,
12617 NULL, NULL,
12618 hiti_p461_parameters,
12619 hiti_p461_parameter_count,
12620 hiti_p461_load_parameters,
12621 hiti_p461_parse_parameters,
12622 },
12623 { /* HiTi P630 series */
12624 6504,
12625 &bgr_ink_list,
12626 &res_300dpi_list,
12627 &hiti_p520l_page_list,
12628 &hiti_p520l_printsize_list,
12629 SHRT_MAX,
12630 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
12631 | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12632 &hiti_p630_printer_start, NULL,
12633 NULL, NULL,
12634 NULL, NULL,
12635 &hiti_p520l_overcoat_list, NULL,
12636 NULL, NULL,
12637 hiti_p720l_parameters,
12638 hiti_p720l_parameter_count,
12639 hiti_p720l_load_parameters,
12640 hiti_p720l_parse_parameters,
12641 },
12642 { /* Magicard Series w/ Duplex */
12643 7000,
12644 &ymc_ink_list,
12645 &res_300dpi_list,
12646 &magicard_page_list,
12647 &magicard_printsize_list,
12648 SHRT_MAX,
12649 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
12650 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_DUPLEX | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12651 &magicard_printer_init, &magicard_printer_end,
12652 NULL, magicard_plane_end,
12653 NULL, NULL,
12654 &magicard_overcoat_list, NULL,
12655 NULL, NULL,
12656 magicard_parameters,
12657 magicard_parameter_count,
12658 magicard_load_parameters,
12659 magicard_parse_parameters,
12660 },
12661 { /* Magicard Series w/o Duplex */
12662 7001,
12663 &ymc_ink_list,
12664 &res_300dpi_list,
12665 &magicard_page_list,
12666 &magicard_printsize_list,
12667 SHRT_MAX,
12668 DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
12669 | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES | DYESUB_FEATURE_HASBACKEND,
12670 &magicard_printer_init, &magicard_printer_end,
12671 NULL, magicard_plane_end,
12672 NULL, NULL,
12673 &magicard_overcoat_list, NULL,
12674 NULL, NULL,
12675 magicard_parameters,
12676 magicard_parameter_count,
12677 magicard_load_parameters,
12678 magicard_parse_parameters,
12679 },
12680 };
12681
12682 static const stp_parameter_t the_parameters[] =
12683 {
12684 {
12685 "PageSize", N_("Page Size"), "Color=No,Category=Basic Printer Setup",
12686 N_("Size of the paper being printed to"),
12687 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_CORE,
12688 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
12689 },
12690 {
12691 "MediaType", N_("Media Type"), "Color=Yes,Category=Basic Printer Setup",
12692 N_("Type of media (plain paper, photo paper, etc.)"),
12693 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
12694 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
12695 },
12696 {
12697 "InputSlot", N_("Media Source"), "Color=No,Category=Basic Printer Setup",
12698 N_("Source (input slot) of the media"),
12699 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
12700 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
12701 },
12702 {
12703 "Resolution", N_("Resolution"), "Color=Yes,Category=Basic Printer Setup",
12704 N_("Resolution and quality of the print"),
12705 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
12706 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
12707 },
12708 {
12709 "InkType", N_("Ink Type"), "Color=Yes,Category=Advanced Printer Setup",
12710 N_("Type of ink in the printer"),
12711 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
12712 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
12713 },
12714 { /* TRANSLATORS: Some dye sublimation printers are able to achieve
12715 better durability of output by covering it with transparent
12716 overcoat surface. This surface can be of different patterns:
12717 common are matte, glossy or texture.
12718
12719 This is called "Laminate" instead of "Overcoat" for backwards
12720 compatibility reasons.
12721 */
12722 "Laminate", N_("Overcoat Pattern"), "Color=No,Category=Advanced Printer Setup",
12723 N_("Overcoat Pattern"),
12724 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
12725 STP_PARAMETER_LEVEL_BASIC, 1, 0, STP_CHANNEL_NONE, 1, 0
12726 },
12727 {
12728 "Borderless", N_("Borderless"), "Color=No,Category=Advanced Printer Setup",
12729 N_("Print without borders"),
12730 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
12731 STP_PARAMETER_LEVEL_BASIC, 1, 0, STP_CHANNEL_NONE, 1, 0
12732 },
12733 {
12734 "PrintingMode", N_("Printing Mode"), "Color=Yes,Category=Core Parameter",
12735 N_("Printing Output Mode"),
12736 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_CORE,
12737 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
12738 },
12739 {
12740 "Duplex", N_("Double-Sided Printing"), "Color=No,Category=Basic Printer Setup",
12741 N_("Duplex/Tumble Setting"),
12742 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
12743 STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
12744 },
12745 {
12746 "NativeCopies", N_("Printer Generates Copies Natively"), "Color=No,Category=Job Mode",
12747 N_("Printer Generates Copies"),
12748 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
12749 STP_PARAMETER_LEVEL_INTERNAL, 1, 0, STP_CHANNEL_NONE, 0, 1
12750 },
12751 {
12752 "Collate", N_("Collate the Job"), "Color=No,Category=Job Mode",
12753 N_("Collate the Job"),
12754 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_CORE,
12755 STP_PARAMETER_LEVEL_INTERNAL, 1, 0, STP_CHANNEL_NONE, 1, 0
12756 },
12757 {
12758 "LegacyDyesubGamma", N_("Use legacy dyesub gamma curve"), "Color=Yes,Category=Advanced Printer Setup",
12759 N_("Use legacy dyesub gamma curve"),
12760 STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
12761 STP_PARAMETER_LEVEL_ADVANCED, 1, 0, STP_CHANNEL_NONE, 1, 0
12762 },
12763 {
12764 "CommandFilterName", N_("Command filter name"), "Color=No,Category=Job Mode",
12765 N_("Command filter name"),
12766 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
12767 STP_PARAMETER_LEVEL_INTERNAL, 1, 0, STP_CHANNEL_NONE, 0, 1
12768 },
12769 {
12770 "CommandFilterCommands", N_("Filter commands supported"), "Color=No,Category=Job Mode",
12771 N_("Filter commands supported"),
12772 STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
12773 STP_PARAMETER_LEVEL_INTERNAL, 1, 0, STP_CHANNEL_NONE, 0, 1
12774 },
12775 };
12776
12777 static unsigned int the_parameter_count =
12778 sizeof(the_parameters) / sizeof(const stp_parameter_t);
12779
12780 typedef struct
12781 {
12782 const stp_parameter_t param;
12783 double min;
12784 double max;
12785 double defval;
12786 int color_only;
12787 } float_param_t;
12788
12789 static const float_param_t float_parameters[] =
12790 {
12791 {
12792 {
12793 "CyanDensity", N_("Cyan Balance"), N_("Output Level Adjustment"),
12794 N_("Adjust the cyan balance"),
12795 STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
12796 STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 1, 1, 0
12797 }, 0.0, 2.0, 1.0, 1
12798 },
12799 {
12800 {
12801 "MagentaDensity", N_("Magenta Balance"), N_("Output Level Adjustment"),
12802 N_("Adjust the magenta balance"),
12803 STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
12804 STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 2, 1, 0
12805 }, 0.0, 2.0, 1.0, 1
12806 },
12807 {
12808 {
12809 "YellowDensity", N_("Yellow Balance"), N_("Output Level Adjustment"),
12810 N_("Adjust the yellow balance"),
12811 STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
12812 STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 3, 1, 0
12813 }, 0.0, 2.0, 1.0, 1
12814 },
12815 {
12816 {
12817 "BlackDensity", N_("Black Balance"), N_("Output Level Adjustment"),
12818 N_("Adjust the black balance"),
12819 STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
12820 STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 0, 1, 0
12821 }, 0.0, 2.0, 1.0, 1
12822 },
12823 };
12824
12825 static const unsigned int float_parameter_count =
12826 sizeof(float_parameters) / sizeof(const float_param_t);
12827
12828 /*
12829 * Duplex support - modes available
12830 * Note that the internal names MUST match those in cups/genppd.c else the
12831 * PPD files will not be generated correctly
12832 */
12833
12834 static const stp_param_string_t duplex_types[] =
12835 {
12836 { "None", N_ ("Off") },
12837 { "DuplexNoTumble", N_ ("Long Edge (Standard)") },
12838 { "DuplexTumble", N_ ("Short Edge (Flip)") }
12839 };
12840 #define NUM_DUPLEX (sizeof (duplex_types) / sizeof (stp_param_string_t))
12841
12842 static const dyesub_cap_t* dyesub_get_model_capabilities(const stp_vars_t *v, int model)
12843 {
12844 int i;
12845 int models = sizeof(dyesub_model_capabilities) / sizeof(dyesub_cap_t);
12846
12847 for (i=0; i<models; i++)
12848 {
12849 if (dyesub_model_capabilities[i].model == model)
12850 return &(dyesub_model_capabilities[i]);
12851 }
12852 stp_dprintf(STP_DBG_DYESUB, v,
12853 "dyesub: model %d not found in capabilities list.\n", model);
12854 return &(dyesub_model_capabilities[0]);
12855 }
12856
12857 static const overcoat_t* dyesub_get_overcoat_pattern(stp_vars_t *v)
12858 {
12859 const char *lpar = stp_get_string_parameter(v, "Laminate");
12860 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
12861 stp_get_model_id(v));
12862 const overcoat_list_t *llist = caps->overcoat;
12863 const overcoat_t *l = NULL;
12864 unsigned int i;
12865
12866 for (i = 0; i < llist->n_items; i++)
12867 {
12868 l = &(llist->item[i]);
12869 if (strcmp(l->name, lpar) == 0)
12870 break;
12871 }
12872 return l;
12873 }
12874
12875 static const dyesub_media_t* dyesub_get_mediatype(stp_vars_t *v)
12876 {
12877 const char *mpar = stp_get_string_parameter(v, "MediaType");
12878 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
12879 stp_get_model_id(v));
12880 const dyesub_media_list_t *mlist = caps->media;
12881 const dyesub_media_t *m = NULL;
12882 unsigned int i;
12883
12884 for (i = 0; i < mlist->n_items; i++)
12885 {
12886 m = &(mlist->item[i]);
12887 if (strcmp(m->name, mpar) == 0)
12888 break;
12889 }
12890 return m;
12891 }
12892
12893 static void
12894 dyesub_printsize(const stp_vars_t *v,
12895 int *width,
12896 int *height)
12897 {
12898 unsigned int i;
12899 const char *page = stp_get_string_parameter(v, "PageSize");
12900 const char *resolution = stp_get_string_parameter(v, "Resolution");
12901 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
12902 stp_get_model_id(v));
12903 const dyesub_printsize_list_t *p = caps->printsize;
12904
12905 for (i = 0; i < p->n_items; i++)
12906 {
12907 if (strcmp(p->item[i].res_name,resolution) == 0 &&
12908 strcmp(p->item[i].pagesize_name,page) == 0)
12909 {
12910 *width = p->item[i].width_px;
12911 *height = p->item[i].height_px;
12912 return;
12913 }
12914 }
12915 stp_eprintf(v, "dyesub_printsize: printsize not found (%s, %s)\n",
12916 page, resolution);
12917 }
12918
12919 static int
12920 dyesub_feature(const dyesub_cap_t *caps, int feature)
12921 {
12922 return ((caps->features & feature) == feature);
12923 }
12924
12925 static stp_parameter_list_t
12926 dyesub_list_parameters(const stp_vars_t *v)
12927 {
12928 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v, stp_get_model_id(v));
12929
12930 stp_parameter_list_t *ret = stp_parameter_list_create();
12931 unsigned int i;
12932
12933 for (i = 0; i < the_parameter_count; i++)
12934 stp_parameter_list_add_param(ret, &(the_parameters[i]));
12935 for (i = 0; i < float_parameter_count; i++)
12936 stp_parameter_list_add_param(ret, &(float_parameters[i].param));
12937 if (caps->parameter_count && caps->parameters)
12938 for (i = 0; i < caps->parameter_count ; i++)
12939 stp_parameter_list_add_param(ret, &(caps->parameters[i]));
12940
12941 return ret;
12942 }
12943
12944 static void
12945 dyesub_parameters(const stp_vars_t *v, const char *name,
12946 stp_parameter_t *description)
12947 {
12948 unsigned int i;
12949 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
12950 stp_get_model_id(v));
12951
12952 description->p_type = STP_PARAMETER_TYPE_INVALID;
12953 if (name == NULL)
12954 return;
12955
12956 description->deflt.str = NULL;
12957 for (i = 0; i < float_parameter_count; i++)
12958 if (strcmp(name, float_parameters[i].param.name) == 0)
12959 {
12960 stp_fill_parameter_settings(description,
12961 &(float_parameters[i].param));
12962 description->deflt.dbl = float_parameters[i].defval;
12963 description->bounds.dbl.upper = float_parameters[i].max;
12964 description->bounds.dbl.lower = float_parameters[i].min;
12965 }
12966
12967 for (i = 0; i < the_parameter_count; i++)
12968 if (strcmp(name, the_parameters[i].name) == 0)
12969 {
12970 stp_fill_parameter_settings(description, &(the_parameters[i]));
12971 break;
12972 }
12973 if (caps->load_parameters) /* do *NOT* use dyesub_exec() here */
12974 {
12975 if (caps->load_parameters(v, name, description))
12976 return; /* Ie parameter handled */
12977 }
12978
12979 if (strcmp(name, "PageSize") == 0)
12980 {
12981 int default_specified = 0;
12982 const dyesub_pagesize_list_t *p = caps->pages;
12983
12984 description->bounds.str = stp_string_list_create();
12985
12986 /* Walk the list of pagesizes for the printer */
12987 for (i = 0; i < p->n_items; i++)
12988 {
12989 stp_string_list_add_string(description->bounds.str,
12990 p->item[i].psize.name,
12991 gettext(p->item[i].psize.text));
12992 if (! default_specified &&
12993 p->item[i].psize.width > 0 && p->item[i].psize.height > 0)
12994 {
12995 description->deflt.str = p->item[i].psize.name;
12996 default_specified = 1;
12997 }
12998 }
12999 if (!default_specified)
13000 description->deflt.str =
13001 stp_string_list_param(description->bounds.str, 0)->name;
13002 }
13003 else if (strcmp(name, "MediaType") == 0)
13004 {
13005 description->bounds.str = stp_string_list_create();
13006 if (caps->media) {
13007 const dyesub_media_list_t *mlist = caps->media;
13008
13009 for (i = 0; i < mlist->n_items; i++)
13010 {
13011 const dyesub_media_t *m = &(mlist->item[i]);
13012 stp_string_list_add_string(description->bounds.str,
13013 m->name, gettext(m->text));
13014 }
13015 description->deflt.str =
13016 stp_string_list_param(description->bounds.str, 0)->name;
13017 description->is_active = 1;
13018 } else {
13019 description->is_active = 0;
13020 }
13021 }
13022 else if (strcmp(name, "Resolution") == 0)
13023 {
13024 char res_text[24];
13025 const dyesub_resolution_list_t *r = caps->resolution;
13026
13027 description->bounds.str = stp_string_list_create();
13028 for (i = 0; i < r->n_items; i++)
13029 {
13030 sprintf(res_text, "%s DPI", r->item[i].name);
13031 stp_string_list_add_string(description->bounds.str,
13032 r->item[i].name, gettext(res_text));
13033 }
13034 if (r->n_items < 1)
13035 description->is_active = 0;
13036 description->deflt.str =
13037 stp_string_list_param(description->bounds.str, 0)->name;
13038 }
13039 else if (strcmp(name, "InkType") == 0)
13040 {
13041 description->bounds.str = stp_string_list_create();
13042 for (i = 0; i < caps->inks->n_items; i++)
13043 stp_string_list_add_string(description->bounds.str,
13044 caps->inks->item[i].name, gettext(caps->inks->item[i].name));
13045 description->deflt.str =
13046 stp_string_list_param(description->bounds.str, 0)->name;
13047 if (caps->inks->n_items < 2)
13048 description->is_active = 0;
13049 }
13050 else if (strcmp(name, "Laminate") == 0)
13051 {
13052 description->bounds.str = stp_string_list_create();
13053 if (caps->overcoat)
13054 {
13055 const overcoat_list_t *llist = caps->overcoat;
13056
13057 for (i = 0; i < llist->n_items; i++)
13058 {
13059 const overcoat_t *l = &(llist->item[i]);
13060 stp_string_list_add_string(description->bounds.str,
13061 l->name, gettext(l->text));
13062 }
13063 description->deflt.str =
13064 stp_string_list_param(description->bounds.str, 0)->name;
13065 description->is_active = 1;
13066 } else {
13067 description->is_active = 0;
13068 }
13069 }
13070 else if (strcmp(name, "Borderless") == 0)
13071 {
13072 if (dyesub_feature(caps, DYESUB_FEATURE_BORDERLESS))
13073 description->is_active = 1;
13074 }
13075 else if (strcmp(name, "PrintingMode") == 0)
13076 {
13077 description->bounds.str = stp_string_list_create();
13078 if (dyesub_feature(caps, DYESUB_FEATURE_MONOCHROME))
13079 stp_string_list_add_string(description->bounds.str,
13080 "BW", _("Black and White"));
13081 else
13082 stp_string_list_add_string(description->bounds.str,
13083 "Color", _("Color"));
13084 description->deflt.str =
13085 stp_string_list_param(description->bounds.str, 0)->name;
13086 }
13087 else if (strcmp(name, "Duplex") == 0)
13088 {
13089 int offer_duplex=0;
13090
13091 description->bounds.str = stp_string_list_create();
13092
13093 /*
13094 * Don't offer the Duplex/Tumble options if the JobMode parameter is
13095 * set to "Page" Mode.
13096 * "Page" mode is set by the Gimp Plugin, which only outputs one page at a
13097 * time, so Duplex/Tumble is meaningless.
13098 */
13099
13100 if (stp_get_string_parameter(v, "JobMode"))
13101 offer_duplex = strcmp(stp_get_string_parameter(v, "JobMode"), "Page");
13102 else
13103 offer_duplex=1;
13104
13105 if (offer_duplex && dyesub_feature(caps, DYESUB_FEATURE_DUPLEX))
13106 {
13107 description->deflt.str = duplex_types[0].name;
13108 for (i=0; i < NUM_DUPLEX; i++)
13109 {
13110 stp_string_list_add_string(description->bounds.str,
13111 duplex_types[i].name,gettext(duplex_types[i].text));
13112 }
13113 }
13114 else
13115 description->is_active = 0;
13116 }
13117 else if (strcmp(name, "NativeCopies") == 0)
13118 {
13119 description->deflt.boolean = dyesub_feature(caps, DYESUB_FEATURE_NATIVECOPIES);
13120 description->is_active = 1;
13121 }
13122 else if (strcmp(name, "Collate") == 0)
13123 {
13124 if (dyesub_feature(caps, DYESUB_FEATURE_NATIVECOPIES) && dyesub_feature(caps, DYESUB_FEATURE_HASBACKEND))
13125 {
13126 description->deflt.boolean = 1;
13127 description->is_active = 1;
13128 }
13129 }
13130 else if (strcmp(name, "LegacyDyesubGamma") == 0)
13131 {
13132 #ifdef USE_WRONG_APPGAMMA_BY_DEFAULT
13133 description->deflt.boolean = 1;
13134 #else
13135 description->deflt.boolean = 0;
13136 #endif
13137 description->is_active = 1;
13138 }
13139 else if (strcmp(name, "CommandFilterName") == 0)
13140 {
13141 if (dyesub_feature(caps, DYESUB_FEATURE_HASBACKEND))
13142 {
13143 description->bounds.str = stp_string_list_create();
13144 stp_string_list_add_string(description->bounds.str,
13145 "commandtodyesub", _("commandtodyesub"));
13146 description->is_active = 1;
13147 } else {
13148 description->is_active = 0;
13149 }
13150 }
13151 else if (strcmp(name, "CommandFilterCommands") == 0)
13152 {
13153 if (dyesub_feature(caps, DYESUB_FEATURE_HASBACKEND))
13154 {
13155 description->bounds.str = stp_string_list_create();
13156 stp_string_list_add_string(description->bounds.str,
13157 "ReportLevels", _("Report levels"));
13158 /* Not yet */
13159 // stp_string_list_add_string(description->bounds.str,
13160 // "AutoConfigure", _("Auto configure"));
13161 description->is_active = 1;
13162 } else {
13163 description->is_active = 0;
13164 }
13165 }
13166 else
13167 description->is_active = 0;
13168 }
13169
13170
13171 static const dyesub_pagesize_t*
13172 dyesub_get_pagesize(const stp_vars_t *v, const char *page)
13173 {
13174 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
13175 stp_get_model_id(v));
13176 const dyesub_pagesize_list_t *p = caps->pages;
13177 unsigned int i;
13178 if (page == NULL)
13179 return NULL;
13180
13181 for (i = 0; i < p->n_items; i++)
13182 {
13183 if (strcmp(p->item[i].psize.name,page) == 0)
13184 return &(p->item[i]);
13185 }
13186 return NULL;
13187 }
13188
13189 static const dyesub_pagesize_t*
13190 dyesub_current_pagesize(const stp_vars_t *v)
13191 {
13192 const char *page = stp_get_string_parameter(v, "PageSize");
13193 return dyesub_get_pagesize(v, page);
13194 }
13195
13196 static const stp_papersize_t *
13197 dyesub_describe_papersize(const stp_vars_t *v, const char *name)
13198 {
13199 const dyesub_pagesize_t *pagesize = dyesub_get_pagesize(v, name);
13200 if (pagesize)
13201 return &(pagesize->psize);
13202 else
13203 return NULL;
13204 }
13205
13206 static void
13207 dyesub_media_size(const stp_vars_t *v,
13208 stp_dimension_t *width,
13209 stp_dimension_t *height)
13210 {
13211 const dyesub_pagesize_t *pt = dyesub_current_pagesize(v);
13212 stp_default_media_size(v, width, height);
13213
13214 if (pt && pt->psize.width > 0)
13215 *width = pt->psize.width;
13216 if (pt && pt->psize.height > 0)
13217 *height = pt->psize.height;
13218 }
13219
13220 static void
13221 dyesub_imageable_area_internal(const stp_vars_t *v,
13222 int use_maximum_area,
13223 stp_dimension_t *left,
13224 stp_dimension_t *right,
13225 stp_dimension_t *bottom,
13226 stp_dimension_t *top,
13227 int *print_mode)
13228 {
13229 stp_dimension_t width, height;
13230 const dyesub_pagesize_t *pt = dyesub_current_pagesize(v);
13231 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
13232 stp_get_model_id(v));
13233
13234 dyesub_media_size(v, &width, &height);
13235 if (use_maximum_area
13236 || (dyesub_feature(caps, DYESUB_FEATURE_BORDERLESS) &&
13237 stp_get_boolean_parameter(v, "Borderless"))
13238 || !pt)
13239 {
13240 *left = 0;
13241 *top = 0;
13242 *right = width;
13243 *bottom = height;
13244 }
13245 else
13246 {
13247 *left = pt->psize.left;
13248 *top = pt->psize.top;
13249 *right = width - pt->psize.right;
13250 *bottom = height - pt->psize.bottom;
13251 }
13252 if (pt)
13253 *print_mode = pt->print_mode;
13254 else
13255 *print_mode = DYESUB_PORTRAIT;
13256 }
13257
13258 static void
13259 dyesub_imageable_area(const stp_vars_t *v,
13260 stp_dimension_t *left,
13261 stp_dimension_t *right,
13262 stp_dimension_t *bottom,
13263 stp_dimension_t *top)
13264 {
13265 int not_used;
13266 dyesub_imageable_area_internal(v, 0, left, right, bottom, top, &not_used);
13267 }
13268
13269 static void
13270 dyesub_maximum_imageable_area(const stp_vars_t *v,
13271 stp_dimension_t *left,
13272 stp_dimension_t *right,
13273 stp_dimension_t *bottom,
13274 stp_dimension_t *top)
13275 {
13276 int not_used;
13277 const int model = stp_get_model_id(v);
13278 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v, model);
13279
13280 /* For printers that report FEATURE_WHITE_BORDER, we need to
13281 respect the margins they define as that's the printable area.
13282 The SELPHY models support FEATURE_BORDERLESS as well, so handle
13283 that special case. */
13284
13285 dyesub_imageable_area_internal(v,
13286 (!(dyesub_feature(caps, DYESUB_FEATURE_WHITE_BORDER) &&
13287 !dyesub_feature(caps, DYESUB_FEATURE_BORDERLESS))),
13288 left, right, bottom, top, &not_used);
13289 }
13290
13291 static void
13292 dyesub_limit(const stp_vars_t *v, /* I */
13293 stp_dimension_t *width, stp_dimension_t *height,
13294 stp_dimension_t *min_width, stp_dimension_t *min_height)
13295 {
13296 (void)v;
13297 *width = SHRT_MAX;
13298 *height = SHRT_MAX;
13299 *min_width = 1;
13300 *min_height = 1;
13301 }
13302
13303 static void
13304 dyesub_describe_resolution(const stp_vars_t *v,
13305 stp_resolution_t *x, stp_resolution_t *y)
13306 {
13307 const char *resolution = stp_get_string_parameter(v, "Resolution");
13308 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
13309 stp_get_model_id(v));
13310 const dyesub_resolution_list_t *r = caps->resolution;
13311 unsigned int i;
13312
13313 *x = -1;
13314 *y = -1;
13315 if (resolution)
13316 {
13317 for (i = 0; i < r->n_items; i++)
13318 {
13319 if (strcmp(resolution, r->item[i].name) == 0)
13320 {
13321 *x = r->item[i].w_dpi;
13322 *y = r->item[i].h_dpi;
13323 break;
13324 }
13325 }
13326 }
13327 return;
13328 }
13329
13330 static const char *
13331 dyesub_describe_output_internal(const stp_vars_t *v, dyesub_print_vars_t *pv)
13332 {
13333 const char *ink_type = stp_get_string_parameter(v, "InkType");
13334 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
13335 stp_get_model_id(v));
13336 const char *output_type;
13337 unsigned int i;
13338
13339 pv->ink_channels = 1;
13340 pv->ink_order = "\1";
13341 output_type = "CMY";
13342
13343 if (ink_type)
13344 {
13345 for (i = 0; i < caps->inks->n_items; i++)
13346 if (strcmp(ink_type, caps->inks->item[i].name) == 0)
13347 {
13348 output_type = caps->inks->item[i].output_type;
13349 pv->ink_channels = caps->inks->item[i].output_channels;
13350 pv->ink_order = caps->inks->item[i].channel_order;
13351 break;
13352 }
13353 }
13354
13355 return output_type;
13356 }
13357
13358 static const char *
13359 dyesub_describe_output(const stp_vars_t *v)
13360 {
13361 dyesub_print_vars_t ipv;
13362 return dyesub_describe_output_internal(v, &ipv);
13363 }
13364
13365 #define NPUTC_BUFSIZE (512)
13366
13367 static void
13368 dyesub_nputc(stp_vars_t *v, char byte, int count)
13369 {
13370 char buf[NPUTC_BUFSIZE];
13371
13372 if (count == 1)
13373 stp_putc(byte, v);
13374 else
13375 {
13376 int i;
13377 int size = count;
13378 int blocks = size / NPUTC_BUFSIZE;
13379 int leftover = size % NPUTC_BUFSIZE;
13380 if (size > NPUTC_BUFSIZE)
13381 size = NPUTC_BUFSIZE;
13382 (void) memset(buf, byte, size);
13383 if (blocks)
13384 for (i = 0; i < blocks; i++)
13385 stp_zfwrite(buf, size, 1, v);
13386 if (leftover)
13387 stp_zfwrite(buf, leftover, 1, v);
13388 }
13389 }
13390
13391 static void
13392 dyesub_swap_ints(int *a, int *b)
13393 {
13394 int t = *a;
13395 *a = *b;
13396 *b = t;
13397 }
13398
13399 static void
13400 dyesub_exec(stp_vars_t *v,
13401 void (*func)(stp_vars_t *),
13402 const char *debug_string)
13403 {
13404 if (func)
13405 {
13406 stp_dprintf(STP_DBG_DYESUB, v, "dyesub: %s\n", debug_string);
13407 (*func)(v);
13408 }
13409 }
13410
13411 static int
13412 dyesub_exec_check(stp_vars_t *v,
13413 int (*func)(stp_vars_t *),
13414 const char *debug_string)
13415 {
13416 if (func)
13417 {
13418 stp_dprintf(STP_DBG_DYESUB, v, "dyesub: %s\n", debug_string);
13419 return (*func)(v);
13420 }
13421 return 1;
13422 }
13423
13424 /* XXX FIXME: This is "point" interpolation. Be smarter!
13425 eg: Average (average all pixels that touch this one)
13426 BiLinear (scale based on linear interpolation)
13427 BiCubic (scale based on weighted average, based on proximity)
13428 Lanczos (awesome!! but slow)
13429 */
13430 static int
13431 dyesub_interpolate(int point, int olddim, int newdim)
13432 {
13433 #if 0
13434 /* Perform arithematic rounding. Is there a point? */
13435 int result = ((point * 2 * newdim / olddim) + 1) / 2;
13436 if (result >= newdim)
13437 result--;
13438 #else
13439 int result = (point * newdim / olddim);
13440 #endif
13441
13442 return result;
13443 }
13444
13445 static void
13446 dyesub_free_image(dyesub_print_vars_t *pv, stp_image_t *image)
13447 {
13448 unsigned short** image_data = pv->image_data;
13449 int image_px_height = pv->image_rows;
13450 int i;
13451 (void)image;
13452
13453 for (i = 0; i< image_px_height; i++)
13454 if (image_data[i])
13455 stp_free(image_data[i]);
13456 if (image_data)
13457 stp_free(image_data);
13458 }
13459
13460 static unsigned short **
13461 dyesub_read_image(stp_vars_t *v,
13462 dyesub_print_vars_t *pv,
13463 stp_image_t *image)
13464 {
13465 int image_px_width = stp_image_width(image);
13466 int image_px_height = stp_image_height(image);
13467 int row_size = image_px_width * pv->ink_channels * sizeof(short);
13468 unsigned short **image_data;
13469 unsigned int zero_mask;
13470 int i;
13471
13472 image_data = stp_zalloc(image_px_height * sizeof(unsigned short *));
13473 pv->image_rows = 0;
13474 if (!image_data)
13475 return NULL; /* ? out of memory ? */
13476
13477 for (i = 0; i < image_px_height; i++)
13478 {
13479 if (stp_color_get_row(v, image, i, &zero_mask))
13480 {
13481 stp_dprintf(STP_DBG_DYESUB, v,
13482 "dyesub_read_image: "
13483 "stp_color_get_row(..., %d, ...) == 0\n", i);
13484 dyesub_free_image(pv, image);
13485 return NULL;
13486 }
13487 image_data[i] = stp_malloc(row_size);
13488 pv->image_rows = i+1;
13489 if (!image_data[i])
13490 {
13491 stp_dprintf(STP_DBG_DYESUB, v,
13492 "dyesub_read_image: "
13493 "(image_data[%d] = stp_malloc()) == NULL\n", i);
13494 dyesub_free_image(pv, image);
13495 return NULL;
13496 }
13497 memcpy(image_data[i], stp_channel_get_output(v), row_size);
13498 }
13499 return image_data;
13500 }
13501
13502 static void
13503 dyesub_render_pixel_u8(unsigned short *src, char *dest,
13504 dyesub_print_vars_t *pv,
13505 int plane)
13506 {
13507 (void)pv;
13508 /* Scale down to output bit depth */
13509 *dest = src[plane] / 257;
13510 }
13511
13512 static void
13513 dyesub_render_pixel_packed_u8(unsigned short *src, char *dest,
13514 dyesub_print_vars_t *pv)
13515 {
13516 int i;
13517
13518 /* copy out_channel (image) to equiv ink_channel (printer) */
13519 for (i = 0; i < pv->ink_channels; i++)
13520 {
13521 dyesub_render_pixel_u8(src, dest + i, pv, pv->ink_order[i]-1);
13522 }
13523 }
13524
13525 static void
13526 dyesub_render_row_packed_u8(stp_vars_t *v,
13527 dyesub_print_vars_t *pv,
13528 const dyesub_cap_t *caps,
13529 int in_row,
13530 char *dest,
13531 int bytes_per_pixel)
13532 {
13533 int w;
13534 unsigned short *src;
13535 (void)v;
13536 (void)caps;
13537
13538 for (w = 0; w < pv->outw_px; w++)
13539 {
13540 int row = in_row;
13541 int col = dyesub_interpolate(w, pv->outw_px, pv->imgw_px);
13542 if (pv->plane_lefttoright)
13543 col = pv->imgw_px - col - 1;
13544 if (pv->print_mode == DYESUB_LANDSCAPE)
13545 { /* "rotate" image */
13546 dyesub_swap_ints(&col, &row);
13547 row = (pv->imgw_px - 1) - row;
13548 }
13549 src = &(pv->image_data[row][col * pv->out_channels]);
13550
13551 dyesub_render_pixel_packed_u8(src, dest + w*bytes_per_pixel, pv);
13552 }
13553 }
13554
13555 static void
13556 dyesub_render_row_interlaced_u8(stp_vars_t *v,
13557 dyesub_print_vars_t *pv,
13558 const dyesub_cap_t *caps,
13559 int in_row,
13560 char *dest,
13561 int plane)
13562 {
13563 int w;
13564 unsigned short *src;
13565 (void)v;
13566 (void)caps;
13567
13568 for (w = 0; w < pv->outw_px; w++)
13569 {
13570 int row = in_row;
13571 int col = dyesub_interpolate(w, pv->outw_px, pv->imgw_px);
13572 if (pv->plane_lefttoright)
13573 col = pv->imgw_px - col - 1;
13574 if (pv->print_mode == DYESUB_LANDSCAPE)
13575 { /* "rotate" image */
13576 dyesub_swap_ints(&col, &row);
13577 row = (pv->imgw_px - 1) - row;
13578 }
13579 src = &(pv->image_data[row][col * pv->out_channels]);
13580
13581 dyesub_render_pixel_u8(src, dest + w, pv, plane);
13582 }
13583 }
13584
13585 static int
13586 dyesub_print_plane(stp_vars_t *v,
13587 dyesub_print_vars_t *pv,
13588 dyesub_privdata_t *pd,
13589 const dyesub_cap_t *caps,
13590 int plane)
13591 {
13592 int h;
13593 int bpp = ((pv->plane_interlacing || pv->row_interlacing) ? 1 : pv->ink_channels);
13594 size_t rowlen = pv->prnw_px * bpp;
13595 char *destrow = stp_malloc(rowlen); /* Allocate a buffer for the rendered rows */
13596 if (!destrow)
13597 return 0; /* ? out of memory ? */
13598
13599 /* Pre-Fill in the blank bits of the row. */
13600 if (dyesub_feature(caps, DYESUB_FEATURE_FULL_WIDTH))
13601 {
13602 /* empty part left of image area */
13603 if (pv->outl_px > 0)
13604 {
13605 memset(destrow, pv->empty_byte[plane], bpp * pv->outl_px);
13606 }
13607 /* empty part right of image area */
13608 if (pv->outr_px < pv->prnw_px)
13609 {
13610 memset(destrow + rowlen - bpp * (pv->prnw_px - pv->outr_px),
13611 pv->empty_byte[plane],
13612 bpp * (pv->prnw_px - pv->outr_px));
13613 }
13614 }
13615
13616 for (h = 0; h <= pv->prnb_px - pv->prnt_px; h++)
13617 {
13618 int p = pv->row_interlacing ? 0 : plane;
13619
13620 do {
13621
13622 if (h % caps->block_size == 0)
13623 { /* block init */
13624 pd->block_min_h = h + pv->prnt_px;
13625 pd->block_min_w = pv->prnl_px;
13626 pd->block_max_h = MIN(h + pv->prnt_px + caps->block_size - 1,
13627 pv->prnb_px);
13628 pd->block_max_w = pv->prnr_px;
13629
13630 dyesub_exec(v, caps->block_init_func, "caps->block_init");
13631 }
13632
13633 /* Generate a single row */
13634 if (h + pv->prnt_px < pv->outt_px || h + pv->prnt_px >= pv->outb_px)
13635 { /* empty part above or below image area */
13636 memset(destrow, pv->empty_byte[plane], rowlen);
13637 /* FIXME: This is inefficient; it won't change once generated.. */
13638 }
13639 else
13640 {
13641 int srcrow = dyesub_interpolate(h + pv->prnt_px - pv->outt_px,
13642 pv->outh_px, pv->imgh_px);
13643
13644 stp_dprintf(STP_DBG_DYESUB, v,
13645 "dyesub_print_plane: h = %d, row = %d\n", h, srcrow);
13646
13647 if (pv->plane_interlacing || pv->row_interlacing)
13648 {
13649 dyesub_render_row_interlaced_u8(v, pv, caps, srcrow,
13650 destrow + bpp * pv->outl_px, p);
13651 }
13652 else
13653 dyesub_render_row_packed_u8(v, pv, caps, srcrow,
13654 destrow + bpp * pv->outl_px, bpp);
13655 }
13656 /* And send it out */
13657 stp_zfwrite(destrow, rowlen, 1, v);
13658
13659 if (h + pv->prnt_px == pd->block_max_h)
13660 { /* block end */
13661 dyesub_exec(v, caps->block_end_func, "caps->block_end");
13662 }
13663
13664 } while (pv->row_interlacing && ++p < pv->ink_channels);
13665 }
13666
13667 stp_free(destrow);
13668 return 1;
13669 }
13670
13671 /*
13672 * dyesub_print()
13673 */
13674 static int
13675 dyesub_do_print(stp_vars_t *v, stp_image_t *image, int print_op)
13676 {
13677 int i;
13678 dyesub_print_vars_t pv;
13679 int status = 1;
13680
13681 const int model = stp_get_model_id(v);
13682 const char *ink_type;
13683 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v, model);
13684 int max_print_px_width = 0;
13685 int max_print_px_height = 0;
13686 int w_dpi, h_dpi;
13687 stp_resolution_t wr_dpi, hr_dpi; /* Resolution */
13688
13689 /* output in 1/72" */
13690 stp_dimension_t out_pt_width = stp_get_width(v);
13691 stp_dimension_t out_pt_height = stp_get_height(v);
13692 stp_dimension_t out_pt_left = stp_get_left(v);
13693 stp_dimension_t out_pt_top = stp_get_top(v);
13694
13695 /* page in 1/72" */
13696 stp_dimension_t page_pt_width = stp_get_page_width(v);
13697 stp_dimension_t page_pt_height = stp_get_page_height(v);
13698 stp_dimension_t page_pt_left = 0;
13699 stp_dimension_t page_pt_right = 0;
13700 stp_dimension_t page_pt_top = 0;
13701 stp_dimension_t page_pt_bottom = 0;
13702 int page_mode;
13703
13704 int pl;
13705
13706 dyesub_privdata_t *pd;
13707
13708 if (!stp_verify(v))
13709 {
13710 stp_eprintf(v, _("Print options not verified; cannot print.\n"));
13711 return 0;
13712 }
13713
13714 /* Clean up private state */
13715 (void) memset(&pv, 0, sizeof(pv));
13716
13717 /* Allocate privdata structure */
13718 pd = stp_zalloc(sizeof(dyesub_privdata_t));
13719 stp_allocate_component_data(v, "Driver", NULL, NULL, pd);
13720
13721 /* Parse any per-printer parameters *before* the generic ones */
13722 dyesub_exec_check(v, caps->parse_parameters, "caps->parse_parameters");
13723
13724 stp_image_init(image);
13725 pv.imgw_px = stp_image_width(image);
13726 pv.imgh_px = stp_image_height(image);
13727
13728 stp_describe_resolution(v, &wr_dpi, &hr_dpi);
13729 w_dpi = (int) wr_dpi;
13730 h_dpi = (int) hr_dpi;
13731 dyesub_printsize(v, &max_print_px_width, &max_print_px_height);
13732
13733 /* Duplex processing -- Rotate even pages for DuplexNoTumble */
13734 pd->duplex_mode = stp_get_string_parameter(v, "Duplex");
13735 pd->page_number = stp_get_int_parameter(v, "PageNumber");
13736 if((pd->page_number & 1) && pd->duplex_mode && !strcmp(pd->duplex_mode,"DuplexNoTumble"))
13737 image = stpi_buffer_image(image,BUFFER_FLAG_FLIP_X | BUFFER_FLAG_FLIP_Y);
13738
13739 /* Check to see if we're to generate more than one copy */
13740 if (stp_check_boolean_parameter(v, "NativeCopies", STP_PARAMETER_ACTIVE) &&
13741 stp_get_boolean_parameter(v, "NativeCopies") &&
13742 stp_check_int_parameter(v, "NumCopies", STP_PARAMETER_ACTIVE))
13743 pd->copies = stp_get_int_parameter(v, "NumCopies");
13744 else
13745 pd->copies = 1;
13746 /* FIXME: What about Collation? Any special handling here? */
13747
13748 pd->pagesize = stp_get_string_parameter(v, "PageSize");
13749 if (caps->overcoat)
13750 pd->overcoat = dyesub_get_overcoat_pattern(v);
13751 if (caps->media)
13752 pd->media = dyesub_get_mediatype(v);
13753
13754 dyesub_imageable_area_internal(v,
13755 (dyesub_feature(caps, DYESUB_FEATURE_WHITE_BORDER) ? 1 : 0),
13756 &page_pt_left, &page_pt_right, &page_pt_bottom, &page_pt_top,
13757 &page_mode);
13758
13759 /* Swap DPI so these computations will work out properly */
13760 if (page_mode == DYESUB_LANDSCAPE)
13761 dyesub_swap_ints(&w_dpi, &h_dpi);
13762
13763 pv.prnw_px = MIN(max_print_px_width,
13764 PX(page_pt_right - page_pt_left, w_dpi));
13765 pv.prnh_px = MIN(max_print_px_height,
13766 PX(page_pt_bottom - page_pt_top, h_dpi));
13767 pv.outw_px = PX(out_pt_width, w_dpi);
13768 pv.outh_px = PX(out_pt_height, h_dpi);
13769
13770 /* if image size is close enough to output size send out original size */
13771 if (abs(pv.outw_px - pv.imgw_px) < SIZE_THRESHOLD)
13772 pv.outw_px = pv.imgw_px;
13773 if (abs(pv.outh_px - pv.imgh_px) < SIZE_THRESHOLD)
13774 pv.outh_px = pv.imgh_px;
13775
13776 pv.outw_px = MIN(pv.outw_px, pv.prnw_px);
13777 pv.outh_px = MIN(pv.outh_px, pv.prnh_px);
13778 pv.outl_px = MIN(PX(out_pt_left - page_pt_left, w_dpi),
13779 pv.prnw_px - pv.outw_px);
13780 pv.outt_px = MIN(PX(out_pt_top - page_pt_top, h_dpi),
13781 pv.prnh_px - pv.outh_px);
13782 pv.outr_px = pv.outl_px + pv.outw_px;
13783 pv.outb_px = pv.outt_px + pv.outh_px;
13784
13785 /* Swap back so that everything that follows will work. */
13786 if (page_mode == DYESUB_LANDSCAPE)
13787 dyesub_swap_ints(&w_dpi, &h_dpi);
13788
13789 stp_dprintf(STP_DBG_DYESUB, v,
13790 "paper (pt) %f x %f\n"
13791 "image (px) %d x %d\n"
13792 "image (pt) %f x %f\n"
13793 "* out (pt) %f x %f\n"
13794 "* out (px) %d x %d\n"
13795 "* left x top (pt) %f x %f\n"
13796 "* left x top (px) %d x %d\n"
13797 "border (pt) (%f - %f) = %f x (%f - %f) = %f\n"
13798 "printable pixels (px) %d x %d\n"
13799 "res (dpi) %d x %d\n",
13800 page_pt_width, page_pt_height,
13801 pv.imgw_px, pv.imgh_px,
13802 PT(pv.imgw_px, w_dpi), PT(pv.imgh_px, h_dpi),
13803 out_pt_width, out_pt_height,
13804 pv.outw_px, pv.outh_px,
13805 out_pt_left, out_pt_top,
13806 pv.outl_px, pv.outt_px,
13807 page_pt_right, page_pt_left, page_pt_right - page_pt_left,
13808 page_pt_bottom, page_pt_top, page_pt_bottom - page_pt_top,
13809 pv.prnw_px, pv.prnh_px,
13810 w_dpi, h_dpi
13811 );
13812
13813 ink_type = dyesub_describe_output_internal(v, &pv);
13814 stp_set_string_parameter(v, "STPIOutputType", ink_type);
13815 stp_channel_reset(v);
13816 for (i = 0; i < pv.ink_channels; i++)
13817 stp_channel_add(v, i, 0, 1.0);
13818
13819 stp_set_float_parameter(v, "AppGammaScale",
13820 stp_get_boolean_parameter(v, "LegacyDyesubGamma") ? 4.0 : 1.0);
13821
13822 pv.out_channels = stp_color_init(v, image, 256);
13823
13824 /* If there's a mismatch in channels, that is ALWAYS a problem */
13825 if (pv.out_channels != pv.ink_channels)
13826 {
13827 stp_dprintf(STP_DBG_DYESUB, v,
13828 "Input and output channel count mismatch! (%d vs %d)\n", pv.out_channels, pv.ink_channels);
13829 stp_image_conclude(image);
13830 stp_free(pd);
13831 return 2;
13832 }
13833
13834
13835 pv.image_data = dyesub_read_image(v, &pv, image);
13836 if (ink_type)
13837 {
13838 if (strcmp(ink_type, "RGB") == 0 ||
13839 strcmp(ink_type, "BGR") == 0 ||
13840 strcmp(ink_type, "Whitescale") == 0)
13841 {
13842 pv.empty_byte[0] = 0xff;
13843 pv.empty_byte[1] = 0xff;
13844 pv.empty_byte[2] = 0xff;
13845 }
13846 else
13847 {
13848 pv.empty_byte[0] = 0x0;
13849 pv.empty_byte[1] = 0x0;
13850 pv.empty_byte[2] = 0x0;
13851 }
13852 }
13853 else
13854 {
13855 pv.empty_byte[0] = 0x0;
13856 pv.empty_byte[1] = 0x0;
13857 pv.empty_byte[2] = 0x0;
13858 }
13859
13860 pv.plane_interlacing = dyesub_feature(caps, DYESUB_FEATURE_PLANE_INTERLACE);
13861 pv.row_interlacing = dyesub_feature(caps, DYESUB_FEATURE_ROW_INTERLACE);
13862 pv.plane_lefttoright = dyesub_feature(caps, DYESUB_FEATURE_PLANE_LEFTTORIGHT);
13863 pv.print_mode = page_mode;
13864 if (!pv.image_data)
13865 {
13866 stp_image_conclude(image);
13867 stp_free(pd);
13868 return 2;
13869 }
13870
13871 if (dyesub_feature(caps, DYESUB_FEATURE_FULL_HEIGHT))
13872 {
13873 pv.prnt_px = 0;
13874 pv.prnb_px = pv.prnh_px - 1;
13875 }
13876 else if (dyesub_feature(caps, DYESUB_FEATURE_BLOCK_ALIGN))
13877 {
13878 pv.prnt_px = pv.outt_px - (pv.outt_px % caps->block_size);
13879 /* floor to multiple of block_size */
13880 pv.prnb_px = (pv.outb_px - 1) + (caps->block_size - 1)
13881 - ((pv.outb_px - 1) % caps->block_size);
13882 /* ceil to multiple of block_size */
13883 }
13884 else
13885 {
13886 pv.prnt_px = pv.outt_px;
13887 pv.prnb_px = pv.outb_px - 1;
13888 }
13889
13890 if (dyesub_feature(caps, DYESUB_FEATURE_FULL_WIDTH))
13891 {
13892 pv.prnl_px = 0;
13893 pv.prnr_px = pv.prnw_px - 1;
13894 }
13895 else
13896 {
13897 pv.prnl_px = pv.outl_px;
13898 pv.prnr_px = pv.outr_px;
13899 }
13900
13901 if (pv.print_mode == DYESUB_LANDSCAPE)
13902 {
13903 dyesub_swap_ints(&pv.outh_px, &pv.outw_px);
13904 dyesub_swap_ints(&pv.outt_px, &pv.outl_px);
13905 dyesub_swap_ints(&pv.outb_px, &pv.outr_px);
13906
13907 dyesub_swap_ints(&pv.prnh_px, &pv.prnw_px);
13908 dyesub_swap_ints(&pv.prnt_px, &pv.prnl_px);
13909 dyesub_swap_ints(&pv.prnb_px, &pv.prnr_px);
13910
13911 dyesub_swap_ints(&pv.imgh_px, &pv.imgw_px);
13912 }
13913
13914 /* Adjust margins if the driver asks, to fine-tune horizontal position. */
13915 pv.outl_px += pd->horiz_offset;
13916 pv.outr_px += pd->horiz_offset;
13917 /* Make sure we're still legal */
13918 if (pv.outl_px < 0)
13919 pv.outl_px = 0;
13920 if (pv.outr_px > pv.prnw_px)
13921 pv.outr_px = pv.prnw_px;
13922
13923 /* By this point, we're finally DONE mangling the pv structure,
13924 and can start calling into the bulk of the driver code. */
13925
13926 /* assign private data *after* swaping image dimensions */
13927 pd->w_dpi = w_dpi;
13928 pd->h_dpi = h_dpi;
13929 pd->w_size = pv.prnw_px;
13930 pd->h_size = pv.prnh_px;
13931 pd->print_mode = pv.print_mode;
13932
13933 /* Send out job init if we're in page mode */
13934 if (print_op & OP_JOB_START)
13935 dyesub_exec(v, caps->job_start_func, "caps->job_start");
13936
13937 /* printer init */
13938 dyesub_exec(v, caps->printer_init_func, "caps->printer_init");
13939
13940 for (pl = 0; pl < (pv.plane_interlacing ? pv.ink_channels : 1); pl++)
13941 {
13942 pd->plane = pv.ink_order[pl];
13943 stp_dprintf(STP_DBG_DYESUB, v, "dyesub: plane %d\n", pd->plane);
13944
13945 /* plane init */
13946 dyesub_exec(v, caps->plane_init_func, "caps->plane_init");
13947
13948 dyesub_print_plane(v, &pv, pd, caps, (int) pv.ink_order[pl] - 1);
13949
13950 /* plane end */
13951 dyesub_exec(v, caps->plane_end_func, "caps->plane_end");
13952 }
13953
13954 /* printer end */
13955 dyesub_exec(v, caps->printer_end_func, "caps->printer_end");
13956
13957 /* Job end, if we're in page mode */
13958 if (print_op & OP_JOB_END)
13959 dyesub_exec(v, caps->job_end_func, "caps->job_end");
13960
13961 if (pv.image_data) {
13962 dyesub_free_image(&pv, image);
13963 }
13964
13965 stp_image_conclude(image);
13966 stp_free(pd);
13967
13968 return status;
13969 }
13970
13971 static int
13972 dyesub_print(const stp_vars_t *v, stp_image_t *image)
13973 {
13974 int status;
13975 int op = OP_JOB_PRINT;
13976
13977 stp_vars_t *nv = stp_vars_create_copy(v);
13978
13979 if (!stp_get_string_parameter(v, "JobMode") ||
13980 strcmp(stp_get_string_parameter(v, "JobMode"), "Page") == 0)
13981 op = OP_JOB_START | OP_JOB_PRINT | OP_JOB_END;
13982
13983 status = dyesub_do_print(nv, image, op);
13984 stp_vars_destroy(nv);
13985 return status;
13986 }
13987
13988 static int
13989 dyesub_job_start(const stp_vars_t *v, stp_image_t *image)
13990 {
13991 const dyesub_cap_t *caps;
13992 stp_vars_t *nv = stp_vars_create_copy(v);
13993 (void)image;
13994
13995 caps = dyesub_get_model_capabilities(v, stp_get_model_id(nv));
13996
13997 if (caps->job_start_func)
13998 caps->job_start_func(nv);
13999 stp_vars_destroy(nv);
14000
14001 return 1;
14002 }
14003
14004 static int
14005 dyesub_job_end(const stp_vars_t *v, stp_image_t *image)
14006 {
14007 const dyesub_cap_t *caps;
14008 stp_vars_t *nv = stp_vars_create_copy(v);
14009 (void)image;
14010
14011 caps = dyesub_get_model_capabilities(v, stp_get_model_id(nv));
14012
14013 if (caps->job_end_func)
14014 caps->job_end_func(nv);
14015 stp_vars_destroy(nv);
14016
14017 return 1;
14018 }
14019
14020 static int dyesub_verify_printer_params(stp_vars_t *v)
14021 {
14022 const int model = stp_get_model_id(v);
14023 const dyesub_cap_t *caps = dyesub_get_model_capabilities(v, model);
14024 int result;
14025 result = stp_verify_printer_params(v);
14026 if (result != 1)
14027 return result;
14028
14029 /* Sanity-check printer-specific parameters if a function exists */
14030 result = dyesub_exec_check(v, caps->parse_parameters, "caps->parse_parameters");
14031 return result;
14032 }
14033
14034 static const stp_printfuncs_t print_dyesub_printfuncs =
14035 {
14036 dyesub_list_parameters,
14037 dyesub_parameters,
14038 dyesub_media_size,
14039 dyesub_imageable_area,
14040 dyesub_maximum_imageable_area,
14041 dyesub_limit,
14042 dyesub_print,
14043 dyesub_describe_resolution,
14044 dyesub_describe_output,
14045 dyesub_verify_printer_params,
14046 dyesub_job_start,
14047 dyesub_job_end,
14048 NULL,
14049 dyesub_describe_papersize
14050 };
14051
14052 static stp_family_t print_dyesub_module_data =
14053 {
14054 &print_dyesub_printfuncs,
14055 NULL
14056 };
14057
14058 static int
14059 print_dyesub_module_init(void)
14060 {
14061 return stpi_family_register(print_dyesub_module_data.printer_list);
14062 }
14063
14064
14065 static int
14066 print_dyesub_module_exit(void)
14067 {
14068 return stpi_family_unregister(print_dyesub_module_data.printer_list);
14069 }
14070
14071
14072 /* Module header */
14073 #define stp_module_version print_dyesub_LTX_stp_module_version
14074 #define stp_module_data print_dyesub_LTX_stp_module_data
14075
14076 stp_module_version_t stp_module_version = {0, 0};
14077
14078 stp_module_t stp_module_data =
14079 {
14080 "dyesub",
14081 VERSION,
14082 "DyeSub family driver",
14083 STP_MODULE_CLASS_FAMILY,
14084 NULL,
14085 print_dyesub_module_init,
14086 print_dyesub_module_exit,
14087 (void *) &print_dyesub_module_data
14088 };