Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/include/mupdf/fitz/band-writer.h @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 // Copyright (C) 2004-2021 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_BAND_WRITER_H | |
| 24 #define MUPDF_FITZ_BAND_WRITER_H | |
| 25 | |
| 26 #include "mupdf/fitz/system.h" | |
| 27 #include "mupdf/fitz/context.h" | |
| 28 #include "mupdf/fitz/output.h" | |
| 29 #include "mupdf/fitz/color.h" | |
| 30 #include "mupdf/fitz/separation.h" | |
| 31 | |
| 32 /** | |
| 33 fz_band_writer | |
| 34 */ | |
| 35 typedef struct fz_band_writer fz_band_writer; | |
| 36 | |
| 37 /** | |
| 38 Cause a band writer to write the header for | |
| 39 a banded image with the given properties/dimensions etc. This | |
| 40 also configures the bandwriter for the format of the data to be | |
| 41 passed in future calls. | |
| 42 | |
| 43 w, h: Width and Height of the entire page. | |
| 44 | |
| 45 n: Number of components (including spots and alphas). | |
| 46 | |
| 47 alpha: Number of alpha components. | |
| 48 | |
| 49 xres, yres: X and Y resolutions in dpi. | |
| 50 | |
| 51 cs: Colorspace (NULL for bitmaps) | |
| 52 | |
| 53 seps: Separation details (or NULL). | |
| 54 */ | |
| 55 void fz_write_header(fz_context *ctx, fz_band_writer *writer, int w, int h, int n, int alpha, int xres, int yres, int pagenum, fz_colorspace *cs, fz_separations *seps); | |
| 56 | |
| 57 /** | |
| 58 Cause a band writer to write the next band | |
| 59 of data for an image. | |
| 60 | |
| 61 stride: The byte offset from the first byte of the data | |
| 62 for a pixel to the first byte of the data for the same pixel | |
| 63 on the row below. | |
| 64 | |
| 65 band_height: The number of lines in this band. | |
| 66 | |
| 67 samples: Pointer to first byte of the data. | |
| 68 */ | |
| 69 void fz_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_height, const unsigned char *samples); | |
| 70 | |
| 71 /** | |
| 72 Finishes up the output and closes the band writer. After this | |
| 73 call no more headers or bands may be written. | |
| 74 */ | |
| 75 void fz_close_band_writer(fz_context *ctx, fz_band_writer *writer); | |
| 76 | |
| 77 /** | |
| 78 Drop the reference to the band writer, causing it to be | |
| 79 destroyed. | |
| 80 | |
| 81 Never throws an exception. | |
| 82 */ | |
| 83 void fz_drop_band_writer(fz_context *ctx, fz_band_writer *writer); | |
| 84 | |
| 85 /* Implementation details: subject to change. */ | |
| 86 | |
| 87 typedef void (fz_write_header_fn)(fz_context *ctx, fz_band_writer *writer, fz_colorspace *cs); | |
| 88 typedef void (fz_write_band_fn)(fz_context *ctx, fz_band_writer *writer, int stride, int band_start, int band_height, const unsigned char *samples); | |
| 89 typedef void (fz_write_trailer_fn)(fz_context *ctx, fz_band_writer *writer); | |
| 90 typedef void (fz_close_band_writer_fn)(fz_context *ctx, fz_band_writer *writer); | |
| 91 typedef void (fz_drop_band_writer_fn)(fz_context *ctx, fz_band_writer *writer); | |
| 92 | |
| 93 struct fz_band_writer | |
| 94 { | |
| 95 fz_drop_band_writer_fn *drop; | |
| 96 fz_close_band_writer_fn *close; | |
| 97 fz_write_header_fn *header; | |
| 98 fz_write_band_fn *band; | |
| 99 fz_write_trailer_fn *trailer; | |
| 100 fz_output *out; | |
| 101 int w; | |
| 102 int h; | |
| 103 int n; | |
| 104 int s; | |
| 105 int alpha; | |
| 106 int xres; | |
| 107 int yres; | |
| 108 int pagenum; | |
| 109 int line; | |
| 110 fz_separations *seps; | |
| 111 }; | |
| 112 | |
| 113 fz_band_writer *fz_new_band_writer_of_size(fz_context *ctx, size_t size, fz_output *out); | |
| 114 #define fz_new_band_writer(C,M,O) ((M *)Memento_label(fz_new_band_writer_of_size(ctx, sizeof(M), O), #M)) | |
| 115 | |
| 116 | |
| 117 #endif |
