1#ifndef MUPDF_FITZ_WRITE_PIXMAP_H
2#define MUPDF_FITZ_WRITE_PIXMAP_H
3
4#include "mupdf/fitz/system.h"
5#include "mupdf/fitz/context.h"
6#include "mupdf/fitz/output.h"
7#include "mupdf/fitz/band-writer.h"
8#include "mupdf/fitz/pixmap.h"
9#include "mupdf/fitz/bitmap.h"
10#include "mupdf/fitz/buffer.h"
11#include "mupdf/fitz/image.h"
12
13/*
14 PCL output
15*/
16typedef struct fz_pcl_options_s fz_pcl_options;
17
18struct fz_pcl_options_s
19{
20 /* Features of a particular printer */
21 int features;
22 const char *odd_page_init;
23 const char *even_page_init;
24
25 /* Options for this job */
26 int tumble;
27 int duplex_set;
28 int duplex;
29 int paper_size;
30 int manual_feed_set;
31 int manual_feed;
32 int media_position_set;
33 int media_position;
34 int orientation;
35
36 /* Updated as we move through the job */
37 int page_count;
38};
39
40void fz_pcl_preset(fz_context *ctx, fz_pcl_options *opts, const char *preset);
41
42fz_pcl_options *fz_parse_pcl_options(fz_context *ctx, fz_pcl_options *opts, const char *args);
43
44fz_band_writer *fz_new_mono_pcl_band_writer(fz_context *ctx, fz_output *out, const fz_pcl_options *options);
45void fz_write_bitmap_as_pcl(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pcl_options *pcl);
46void fz_save_bitmap_as_pcl(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pcl_options *pcl);
47
48fz_band_writer *fz_new_color_pcl_band_writer(fz_context *ctx, fz_output *out, const fz_pcl_options *options);
49void fz_write_pixmap_as_pcl(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pcl_options *pcl);
50void fz_save_pixmap_as_pcl(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pcl_options *pcl);
51
52/*
53 PCLm output
54*/
55typedef struct fz_pclm_options_s fz_pclm_options;
56
57struct fz_pclm_options_s
58{
59 int compress;
60 int strip_height;
61
62 /* Updated as we move through the job */
63 int page_count;
64};
65
66fz_pclm_options *fz_parse_pclm_options(fz_context *ctx, fz_pclm_options *opts, const char *args);
67
68fz_band_writer *fz_new_pclm_band_writer(fz_context *ctx, fz_output *out, const fz_pclm_options *options);
69fz_document_writer *fz_new_pclm_writer(fz_context *ctx, const char *path, const char *options);
70void fz_write_pixmap_as_pclm(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pclm_options *options);
71void fz_save_pixmap_as_pclm(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pclm_options *options);
72
73void fz_save_pixmap_as_png(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
74void fz_write_pixmap_as_png(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap);
75
76fz_band_writer *fz_new_png_band_writer(fz_context *ctx, fz_output *out);
77
78fz_buffer *fz_new_buffer_from_image_as_png(fz_context *ctx, fz_image *image, fz_color_params color_params);
79fz_buffer *fz_new_buffer_from_pixmap_as_png(fz_context *ctx, fz_pixmap *pixmap, fz_color_params color_params);
80
81void fz_save_pixmap_as_pnm(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
82void fz_write_pixmap_as_pnm(fz_context *ctx, fz_output *out, fz_pixmap *pixmap);
83fz_band_writer *fz_new_pnm_band_writer(fz_context *ctx, fz_output *out);
84
85void fz_save_pixmap_as_pam(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
86void fz_write_pixmap_as_pam(fz_context *ctx, fz_output *out, fz_pixmap *pixmap);
87fz_band_writer *fz_new_pam_band_writer(fz_context *ctx, fz_output *out);
88
89void fz_save_bitmap_as_pbm(fz_context *ctx, fz_bitmap *bitmap, const char *filename);
90void fz_write_bitmap_as_pbm(fz_context *ctx, fz_output *out, fz_bitmap *bitmap);
91fz_band_writer *fz_new_pbm_band_writer(fz_context *ctx, fz_output *out);
92void fz_save_pixmap_as_pbm(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
93
94void fz_save_bitmap_as_pkm(fz_context *ctx, fz_bitmap *bitmap, const char *filename);
95void fz_write_bitmap_as_pkm(fz_context *ctx, fz_output *out, fz_bitmap *bitmap);
96fz_band_writer *fz_new_pkm_band_writer(fz_context *ctx, fz_output *out);
97void fz_save_pixmap_as_pkm(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
98
99void fz_write_pixmap_as_ps(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap);
100void fz_save_pixmap_as_ps(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append);
101
102fz_band_writer *fz_new_ps_band_writer(fz_context *ctx, fz_output *out);
103void fz_write_ps_file_header(fz_context *ctx, fz_output *out);
104void fz_write_ps_file_trailer(fz_context *ctx, fz_output *out, int pages);
105
106void fz_save_pixmap_as_psd(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
107void fz_write_pixmap_as_psd(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap);
108fz_band_writer *fz_new_psd_band_writer(fz_context *ctx, fz_output *out);
109
110typedef struct fz_pwg_options_s fz_pwg_options;
111
112struct fz_pwg_options_s
113{
114 /* These are not interpreted as CStrings by the writing code, but
115 * are rather copied directly out. */
116 char media_class[64];
117 char media_color[64];
118 char media_type[64];
119 char output_type[64];
120
121 unsigned int advance_distance;
122 int advance_media;
123 int collate;
124 int cut_media;
125 int duplex;
126 int insert_sheet;
127 int jog;
128 int leading_edge;
129 int manual_feed;
130 unsigned int media_position;
131 unsigned int media_weight;
132 int mirror_print;
133 int negative_print;
134 unsigned int num_copies;
135 int orientation;
136 int output_face_up;
137 unsigned int PageSize[2];
138 int separations;
139 int tray_switch;
140 int tumble;
141
142 int media_type_num;
143 int compression;
144 unsigned int row_count;
145 unsigned int row_feed;
146 unsigned int row_step;
147
148 /* These are not interpreted as CStrings by the writing code, but
149 * are rather copied directly out. */
150 char rendering_intent[64];
151 char page_size_name[64];
152};
153
154void fz_save_pixmap_as_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pwg_options *pwg);
155void fz_save_bitmap_as_pwg(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pwg_options *pwg);
156void fz_write_pixmap_as_pwg(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pwg_options *pwg);
157void fz_write_bitmap_as_pwg(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pwg_options *pwg);
158void fz_write_pixmap_as_pwg_page(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pwg_options *pwg);
159void fz_write_bitmap_as_pwg_page(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pwg_options *pwg);
160
161fz_band_writer *fz_new_mono_pwg_band_writer(fz_context *ctx, fz_output *out, const fz_pwg_options *pwg);
162fz_band_writer *fz_new_pwg_band_writer(fz_context *ctx, fz_output *out, const fz_pwg_options *pwg);
163
164void fz_write_pwg_file_header(fz_context *ctx, fz_output *out); /* for use by mudraw.c */
165
166#endif
167