mupdf
Loading...
Searching...
No Matches
write-pixmap.h
Go to the documentation of this file.
1// Copyright (C) 2004-2025 Artifex Software, Inc.
2//
3// This file is part of MuPDF.
4//
5// MuPDF is free software: you can redistribute it and/or modify it under the
6// terms of the GNU Affero General Public License as published by the Free
7// Software Foundation, either version 3 of the License, or (at your option)
8// any later version.
9//
10// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
11// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13// details.
14//
15// You should have received a copy of the GNU Affero General Public License
16// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
17//
18// Alternative licensing terms are available from the licensor.
19// For commercial licensing, see <https://www.artifex.com/> or contact
20// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
21// CA 94129, USA, for further information.
22
23#ifndef MUPDF_FITZ_WRITE_PIXMAP_H
24#define MUPDF_FITZ_WRITE_PIXMAP_H
25
26#include "mupdf/fitz/system.h"
27#include "mupdf/fitz/context.h"
28#include "mupdf/fitz/output.h"
30#include "mupdf/fitz/pixmap.h"
31#include "mupdf/fitz/bitmap.h"
32#include "mupdf/fitz/buffer.h"
33#include "mupdf/fitz/image.h"
34#include "mupdf/fitz/writer.h"
35
39typedef struct
40{
41 /* Features of a particular printer */
43 const char *odd_page_init;
44 const char *even_page_init;
45
46 /* Options for this job */
47 int tumble;
49 int duplex;
56
57 /* Updated as we move through the job */
60
80void fz_pcl_preset(fz_context *ctx, fz_pcl_options *opts, const char *preset);
81
102
104
106
111
115void fz_write_bitmap_as_pcl(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pcl_options *pcl);
116
120void fz_save_bitmap_as_pcl(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pcl_options *pcl);
121
126
130void fz_write_pixmap_as_pcl(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pcl_options *pcl);
131
135void fz_save_pixmap_as_pcl(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pcl_options *pcl);
136
140typedef struct
141{
144
145 /* Updated as we move through the job */
148
161
166
170void fz_write_pixmap_as_pclm(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pclm_options *options);
171
175void fz_save_pixmap_as_pclm(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int append, const fz_pclm_options *options);
176
180typedef struct
181{
184 char language[256];
185 char datadir[1024];
186
187 int skew_correct; /* 0 = no skew correction. 1 = automatic. 2 = use specified angle. */
188 float skew_angle; /* Only used if skew == 2 */
189 int skew_border; /* 0 = increase size so no content is lost. 1 = maintain size. 2 = decrease size so no new pixels are visible. */
190
191 /* Updated as we move through the job */
193
196
211
221
225void fz_pdfocr_band_writer_set_progress(fz_context *ctx, fz_band_writer *writer, fz_pdfocr_progress_fn *progress_fn, void *progress_arg);
226
230void fz_write_pixmap_as_pdfocr(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pdfocr_options *options);
231
235void fz_save_pixmap_as_pdfocr(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pdfocr_options *options);
236
240void fz_save_pixmap_as_png(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
241
245void fz_write_pixmap_as_jpeg(fz_context *ctx, fz_output *out, fz_pixmap *pix, int quality, int invert_cmyk);
246
250void fz_save_pixmap_as_jpeg(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int quality);
251
256
263void fz_write_pixmap_as_jpx(fz_context *ctx, fz_output *out, fz_pixmap *pix, int quality);
264
271void fz_save_pixmap_as_jpx(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int q);
272
278
290fz_buffer *fz_new_buffer_from_image_as_jpeg(fz_context *ctx, fz_image *image, fz_color_params color_params, int quality, int invert_cmyk);
292
304fz_buffer *fz_new_buffer_from_pixmap_as_jpeg(fz_context *ctx, fz_pixmap *pixmap, fz_color_params color_params, int quality, int invert_cmyk);
306
310void fz_save_pixmap_as_pnm(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
311
316
322
327void fz_save_pixmap_as_pam(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
328
334
340
344void fz_save_bitmap_as_pbm(fz_context *ctx, fz_bitmap *bitmap, const char *filename);
345
350
355
359void fz_save_pixmap_as_pbm(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
361
365void fz_save_bitmap_as_pkm(fz_context *ctx, fz_bitmap *bitmap, const char *filename);
367
372
377
381void fz_save_pixmap_as_pkm(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
382
386void fz_write_pixmap_as_ps(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap);
387
391void fz_save_pixmap_as_ps(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append);
392
398
403
408
412void fz_save_pixmap_as_psd(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
413
417void fz_write_pixmap_as_psd(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap);
418
423
424typedef struct
425{
426 /* These are not interpreted as CStrings by the writing code,
427 * but are rather copied directly out. */
428 char media_class[64];
429 char media_color[64];
430 char media_type[64];
431 char output_type[64];
432
433 unsigned int advance_distance;
439 int jog;
442 unsigned int media_position;
443 unsigned int media_weight;
446 unsigned int num_copies;
449 unsigned int PageSize[2];
453
456 unsigned int row_count;
457 unsigned int row_feed;
458 unsigned int row_step;
459
460 /* These are not interpreted as CStrings by the writing code, but
461 * are rather copied directly out. */
465
470
475
480
484void fz_save_pixmap_as_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pwg_options *pwg);
485
489void fz_save_bitmap_as_pwg(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pwg_options *pwg);
490
494void fz_write_pixmap_as_pwg(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pwg_options *pwg);
495
499void fz_write_bitmap_as_pwg(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pwg_options *pwg);
500
508void fz_write_pixmap_as_pwg_page(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pwg_options *pwg);
509
517void fz_write_bitmap_as_pwg_page(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pwg_options *pwg);
518
523
528
532void fz_write_pwg_file_header(fz_context *ctx, fz_output *out); /* for use by mudraw.c */
533
534#endif
Definition band-writer.h:94
Definition bitmap.h:40
Definition buffer.h:41
Definition color.h:72
Definition context.h:886
Definition image.h:351
Definition options.h:207
Definition output.h:111
Definition write-pixmap.h:40
int manual_feed
Definition write-pixmap.h:52
int features
Definition write-pixmap.h:42
int orientation
Definition write-pixmap.h:55
int duplex
Definition write-pixmap.h:49
const char * odd_page_init
Definition write-pixmap.h:43
int tumble
Definition write-pixmap.h:47
int duplex_set
Definition write-pixmap.h:48
int paper_size
Definition write-pixmap.h:50
const char * even_page_init
Definition write-pixmap.h:44
int media_position_set
Definition write-pixmap.h:53
int manual_feed_set
Definition write-pixmap.h:51
int page_count
Definition write-pixmap.h:58
int media_position
Definition write-pixmap.h:54
Definition write-pixmap.h:141
int strip_height
Definition write-pixmap.h:143
int compress
Definition write-pixmap.h:142
int page_count
Definition write-pixmap.h:146
Definition write-pixmap.h:181
int page_count
Definition write-pixmap.h:192
int skew_border
Definition write-pixmap.h:189
float skew_angle
Definition write-pixmap.h:188
char language[256]
Definition write-pixmap.h:184
int strip_height
Definition write-pixmap.h:183
char datadir[1024]
Definition write-pixmap.h:185
int compress
Definition write-pixmap.h:182
int skew_correct
Definition write-pixmap.h:187
fz_options * options
Definition write-pixmap.h:194
Definition pixmap.h:432
Definition write-pixmap.h:425
int negative_print
Definition write-pixmap.h:445
int cut_media
Definition write-pixmap.h:436
int media_type_num
Definition write-pixmap.h:454
unsigned int advance_distance
Definition write-pixmap.h:433
char media_type[64]
Definition write-pixmap.h:430
char output_type[64]
Definition write-pixmap.h:431
unsigned int row_feed
Definition write-pixmap.h:457
unsigned int media_position
Definition write-pixmap.h:442
int duplex
Definition write-pixmap.h:437
int collate
Definition write-pixmap.h:435
unsigned int media_weight
Definition write-pixmap.h:443
unsigned int row_count
Definition write-pixmap.h:456
int compression
Definition write-pixmap.h:455
char media_color[64]
Definition write-pixmap.h:429
int mirror_print
Definition write-pixmap.h:444
char page_size_name[64]
Definition write-pixmap.h:463
int manual_feed
Definition write-pixmap.h:441
unsigned int PageSize[2]
Definition write-pixmap.h:449
int advance_media
Definition write-pixmap.h:434
int orientation
Definition write-pixmap.h:447
char media_class[64]
Definition write-pixmap.h:428
int tray_switch
Definition write-pixmap.h:451
int jog
Definition write-pixmap.h:439
int output_face_up
Definition write-pixmap.h:448
int leading_edge
Definition write-pixmap.h:440
int insert_sheet
Definition write-pixmap.h:438
int separations
Definition write-pixmap.h:450
unsigned int row_step
Definition write-pixmap.h:458
int tumble
Definition write-pixmap.h:452
unsigned int num_copies
Definition write-pixmap.h:446
char rendering_intent[64]
Definition write-pixmap.h:462
fz_buffer * fz_new_buffer_from_image_as_pbm(fz_context *ctx, fz_image *image, fz_color_params color_params)
void fz_write_pixmap_as_pclm(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pclm_options *options)
fz_buffer * fz_new_buffer_from_image_as_psd(fz_context *ctx, fz_image *image, fz_color_params color_params)
void fz_save_pixmap_as_jpeg(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int quality)
void fz_init_pwg_options(fz_context *ctx, fz_pwg_options *opts)
fz_buffer * fz_new_buffer_from_image_as_pnm(fz_context *ctx, fz_image *image, fz_color_params color_params)
fz_buffer * fz_new_buffer_from_pixmap_as_psd(fz_context *ctx, fz_pixmap *pix, fz_color_params color_params)
fz_band_writer * fz_new_pbm_band_writer(fz_context *ctx, fz_output *out)
void fz_apply_pcl_options(fz_context *ctx, fz_pcl_options *opts, fz_options *args)
void fz_write_pixmap_as_pwg(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pwg_options *pwg)
fz_band_writer * fz_new_color_pcl_band_writer(fz_context *ctx, fz_output *out, const fz_pcl_options *options)
fz_buffer * fz_new_buffer_from_pixmap_as_jpx(fz_context *ctx, fz_pixmap *pix, fz_color_params color_params, int quality)
void fz_save_bitmap_as_pbm(fz_context *ctx, fz_bitmap *bitmap, const char *filename)
void fz_apply_pwg_options(fz_context *ctx, fz_pwg_options *opts, fz_options *args)
void fz_write_pixmap_as_jpeg(fz_context *ctx, fz_output *out, fz_pixmap *pix, int quality, int invert_cmyk)
void fz_write_pixmap_as_pdfocr(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pdfocr_options *options)
fz_buffer * fz_new_buffer_from_pixmap_as_pnm(fz_context *ctx, fz_pixmap *pixmap, fz_color_params color_params)
void fz_init_pdfocr_options(fz_context *ctx, fz_pdfocr_options *opts)
void fz_write_bitmap_as_pcl(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pcl_options *pcl)
void fz_write_pixmap_as_ps(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap)
void fz_save_pixmap_as_ps(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append)
void fz_save_pixmap_as_png(fz_context *ctx, fz_pixmap *pixmap, const char *filename)
fz_buffer * fz_new_buffer_from_image_as_jpeg(fz_context *ctx, fz_image *image, fz_color_params color_params, int quality, int invert_cmyk)
fz_band_writer * fz_new_mono_pcl_band_writer(fz_context *ctx, fz_output *out, const fz_pcl_options *options)
fz_buffer * fz_new_buffer_from_pixmap_as_pbm(fz_context *ctx, fz_pixmap *pixmap, fz_color_params color_params)
fz_band_writer * fz_new_pwg_band_writer(fz_context *ctx, fz_output *out, const fz_pwg_options *pwg)
fz_buffer * fz_new_buffer_from_pixmap_as_jpeg(fz_context *ctx, fz_pixmap *pixmap, fz_color_params color_params, int quality, int invert_cmyk)
void fz_save_pixmap_as_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pwg_options *pwg)
void fz_write_pixmap_as_pwg_page(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pwg_options *pwg)
fz_buffer * fz_new_buffer_from_image_as_pam(fz_context *ctx, fz_image *image, fz_color_params color_params)
void fz_write_pixmap_as_pbm(fz_context *ctx, fz_output *out, fz_pixmap *pixmap)
void fz_write_bitmap_as_pkm(fz_context *ctx, fz_output *out, fz_bitmap *bitmap)
fz_band_writer * fz_new_pkm_band_writer(fz_context *ctx, fz_output *out)
void fz_save_pixmap_as_pdfocr(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pdfocr_options *options)
void fz_init_pcl_options(fz_context *ctx, fz_pcl_options *opts)
void fz_write_bitmap_as_pbm(fz_context *ctx, fz_output *out, fz_bitmap *bitmap)
fz_band_writer * fz_new_png_band_writer(fz_context *ctx, fz_output *out)
void fz_write_pixmap_as_pcl(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pcl_options *pcl)
fz_buffer * fz_new_buffer_from_pixmap_as_pam(fz_context *ctx, fz_pixmap *pixmap, fz_color_params color_params)
void fz_save_bitmap_as_pcl(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pcl_options *pcl)
fz_buffer * fz_new_buffer_from_image_as_pkm(fz_context *ctx, fz_image *image, fz_color_params color_params)
void fz_pdfocr_band_writer_set_progress(fz_context *ctx, fz_band_writer *writer, fz_pdfocr_progress_fn *progress_fn, void *progress_arg)
fz_band_writer * fz_new_pdfocr_band_writer(fz_context *ctx, fz_output *out, const fz_pdfocr_options *options)
fz_band_writer * fz_new_ps_band_writer(fz_context *ctx, fz_output *out)
fz_pdfocr_options * fz_parse_pdfocr_options(fz_context *ctx, fz_pdfocr_options *opts, const char *args)
fz_pcl_options * fz_parse_pcl_options(fz_context *ctx, fz_pcl_options *opts, const char *args)
fz_pwg_options * fz_parse_pwg_options(fz_context *ctx, fz_pwg_options *opts, const char *args)
void fz_write_pixmap_as_pkm(fz_context *ctx, fz_output *out, fz_pixmap *pixmap)
fz_buffer * fz_new_buffer_from_pixmap_as_pkm(fz_context *ctx, fz_pixmap *pixmap, fz_color_params color_params)
void fz_save_pixmap_as_pam(fz_context *ctx, fz_pixmap *pixmap, const char *filename)
fz_band_writer * fz_new_pnm_band_writer(fz_context *ctx, fz_output *out)
fz_buffer * fz_new_buffer_from_image_as_jpx(fz_context *ctx, fz_image *image, fz_color_params color_params, int quality)
void fz_write_pixmap_as_pam(fz_context *ctx, fz_output *out, fz_pixmap *pixmap)
void fz_save_bitmap_as_pkm(fz_context *ctx, fz_bitmap *bitmap, const char *filename)
fz_band_writer * fz_new_pam_band_writer(fz_context *ctx, fz_output *out)
fz_band_writer * fz_new_mono_pwg_band_writer(fz_context *ctx, fz_output *out, const fz_pwg_options *pwg)
void fz_save_pixmap_as_pbm(fz_context *ctx, fz_pixmap *pixmap, const char *filename)
void fz_write_bitmap_as_pwg_page(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pwg_options *pwg)
void fz_save_pixmap_as_psd(fz_context *ctx, fz_pixmap *pixmap, const char *filename)
void fz_init_pclm_options(fz_context *ctx, fz_pclm_options *opts)
fz_buffer * fz_new_buffer_from_image_as_png(fz_context *ctx, fz_image *image, fz_color_params color_params)
fz_band_writer * fz_new_psd_band_writer(fz_context *ctx, fz_output *out)
void fz_save_bitmap_as_pwg(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pwg_options *pwg)
fz_pclm_options * fz_parse_pclm_options(fz_context *ctx, fz_pclm_options *opts, const char *args)
void fz_apply_pdfocr_options(fz_context *ctx, fz_pdfocr_options *opts, fz_options *options)
void fz_write_pixmap_as_png(fz_context *ctx, fz_output *out, fz_pixmap *pixmap)
void fz_save_pixmap_as_pclm(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int append, const fz_pclm_options *options)
void fz_write_pixmap_as_pnm(fz_context *ctx, fz_output *out, fz_pixmap *pixmap)
void fz_save_pixmap_as_jpx(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int q)
void fz_write_pwg_file_header(fz_context *ctx, fz_output *out)
void fz_write_bitmap_as_pwg(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pwg_options *pwg)
void fz_save_pixmap_as_pcl(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pcl_options *pcl)
void fz_write_ps_file_header(fz_context *ctx, fz_output *out)
fz_band_writer * fz_new_pclm_band_writer(fz_context *ctx, fz_output *out, const fz_pclm_options *options)
void fz_save_pixmap_as_pkm(fz_context *ctx, fz_pixmap *pixmap, const char *filename)
fz_buffer * fz_new_buffer_from_pixmap_as_png(fz_context *ctx, fz_pixmap *pixmap, fz_color_params color_params)
void fz_save_pixmap_as_pnm(fz_context *ctx, fz_pixmap *pixmap, const char *filename)
void fz_write_ps_file_trailer(fz_context *ctx, fz_output *out, int pages)
void fz_write_pixmap_as_psd(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap)
void fz_write_pixmap_as_jpx(fz_context *ctx, fz_output *out, fz_pixmap *pix, int quality)
void fz_pcl_preset(fz_context *ctx, fz_pcl_options *opts, const char *preset)
void fz_apply_pclm_options(fz_context *ctx, fz_pclm_options *opts, fz_options *args)
int fz_pdfocr_progress_fn(fz_context *ctx, void *progress_arg, int page, int percent)
Definition writer.h:147