| 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 | */ |
| 16 | typedef struct fz_pcl_options_s fz_pcl_options; |
| 17 | |
| 18 | struct 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 | |
| 40 | void fz_pcl_preset(fz_context *ctx, fz_pcl_options *opts, const char *preset); |
| 41 | |
| 42 | fz_pcl_options *fz_parse_pcl_options(fz_context *ctx, fz_pcl_options *opts, const char *args); |
| 43 | |
| 44 | fz_band_writer *fz_new_mono_pcl_band_writer(fz_context *ctx, fz_output *out, const fz_pcl_options *options); |
| 45 | void fz_write_bitmap_as_pcl(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pcl_options *pcl); |
| 46 | void fz_save_bitmap_as_pcl(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pcl_options *pcl); |
| 47 | |
| 48 | fz_band_writer *fz_new_color_pcl_band_writer(fz_context *ctx, fz_output *out, const fz_pcl_options *options); |
| 49 | void fz_write_pixmap_as_pcl(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pcl_options *pcl); |
| 50 | void 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 | */ |
| 55 | typedef struct fz_pclm_options_s fz_pclm_options; |
| 56 | |
| 57 | struct 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 | |
| 66 | fz_pclm_options *fz_parse_pclm_options(fz_context *ctx, fz_pclm_options *opts, const char *args); |
| 67 | |
| 68 | fz_band_writer *fz_new_pclm_band_writer(fz_context *ctx, fz_output *out, const fz_pclm_options *options); |
| 69 | fz_document_writer *fz_new_pclm_writer(fz_context *ctx, const char *path, const char *options); |
| 70 | void fz_write_pixmap_as_pclm(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pclm_options *options); |
| 71 | void fz_save_pixmap_as_pclm(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pclm_options *options); |
| 72 | |
| 73 | void fz_save_pixmap_as_png(fz_context *ctx, fz_pixmap *pixmap, const char *filename); |
| 74 | void fz_write_pixmap_as_png(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap); |
| 75 | |
| 76 | fz_band_writer *fz_new_png_band_writer(fz_context *ctx, fz_output *out); |
| 77 | |
| 78 | fz_buffer *fz_new_buffer_from_image_as_png(fz_context *ctx, fz_image *image, fz_color_params color_params); |
| 79 | fz_buffer *fz_new_buffer_from_pixmap_as_png(fz_context *ctx, fz_pixmap *pixmap, fz_color_params color_params); |
| 80 | |
| 81 | void fz_save_pixmap_as_pnm(fz_context *ctx, fz_pixmap *pixmap, const char *filename); |
| 82 | void fz_write_pixmap_as_pnm(fz_context *ctx, fz_output *out, fz_pixmap *pixmap); |
| 83 | fz_band_writer *fz_new_pnm_band_writer(fz_context *ctx, fz_output *out); |
| 84 | |
| 85 | void fz_save_pixmap_as_pam(fz_context *ctx, fz_pixmap *pixmap, const char *filename); |
| 86 | void fz_write_pixmap_as_pam(fz_context *ctx, fz_output *out, fz_pixmap *pixmap); |
| 87 | fz_band_writer *fz_new_pam_band_writer(fz_context *ctx, fz_output *out); |
| 88 | |
| 89 | void fz_save_bitmap_as_pbm(fz_context *ctx, fz_bitmap *bitmap, const char *filename); |
| 90 | void fz_write_bitmap_as_pbm(fz_context *ctx, fz_output *out, fz_bitmap *bitmap); |
| 91 | fz_band_writer *fz_new_pbm_band_writer(fz_context *ctx, fz_output *out); |
| 92 | void fz_save_pixmap_as_pbm(fz_context *ctx, fz_pixmap *pixmap, const char *filename); |
| 93 | |
| 94 | void fz_save_bitmap_as_pkm(fz_context *ctx, fz_bitmap *bitmap, const char *filename); |
| 95 | void fz_write_bitmap_as_pkm(fz_context *ctx, fz_output *out, fz_bitmap *bitmap); |
| 96 | fz_band_writer *fz_new_pkm_band_writer(fz_context *ctx, fz_output *out); |
| 97 | void fz_save_pixmap_as_pkm(fz_context *ctx, fz_pixmap *pixmap, const char *filename); |
| 98 | |
| 99 | void fz_write_pixmap_as_ps(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap); |
| 100 | void fz_save_pixmap_as_ps(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append); |
| 101 | |
| 102 | fz_band_writer *fz_new_ps_band_writer(fz_context *ctx, fz_output *out); |
| 103 | void (fz_context *ctx, fz_output *out); |
| 104 | void fz_write_ps_file_trailer(fz_context *ctx, fz_output *out, int pages); |
| 105 | |
| 106 | void fz_save_pixmap_as_psd(fz_context *ctx, fz_pixmap *pixmap, const char *filename); |
| 107 | void fz_write_pixmap_as_psd(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap); |
| 108 | fz_band_writer *fz_new_psd_band_writer(fz_context *ctx, fz_output *out); |
| 109 | |
| 110 | typedef struct fz_pwg_options_s fz_pwg_options; |
| 111 | |
| 112 | struct 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 | |
| 154 | void fz_save_pixmap_as_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pwg_options *pwg); |
| 155 | void fz_save_bitmap_as_pwg(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pwg_options *pwg); |
| 156 | void fz_write_pixmap_as_pwg(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pwg_options *pwg); |
| 157 | void fz_write_bitmap_as_pwg(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pwg_options *pwg); |
| 158 | void fz_write_pixmap_as_pwg_page(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz_pwg_options *pwg); |
| 159 | void fz_write_bitmap_as_pwg_page(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, const fz_pwg_options *pwg); |
| 160 | |
| 161 | fz_band_writer *fz_new_mono_pwg_band_writer(fz_context *ctx, fz_output *out, const fz_pwg_options *pwg); |
| 162 | fz_band_writer *fz_new_pwg_band_writer(fz_context *ctx, fz_output *out, const fz_pwg_options *pwg); |
| 163 | |
| 164 | void (fz_context *ctx, fz_output *out); /* for use by mudraw.c */ |
| 165 | |
| 166 | #endif |
| 167 | |