220
220
#define gx_prn_device_common\
221
byte skip[max(sizeof(gx_device_memory), sizeof(gx_device_clist)) -\
222
sizeof(gx_device) + sizeof(double) /* padding */];\
223
gx_printer_device_procs printer_procs;\
224
/* ------ Device parameters that must be set ------ */\
225
/* ------ before calling the device open routine. ------ */\
226
gdev_prn_space_params space_params;\
227
char fname[prn_fname_sizeof]; /* OutputFile */\
228
/* ------ Other device parameters ------ */\
229
bool OpenOutputFile;\
221
byte skip[max(sizeof(gx_device_memory), sizeof(gx_device_clist)) -\
222
sizeof(gx_device) + sizeof(double) /* padding */];\
223
gx_printer_device_procs printer_procs;\
224
/* ------ Device parameters that must be set ------ */\
225
/* ------ before calling the device open routine. ------ */\
226
gdev_prn_space_params space_params;\
227
char fname[prn_fname_sizeof]; /* OutputFile */\
228
/* ------ Other device parameters ------ */\
229
bool OpenOutputFile;\
231
231
bool page_uses_transparency; /* PDF 1.4 transparency is used on page */\
233
int Duplex_set; /* -1 = not supported */\
234
/* ------ End of parameters ------ */\
235
bool file_is_new; /* true iff file just opened */\
236
FILE *file; /* output file */\
237
long buffer_space; /* amount of space for clist buffer, */\
238
/* 0 means not using clist */\
239
byte *buf; /* buffer for rendering */\
240
/* ---- Begin async rendering support --- */\
241
gs_memory_t *buffer_memory; /* allocator for command list */\
242
gs_memory_t *bandlist_memory; /* allocator for bandlist files */\
243
proc_free_up_bandlist_memory((*free_up_bandlist_memory)); /* if nz, proc to free some bandlist memory */\
244
gx_page_queue_t *page_queue; /* if <> 0,page queue for gdevprna NOT GC'd */\
245
bool is_async_renderer; /* device is only the rendering part of async device */\
246
gx_device_printer *async_renderer; /* in async writer, pointer to async renderer */\
247
uint clist_disable_mask; /* mask of clist options to disable */\
248
/* ---- End async rendering support --- */\
249
int num_render_threads_requested; /* for multiple band rendering threads */\
250
gx_device_procs save_procs_while_delaying_erasepage; /* save device procs while delaying erasepage. */\
251
gx_device_procs orig_procs /* original (std_)procs */
233
int Duplex_set; /* -1 = not supported */\
234
/* ------ End of parameters ------ */\
235
bool file_is_new; /* true iff file just opened */\
236
FILE *file; /* output file */\
237
long buffer_space; /* amount of space for clist buffer, */\
238
/* 0 means not using clist */\
239
byte *buf; /* buffer for rendering */\
240
/* ---- Begin async rendering support --- */\
241
gs_memory_t *buffer_memory; /* allocator for command list */\
242
gs_memory_t *bandlist_memory; /* allocator for bandlist files */\
243
proc_free_up_bandlist_memory((*free_up_bandlist_memory)); /* if nz, proc to free some bandlist memory */\
244
gx_page_queue_t *page_queue; /* if <> 0,page queue for gdevprna NOT GC'd */\
245
bool is_async_renderer; /* device is only the rendering part of async device */\
246
gx_device_printer *async_renderer; /* in async writer, pointer to async renderer */\
247
uint clist_disable_mask; /* mask of clist options to disable */\
248
/* ---- End async rendering support --- */\
249
int num_render_threads_requested; /* for multiple band rendering threads */\
250
gx_device_procs save_procs_while_delaying_erasepage; /* save device procs while delaying erasepage. */\
251
gx_device_procs orig_procs /* original (std_)procs */
253
253
/* The device descriptor */
254
254
struct gx_device_printer_s {
293
293
prn_color_params_procs(p_open, p_output_page, p_close, p_map_rgb_color, p_map_color_rgb, gdev_prn_get_params, gdev_prn_put_params)
294
294
/* See gdev_prn_open for explanation of the NULLs below. */
295
295
#define prn_color_params_procs(p_open, p_output_page, p_close, p_map_rgb_color, p_map_color_rgb, p_get_params, p_put_params) {\
297
NULL, /* get_initial_matrix */\
298
NULL, /* sync_output */\
303
NULL, /* fill_rectangle */\
304
NULL, /* tile_rectangle */\
305
NULL, /* copy_mono */\
306
NULL, /* copy_color */\
307
NULL, /* draw_line */\
308
NULL, /* get_bits */\
311
NULL, /* map_cmyk_color */\
312
NULL, /* get_xfont_procs */\
313
NULL, /* get_xfont_device */\
314
NULL, /* map_rgb_alpha_color */\
315
gx_page_device_get_page_device,\
316
NULL, /* get_alpha_bits */\
317
NULL, /* copy_alpha */\
318
NULL, /* get_band */\
319
NULL, /* copy_rop */\
320
NULL, /* fill_path */\
321
NULL, /* stroke_path */\
322
NULL, /* fill_mask */\
323
NULL, /* fill_trapezoid */\
324
NULL, /* fill_parallelogram */\
325
NULL, /* fill_triangle */\
326
NULL, /* draw_thin_line */\
327
NULL, /* begin_image */\
328
NULL, /* image_data */\
329
NULL, /* end_image */\
330
NULL, /* strip_tile_rectangle */\
331
NULL, /* strip_copy_rop, */\
332
NULL, /* get_clipping_box */\
333
NULL, /* begin_typed_image */\
334
NULL, /* get_bits_rectangle */\
335
NULL, /* map_color_rgb_alpha */\
336
NULL, /* create_compositor */\
337
NULL, /* get_hardware_params */\
338
NULL, /* text_begin */\
339
NULL /* finish_copydevice */\
297
NULL, /* get_initial_matrix */\
298
NULL, /* sync_output */\
303
NULL, /* fill_rectangle */\
304
NULL, /* tile_rectangle */\
305
NULL, /* copy_mono */\
306
NULL, /* copy_color */\
307
NULL, /* draw_line */\
308
NULL, /* get_bits */\
311
NULL, /* map_cmyk_color */\
312
NULL, /* get_xfont_procs */\
313
NULL, /* get_xfont_device */\
314
NULL, /* map_rgb_alpha_color */\
315
gx_page_device_get_page_device,\
316
NULL, /* get_alpha_bits */\
317
NULL, /* copy_alpha */\
318
NULL, /* get_band */\
319
NULL, /* copy_rop */\
320
NULL, /* fill_path */\
321
NULL, /* stroke_path */\
322
NULL, /* fill_mask */\
323
NULL, /* fill_trapezoid */\
324
NULL, /* fill_parallelogram */\
325
NULL, /* fill_triangle */\
326
NULL, /* draw_thin_line */\
327
NULL, /* begin_image */\
328
NULL, /* image_data */\
329
NULL, /* end_image */\
330
NULL, /* strip_tile_rectangle */\
331
NULL, /* strip_copy_rop, */\
332
NULL, /* get_clipping_box */\
333
NULL, /* begin_typed_image */\
334
NULL, /* get_bits_rectangle */\
335
NULL, /* map_color_rgb_alpha */\
336
NULL, /* create_compositor */\
337
NULL, /* get_hardware_params */\
338
NULL, /* text_begin */\
339
NULL, /* finish_copydevice */\
340
NULL, /* begin_transparency_group */\
341
NULL, /* end_transparency_group */\
342
NULL, /* begin_transparency_mask */\
343
NULL, /* end_transparency_mask */\
344
NULL, /* discard_transparency_layer */\
345
NULL, /* get_color_mapping_procs */\
346
NULL, /* get_color_comp_index */\
347
NULL, /* encode_color */\
348
NULL, /* decode_color */\
349
NULL, /* pattern_manage */\
350
NULL, /* fill_rectangle_hl_color */\
351
NULL, /* include_color_space */\
352
NULL, /* fill_linear_color_scanline */\
353
NULL, /* fill_linear_color_trapezoid */\
354
NULL, /* fill_linear_color_triangle */\
355
NULL, /* update_spot_equivalent_colors */\
356
NULL, /* ret_devn_params */\
357
NULL, /* fillpage */\
358
NULL, /* push_transparency_state */\
359
NULL, /* pop_transparency_state */\
360
NULL, /* put_image */\
361
NULL, /* dev_spec_op */\
362
NULL, /* copy plane */\
363
gx_default_get_profile, /* get_profile */\
364
gx_default_set_graphics_type_tag /* set_graphics_type_tag */\
342
367
/* The standard printer device procedures */
358
383
* Note that print_page and print_page_copies must not both be defaulted.
360
385
#define prn_device_body_rest2_(print_page, print_page_copies, duplex_set)\
361
{ 0 }, /* std_procs */\
365
{ gx_default_create_buf_device,\
366
gx_default_size_buf_device,\
367
gx_default_setup_buf_device,\
368
gx_default_destroy_buf_device\
370
gdev_prn_default_get_space_params,\
371
gx_default_start_render_thread,\
372
gx_default_open_render_device,\
373
gx_default_close_render_device,\
374
gx_default_buffer_page\
376
{ PRN_MAX_BITMAP, PRN_BUFFER_SPACE,\
377
{ BAND_PARAMS_INITIAL_VALUES },\
378
0/*false*/, /* params_are_read_only */\
379
BandingAuto /* banding_type */\
382
0/*false*/, /* OpenOutputFile */\
383
0/*false*/, /* ReopenPerPage */\
384
0/*false*/, /* page_uses_transparency */\
385
0/*false*/, duplex_set, /* Duplex[_set] */\
386
0/*false*/, 0, 0, 0, /* file_is_new ... buf */\
387
0, 0, 0, 0, 0/*false*/, 0, 0, /* buffer_memory ... clist_dis'_mask */\
388
0, /* num_render_threads_requested */\
389
{ 0 }, /* save_procs_while_delaying_erasepage */\
390
{ 0 } /* ... orig_procs */
386
{ 0 }, /* std_procs */\
390
{ gx_default_create_buf_device,\
391
gx_default_size_buf_device,\
392
gx_default_setup_buf_device,\
393
gx_default_destroy_buf_device\
395
gdev_prn_default_get_space_params,\
396
gx_default_start_render_thread,\
397
gx_default_open_render_device,\
398
gx_default_close_render_device,\
399
gx_default_buffer_page\
401
{ PRN_MAX_BITMAP, PRN_BUFFER_SPACE,\
402
{ BAND_PARAMS_INITIAL_VALUES },\
403
0/*false*/, /* params_are_read_only */\
404
BandingAuto /* banding_type */\
407
0/*false*/, /* OpenOutputFile */\
408
0/*false*/, /* ReopenPerPage */\
409
0/*false*/, /* page_uses_transparency */\
410
0/*false*/, duplex_set, /* Duplex[_set] */\
411
0/*false*/, 0, 0, 0, /* file_is_new ... buf */\
412
0, 0, 0, 0, 0/*false*/, 0, 0, /* buffer_memory ... clist_dis'_mask */\
413
0, /* num_render_threads_requested */\
414
{ 0 }, /* save_procs_while_delaying_erasepage */\
415
{ 0 } /* ... orig_procs */
391
416
#define prn_device_body_rest_(print_page)\
392
417
prn_device_body_rest2_(print_page, gx_default_print_page_copies, -1)
393
418
#define prn_device_body_copies_rest_(print_page_copies)\
396
421
/* The Sun cc compiler won't allow \ within a macro argument list. */
397
422
/* This accounts for the short parameter names here and below. */
398
423
#define prn_device_margins_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page)\
399
std_device_full_body_type(dtype, &procs, dname, &st_device_printer,\
400
(int)((float)(w10) * (xdpi) / 10 + 0.5),\
401
(int)((float)(h10) * (ydpi) / 10 + 0.5),\
403
ncomp, depth, mg, mc, dg, dc,\
404
(float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
405
(float)((lm) * 72.0), (float)((bm) * 72.0),\
406
(float)((rm) * 72.0), (float)((tm) * 72.0)\
408
prn_device_body_rest_(print_page)
424
std_device_full_body_type(dtype, &procs, dname, &st_device_printer,\
425
(int)((float)(w10) * (xdpi) / 10 + 0.5),\
426
(int)((float)(h10) * (ydpi) / 10 + 0.5),\
428
ncomp, depth, mg, mc, dg, dc,\
429
(float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
430
(float)((lm) * 72.0), (float)((bm) * 72.0),\
431
(float)((rm) * 72.0), (float)((tm) * 72.0)\
433
prn_device_body_rest_(print_page)
409
434
#define prn_device_margins_stype_body(dtype, procs, dname, stype, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page)\
410
std_device_full_body_type(dtype, &procs, dname, stype,\
411
(int)((float)(w10) * (xdpi) / 10 + 0.5),\
412
(int)((float)(h10) * (ydpi) / 10 + 0.5),\
414
ncomp, depth, mg, mc, dg, dc,\
415
(float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
416
(float)((lm) * 72.0), (float)((bm) * 72.0),\
417
(float)((rm) * 72.0), (float)((tm) * 72.0)\
419
prn_device_body_rest_(print_page)
435
std_device_full_body_type(dtype, &procs, dname, stype,\
436
(int)((float)(w10) * (xdpi) / 10 + 0.5),\
437
(int)((float)(h10) * (ydpi) / 10 + 0.5),\
439
ncomp, depth, mg, mc, dg, dc,\
440
(float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
441
(float)((lm) * 72.0), (float)((bm) * 72.0),\
442
(float)((rm) * 72.0), (float)((tm) * 72.0)\
444
prn_device_body_rest_(print_page)
421
446
#define prn_device_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page)\
422
447
prn_device_margins_body(dtype, procs, dname, w10, h10, xdpi, ydpi,\
426
451
lm, tm, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page)
428
453
#define prn_device_margins_body_extended(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, mcomp, ncomp, pol, depth, gi, mg, mc, dg, dc, ef, cn, print_page)\
429
std_device_full_body_type_extended(dtype, &procs, dname, &st_device_printer,\
430
(int)((long)(w10) * (xdpi) / 10),\
431
(int)((long)(h10) * (ydpi) / 10),\
433
mcomp, ncomp, pol, depth, gi, mg, mc, dg, dc, ef, cn,\
434
-(lo) * (xdpi), -(to) * (ydpi),\
435
(lm) * 72.0, (bm) * 72.0,\
436
(rm) * 72.0, (tm) * 72.0\
438
prn_device_body_rest_(print_page)
454
std_device_full_body_type_extended(dtype, &procs, dname, &st_device_printer,\
455
(int)((long)(w10) * (xdpi) / 10),\
456
(int)((long)(h10) * (ydpi) / 10),\
458
mcomp, ncomp, pol, depth, gi, mg, mc, dg, dc, ef, cn,\
459
-(lo) * (xdpi), -(to) * (ydpi),\
460
(lm) * 72.0, (bm) * 72.0,\
461
(rm) * 72.0, (tm) * 72.0\
463
prn_device_body_rest_(print_page)
440
465
#define prn_device_body_extended(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, mcomp, ncomp, pol, depth, gi, mg, mc, dg, dc, ef, cn, print_page)\
441
466
prn_device_margins_body_extended(dtype, procs, dname, w10, h10, xdpi, ydpi,\
442
467
lm, tm, lm, bm, rm, tm, mcomp, ncomp, pol, depth, gi, mg, mc, dg, dc, ef, cn, print_page)
444
469
#define prn_device_std_margins_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, color_bits, print_page)\
445
std_device_std_color_full_body_type(dtype, &procs, dname, &st_device_printer,\
446
(int)((float)(w10) * (xdpi) / 10 + 0.5),\
447
(int)((float)(h10) * (ydpi) / 10 + 0.5),\
448
xdpi, ydpi, color_bits,\
449
(float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
450
(float)((lm) * 72.0), (float)((bm) * 72.0),\
451
(float)((rm) * 72.0), (float)((tm) * 72.0)\
453
prn_device_body_rest_(print_page)
470
std_device_std_color_full_body_type(dtype, &procs, dname, &st_device_printer,\
471
(int)((float)(w10) * (xdpi) / 10 + 0.5),\
472
(int)((float)(h10) * (ydpi) / 10 + 0.5),\
473
xdpi, ydpi, color_bits,\
474
(float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
475
(float)((lm) * 72.0), (float)((bm) * 72.0),\
476
(float)((rm) * 72.0), (float)((tm) * 72.0)\
478
prn_device_body_rest_(print_page)
455
480
#define prn_device_std_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, color_bits, print_page)\
456
481
prn_device_std_margins_body(dtype, procs, dname, w10, h10, xdpi, ydpi,\
457
482
lm, tm, lm, bm, rm, tm, color_bits, print_page)
459
484
#define prn_device_std_margins_body_copies(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, color_bits, print_page_copies)\
460
std_device_std_color_full_body_type(dtype, &procs, dname, &st_device_printer,\
461
(int)((float)(w10) * (xdpi) / 10 + 0.5),\
462
(int)((float)(h10) * (ydpi) / 10 + 0.5),\
463
xdpi, ydpi, color_bits,\
464
(float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
465
(float)((lm) * 72.0), (float)((bm) * 72.0),\
466
(float)((rm) * 72.0), (float)((tm) * 72.0)\
468
prn_device_body_copies_rest_(print_page_copies)
485
std_device_std_color_full_body_type(dtype, &procs, dname, &st_device_printer,\
486
(int)((float)(w10) * (xdpi) / 10 + 0.5),\
487
(int)((float)(h10) * (ydpi) / 10 + 0.5),\
488
xdpi, ydpi, color_bits,\
489
(float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
490
(float)((lm) * 72.0), (float)((bm) * 72.0),\
491
(float)((rm) * 72.0), (float)((tm) * 72.0)\
493
prn_device_body_copies_rest_(print_page_copies)
470
495
#define prn_device_std_body_copies(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, color_bits, print_page_copies)\
471
496
prn_device_std_margins_body_copies(dtype, procs, dname, w10, h10, xdpi, ydpi,\