diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-03-12 14:32:10 -0500 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-03-15 13:19:49 +0100 |
commit | 9ced850d60b61783e0d2fc301b078d28163c45b7 (patch) | |
tree | a2966d9f6774963c6d877a0e53840f7ad1474d73 /include | |
parent | 1b12400df02d1ad9b96b4d2047bc1f8ac6a135a6 (diff) | |
download | mupdf-9ced850d60b61783e0d2fc301b078d28163c45b7.tar.xz |
Split fz_band_writer into its own header file.
Diffstat (limited to 'include')
-rw-r--r-- | include/mupdf/fitz.h | 1 | ||||
-rw-r--r-- | include/mupdf/fitz/band-writer.h | 74 | ||||
-rw-r--r-- | include/mupdf/fitz/output-pcl.h | 1 | ||||
-rw-r--r-- | include/mupdf/fitz/output-png.h | 1 | ||||
-rw-r--r-- | include/mupdf/fitz/output-pnm.h | 1 | ||||
-rw-r--r-- | include/mupdf/fitz/output-ps.h | 1 | ||||
-rw-r--r-- | include/mupdf/fitz/output-pwg.h | 1 | ||||
-rw-r--r-- | include/mupdf/fitz/output-tga.h | 2 | ||||
-rw-r--r-- | include/mupdf/fitz/output.h | 66 |
9 files changed, 82 insertions, 66 deletions
diff --git a/include/mupdf/fitz.h b/include/mupdf/fitz.h index 54cc6904..1d2e4ca5 100644 --- a/include/mupdf/fitz.h +++ b/include/mupdf/fitz.h @@ -60,6 +60,7 @@ extern "C" { /* Output formats */ #include "mupdf/fitz/writer.h" +#include "mupdf/fitz/band-writer.h" #include "mupdf/fitz/output-pnm.h" #include "mupdf/fitz/output-png.h" #include "mupdf/fitz/output-pwg.h" diff --git a/include/mupdf/fitz/band-writer.h b/include/mupdf/fitz/band-writer.h new file mode 100644 index 00000000..06f885c3 --- /dev/null +++ b/include/mupdf/fitz/band-writer.h @@ -0,0 +1,74 @@ +#ifndef MUPDF_FITZ_BAND_WRITER_H +#define MUPDF_FITZ_BAND_WRITER_H + +#include "mupdf/fitz/system.h" +#include "mupdf/fitz/context.h" +#include "mupdf/fitz/output.h" + +/* + fz_band_writer +*/ +typedef struct fz_band_writer_s fz_band_writer; + +typedef void (fz_write_header_fn)(fz_context *ctx, fz_band_writer *writer); +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); +typedef void (fz_write_trailer_fn)(fz_context *ctx, fz_band_writer *writer); +typedef void (fz_drop_band_writer_fn)(fz_context *ctx, fz_band_writer *writer); + +struct fz_band_writer_s +{ + fz_drop_band_writer_fn *drop; + fz_write_header_fn *header; + fz_write_band_fn *band; + fz_write_trailer_fn *trailer; + fz_output *out; + int w; + int h; + int n; + int alpha; + int xres; + int yres; + int pagenum; + int line; +}; + +fz_band_writer *fz_new_band_writer_of_size(fz_context *ctx, size_t size, fz_output *out); +#define fz_new_band_writer(C,M,O) ((M *)Memento_label(fz_new_band_writer_of_size(ctx, sizeof(M), O), #M)) + +/* + fz_write_header: Cause a band writer to write the header for + a banded image with the given properties/dimensions etc. This + also configures the bandwriter for the format of the data to be + passed in future calls. + + w, h: Width and Height of the entire page. + + n: Number of components (including alphas). + + alpha: Number of alpha components. + + xres, yres: X and Y resolutions in dpi. + + pagenum: Page number + + Throws exception if incompatible data format. +*/ +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_write_band: Cause a band writer to write the next band + of data for an image. + + stride: The byte offset from the first byte of the data + for a pixel to the first byte of the data for the same pixel + on the row below. + + band_height: The number of lines in this band. + + samples: Pointer to first byte of the data. +*/ +void fz_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_height, const unsigned char *samples); + +void fz_drop_band_writer(fz_context *ctx, fz_band_writer *writer); + +#endif diff --git a/include/mupdf/fitz/output-pcl.h b/include/mupdf/fitz/output-pcl.h index 338d7553..7ca6948b 100644 --- a/include/mupdf/fitz/output-pcl.h +++ b/include/mupdf/fitz/output-pcl.h @@ -4,6 +4,7 @@ #include "mupdf/fitz/system.h" #include "mupdf/fitz/context.h" #include "mupdf/fitz/output.h" +#include "mupdf/fitz/band-writer.h" #include "mupdf/fitz/pixmap.h" #include "mupdf/fitz/bitmap.h" diff --git a/include/mupdf/fitz/output-png.h b/include/mupdf/fitz/output-png.h index 60283c7c..8342aead 100644 --- a/include/mupdf/fitz/output-png.h +++ b/include/mupdf/fitz/output-png.h @@ -4,6 +4,7 @@ #include "mupdf/fitz/system.h" #include "mupdf/fitz/context.h" #include "mupdf/fitz/output.h" +#include "mupdf/fitz/band-writer.h" #include "mupdf/fitz/pixmap.h" #include "mupdf/fitz/bitmap.h" diff --git a/include/mupdf/fitz/output-pnm.h b/include/mupdf/fitz/output-pnm.h index 66198325..b5fa2a31 100644 --- a/include/mupdf/fitz/output-pnm.h +++ b/include/mupdf/fitz/output-pnm.h @@ -4,6 +4,7 @@ #include "mupdf/fitz/system.h" #include "mupdf/fitz/context.h" #include "mupdf/fitz/output.h" +#include "mupdf/fitz/band-writer.h" #include "mupdf/fitz/pixmap.h" #include "mupdf/fitz/bitmap.h" diff --git a/include/mupdf/fitz/output-ps.h b/include/mupdf/fitz/output-ps.h index 1f187663..7ece483c 100644 --- a/include/mupdf/fitz/output-ps.h +++ b/include/mupdf/fitz/output-ps.h @@ -4,6 +4,7 @@ #include "mupdf/fitz/system.h" #include "mupdf/fitz/context.h" #include "mupdf/fitz/output.h" +#include "mupdf/fitz/band-writer.h" #include "mupdf/fitz/pixmap.h" /* diff --git a/include/mupdf/fitz/output-pwg.h b/include/mupdf/fitz/output-pwg.h index a3abc58d..54363e0c 100644 --- a/include/mupdf/fitz/output-pwg.h +++ b/include/mupdf/fitz/output-pwg.h @@ -4,6 +4,7 @@ #include "mupdf/fitz/system.h" #include "mupdf/fitz/context.h" #include "mupdf/fitz/output.h" +#include "mupdf/fitz/band-writer.h" #include "mupdf/fitz/pixmap.h" #include "mupdf/fitz/bitmap.h" diff --git a/include/mupdf/fitz/output-tga.h b/include/mupdf/fitz/output-tga.h index ad98c1c1..4684a0d5 100644 --- a/include/mupdf/fitz/output-tga.h +++ b/include/mupdf/fitz/output-tga.h @@ -3,6 +3,8 @@ #include "mupdf/fitz/system.h" #include "mupdf/fitz/context.h" +#include "mupdf/fitz/output.h" +#include "mupdf/fitz/band-writer.h" #include "mupdf/fitz/pixmap.h" /* diff --git a/include/mupdf/fitz/output.h b/include/mupdf/fitz/output.h index ed4d47fa..5d318948 100644 --- a/include/mupdf/fitz/output.h +++ b/include/mupdf/fitz/output.h @@ -315,70 +315,4 @@ char *fz_tempfilename(fz_context *ctx, const char *base, const char *hint); */ void fz_save_buffer(fz_context *ctx, fz_buffer *buf, const char *filename); -/* - fz_band_writer -*/ -typedef struct fz_band_writer_s fz_band_writer; - -typedef void (fz_write_header_fn)(fz_context *ctx, fz_band_writer *writer); -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); -typedef void (fz_write_trailer_fn)(fz_context *ctx, fz_band_writer *writer); -typedef void (fz_drop_band_writer_fn)(fz_context *ctx, fz_band_writer *writer); - -struct fz_band_writer_s -{ - fz_drop_band_writer_fn *drop; - fz_write_header_fn *header; - fz_write_band_fn *band; - fz_write_trailer_fn *trailer; - fz_output *out; - int w; - int h; - int n; - int alpha; - int xres; - int yres; - int pagenum; - int line; -}; - -fz_band_writer *fz_new_band_writer_of_size(fz_context *ctx, size_t size, fz_output *out); -#define fz_new_band_writer(C,M,O) ((M *)Memento_label(fz_new_band_writer_of_size(ctx, sizeof(M), O), #M)) - -/* - fz_write_header: Cause a band writer to write the header for - a banded image with the given properties/dimensions etc. This - also configures the bandwriter for the format of the data to be - passed in future calls. - - w, h: Width and Height of the entire page. - - n: Number of components (including alphas). - - alpha: Number of alpha components. - - xres, yres: X and Y resolutions in dpi. - - pagenum: Page number - - Throws exception if incompatible data format. -*/ -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_write_band: Cause a band writer to write the next band - of data for an image. - - stride: The byte offset from the first byte of the data - for a pixel to the first byte of the data for the same pixel - on the row below. - - band_height: The number of lines in this band. - - samples: Pointer to first byte of the data. -*/ -void fz_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_height, const unsigned char *samples); - -void fz_drop_band_writer(fz_context *ctx, fz_band_writer *writer); - #endif |