summaryrefslogtreecommitdiff
path: root/include/mupdf/fitz/output-pnm.h
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-10-11 21:10:21 +0100
committerRobin Watts <robin.watts@artifex.com>2016-10-12 12:37:48 +0100
commit80308eae9964e71b66a18f3de6ebcd2ebf0d306b (patch)
tree6aa51f6f53fca59d3c7afcb727f36cf627249e7a /include/mupdf/fitz/output-pnm.h
parent7de80f5eea6c9475b1db2b4fd905fd69ed3795e7 (diff)
downloadmupdf-80308eae9964e71b66a18f3de6ebcd2ebf0d306b.tar.xz
Regularize band writer interface.
We have various functions that, for different image formats, write a header, then a band, then (sometimes) a trailer. Push them all through a single interface. This change also fixes potential problems caused by the trailer writing being an implicit destructor, which can cause problems in cleanup code if the trailer writing throws an error.
Diffstat (limited to 'include/mupdf/fitz/output-pnm.h')
-rw-r--r--include/mupdf/fitz/output-pnm.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/include/mupdf/fitz/output-pnm.h b/include/mupdf/fitz/output-pnm.h
index 09cad4ef..66198325 100644
--- a/include/mupdf/fitz/output-pnm.h
+++ b/include/mupdf/fitz/output-pnm.h
@@ -13,8 +13,8 @@
void fz_save_pixmap_as_pnm(fz_context *ctx, fz_pixmap *pixmap, char *filename);
void fz_write_pixmap_as_pnm(fz_context *ctx, fz_output *out, fz_pixmap *pixmap);
-void fz_write_pnm_header(fz_context *ctx, fz_output *out, int w, int h, int n, int alpha);
-void fz_write_pnm_band(fz_context *ctx, fz_output *out, int w, int h, int n, int alpha, int stride, int band_start, int bandheight, unsigned char *p);
+
+fz_band_writer *fz_new_pnm_band_writer(fz_context *ctx, fz_output *out);
/*
fz_save_pixmap_as_pam: Save a pixmap as a PAM image file.
@@ -22,8 +22,8 @@ void fz_write_pnm_band(fz_context *ctx, fz_output *out, int w, int h, int n, int
void fz_save_pixmap_as_pam(fz_context *ctx, fz_pixmap *pixmap, char *filename);
void fz_write_pixmap_as_pam(fz_context *ctx, fz_output *out, fz_pixmap *pixmap);
-void fz_write_pam_header(fz_context *ctx, fz_output *out, int w, int h, int n, int alpha);
-void fz_write_pam_band(fz_context *ctx, fz_output *out, int w, int h, int n, int alpha, int stride, int band_start, int bandheight, unsigned char *sp);
+
+fz_band_writer *fz_new_pam_band_writer(fz_context *ctx, fz_output *out);
/*
fz_save_bitmap_as_pbm: Save a bitmap as a PBM image file.
@@ -32,9 +32,7 @@ void fz_save_bitmap_as_pbm(fz_context *ctx, fz_bitmap *bitmap, char *filename);
void fz_write_bitmap_as_pbm(fz_context *ctx, fz_output *out, fz_bitmap *bitmap);
-void fz_write_pbm_header(fz_context *ctx, fz_output *out, int w, int h);
-
-void fz_write_pbm_band(fz_context *ctx, fz_output *out, fz_bitmap *bitmap);
+fz_band_writer *fz_new_pbm_band_writer(fz_context *ctx, fz_output *out);
/*
fz_save_bitmap_as_pkm: Save a 4bpp cmyk bitmap as a PAM image file.
@@ -43,8 +41,6 @@ void fz_save_bitmap_as_pkm(fz_context *ctx, fz_bitmap *bitmap, char *filename);
void fz_write_bitmap_as_pkm(fz_context *ctx, fz_output *out, fz_bitmap *bitmap);
-void fz_write_pkm_header(fz_context *ctx, fz_output *out, int w, int h);
-
-void fz_write_pkm_band(fz_context *ctx, fz_output *out, fz_bitmap *bitmap);
+fz_band_writer *fz_new_pkm_band_writer(fz_context *ctx, fz_output *out);
#endif