11
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
14
/* $Id: gdevtsep.c 12306 2011-03-23 21:34:20Z mvrhel $ */
15
15
/* tiffgray device: 8-bit Gray uncompressed TIFF device
16
16
* tiff32nc device: 32-bit CMYK uncompressed TIFF device
17
17
* tiffsep device: Generate individual TIFF gray files for each separation
18
18
* as well as a 'composite' 32-bit CMYK for the page.
19
19
* tiffsep1 device: Generate individual TIFF 1-bit files for each separation
20
* tiffscaled device:Mono TIFF device (dithered downscaled output from
21
* 8-bit Gray internal rendering)
20
* tiffscaled device:Mono TIFF device (error-diffused downscaled output from
21
* 8-bit Gray internal rendering)
22
* tiffscaled8 device:Greyscale TIFF device (downscaled output from
23
* 8-bit Gray internal rendering)
24
* tiffscaled24 device:24-bit RGB TIFF device (dithered downscaled output
25
* from 24-bit RGB internal rendering)
24
28
#include "stdint_.h" /* for tiff.h */
99
103
1 /* MinFeatureSize */
106
/* ------ The tiffscaled8 device ------ */
108
static dev_proc_print_page(tiffscaled8_print_page);
110
static const gx_device_procs tiffscaled8_procs =
111
prn_color_params_procs(tiff_open,
114
gx_default_gray_map_rgb_color,
115
gx_default_gray_map_color_rgb,
116
tiff_get_params_downscale,
117
tiff_put_params_downscale);
119
const gx_device_tiff gs_tiffscaled8_device = {
120
prn_device_body(gx_device_tiff,
123
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
124
600, 600, /* 600 dpi by default */
125
0, 0, 0, 0, /* Margins */
126
1, /* num components */
127
8, /* bits per sample */
129
tiffscaled8_print_page),
130
arch_is_big_endian,/* default to native endian (i.e. use big endian iff the platform is so */
132
TIFF_DEFAULT_STRIP_SIZE,
133
TIFF_DEFAULT_DOWNSCALE,
135
1 /* MinFeatureSize */
138
/* ------ The tiffscaled24 device ------ */
140
static dev_proc_print_page(tiffscaled24_print_page);
142
static const gx_device_procs tiffscaled24_procs =
143
prn_color_params_procs(tiff_open,
146
gx_default_rgb_map_rgb_color,
147
gx_default_rgb_map_color_rgb,
148
tiff_get_params_downscale,
149
tiff_put_params_downscale);
151
const gx_device_tiff gs_tiffscaled24_device = {
152
prn_device_body(gx_device_tiff,
155
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
156
600, 600, /* 600 dpi by default */
157
0, 0, 0, 0, /* Margins */
158
3, /* num components */
159
24, /* bits per sample */
161
tiffscaled24_print_page),
162
arch_is_big_endian,/* default to native endian (i.e. use big endian iff the platform is so */
164
TIFF_DEFAULT_STRIP_SIZE,
165
TIFF_DEFAULT_DOWNSCALE,
167
1 /* MinFeatureSize */
103
171
/* ------ Private functions ------ */
149
217
return tiff_downscale_and_print_page(pdev, tfdev->tif,
150
218
tfdev->DownScaleFactor,
151
219
tfdev->MinFeatureSize,
225
tiffscaled8_print_page(gx_device_printer * pdev, FILE * file)
227
gx_device_tiff *const tfdev = (gx_device_tiff *)pdev;
230
code = gdev_tiff_begin_page(tfdev, file);
234
tiff_set_gray_fields(pdev, tfdev->tif, 8, tfdev->Compression, tfdev->MaxStripSize);
236
return tiff_downscale_and_print_page(pdev, tfdev->tif,
237
tfdev->DownScaleFactor,
238
tfdev->MinFeatureSize,
244
tiff_set_rgb_fields(gx_device_tiff *tfdev)
246
/* Put in a switch statement in case we want to have others */
247
switch (tfdev->icc_array->device_profile[0]->data_cs) {
249
TIFFSetField(tfdev->tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
252
TIFFSetField(tfdev->tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_ICCLAB);
255
TIFFSetField(tfdev->tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
258
TIFFSetField(tfdev->tif, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
259
TIFFSetField(tfdev->tif, TIFFTAG_SAMPLESPERPIXEL, 3);
261
tiff_set_compression((gx_device_printer *)tfdev, tfdev->tif,
262
tfdev->Compression, tfdev->MaxStripSize);
267
tiffscaled24_print_page(gx_device_printer * pdev, FILE * file)
269
gx_device_tiff *const tfdev = (gx_device_tiff *)pdev;
272
code = gdev_tiff_begin_page(tfdev, file);
276
TIFFSetField(tfdev->tif, TIFFTAG_BITSPERSAMPLE, 8);
277
tiff_set_rgb_fields(tfdev);
279
return tiff_downscale_and_print_page(pdev, tfdev->tif,
280
tfdev->DownScaleFactor,
281
tfdev->MinFeatureSize,
155
286
/* ------ The cmyk devices ------ */
1443
1574
/* Set up the separation output files */
1444
1575
num_comp = number_output_separations( tfdev->color_info.num_components,
1445
1576
num_std_colorants, num_order, num_spot);
1578
if (!num_order && num_comp < num_std_colorants + num_spot) {
1579
dlprintf("Warning: skipping one or more colour separations, see: Devices.htm#TIFF\n");
1446
1582
for (comp_num = 0; comp_num < num_comp; comp_num++ ) {
1447
1583
int sep_num = map_comp_to_sep[comp_num];