From 49b6c0f132ec4624e50cd79660143624dd1fcd35 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 9 Mar 2017 12:41:57 -0600 Subject: Simplify fz_band_writer API. Remove needless parameter passing in fz_band_writer API. We always know the bandstart, so why make the caller keep track of it and pass it in? Similarly, we know when we hit the end of the page, so why require us to trigger the trailer writing manually? --- include/mupdf/fitz/output.h | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/mupdf/fitz/output.h b/include/mupdf/fitz/output.h index aae56528..ed4d47fa 100644 --- a/include/mupdf/fitz/output.h +++ b/include/mupdf/fitz/output.h @@ -339,13 +339,46 @@ struct fz_band_writer_s 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); -void fz_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_start, int band_height, const unsigned char *samples); -void fz_write_trailer(fz_context *ctx, fz_band_writer *writer); + +/* + 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 -- cgit v1.2.3