summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-12-15 11:31:36 +0100
committerTor Andersson <tor.andersson@artifex.com>2015-12-15 14:11:10 +0100
commit3afdcd7307fd5e68f35c7bb91a4d856499f1df44 (patch)
tree13253bb6d7af2716f882e878be956fa157544ec6
parent88a1d527a50e3cc48606ce097a335669ae84a716 (diff)
downloadmupdf-3afdcd7307fd5e68f35c7bb91a4d856499f1df44.tar.xz
Rename fz_write_x to fz_save_pixmap_as_x or fz_save_bitmap_as_x.
Separate naming of functions that save complete files to disk from functions that write data to streams.
-rw-r--r--docs/multi-threaded.c2
-rw-r--r--include/mupdf/fitz/document.h10
-rw-r--r--include/mupdf/fitz/output-pcl.h4
-rw-r--r--include/mupdf/fitz/output-png.h4
-rw-r--r--include/mupdf/fitz/output-pnm.h12
-rw-r--r--include/mupdf/fitz/output-pwg.h8
-rw-r--r--include/mupdf/fitz/output-tga.h2
-rw-r--r--include/mupdf/fitz/write-document.h10
-rw-r--r--include/mupdf/pdf/clean.h2
-rw-r--r--include/mupdf/pdf/output-pdf.h4
-rw-r--r--platform/android/jni/mupdf.c6
-rw-r--r--platform/x11/jstest_main.c4
-rw-r--r--platform/x11/pdfapp.c6
-rw-r--r--source/fitz/bitmap.c2
-rw-r--r--source/fitz/document.c6
-rw-r--r--source/fitz/draw-device.c2
-rw-r--r--source/fitz/output-pcl.c4
-rw-r--r--source/fitz/output-pwg.c4
-rw-r--r--source/fitz/pixmap.c8
-rw-r--r--source/gprf/gprf-skeleton.c2
-rw-r--r--source/pdf/pdf-clean-file.c4
-rw-r--r--source/pdf/pdf-write.c80
-rw-r--r--source/pdf/pdf-xref.c2
-rw-r--r--source/tools/mudraw.c18
-rw-r--r--source/tools/pdfclean.c2
-rw-r--r--source/tools/pdfextract.c4
-rw-r--r--source/tools/pdfposter.c4
27 files changed, 108 insertions, 108 deletions
diff --git a/docs/multi-threaded.c b/docs/multi-threaded.c
index 98932819..eb66db07 100644
--- a/docs/multi-threaded.c
+++ b/docs/multi-threaded.c
@@ -263,7 +263,7 @@ int main(int argc, char **argv)
// Write the rendered image to a PNG file
- fz_write_png(ctx, data->pix, filename, 0);
+ fz_save_pixmap_as_png(ctx, data->pix, filename, 0);
// Free the thread's pixmap and display list since
// they were allocated by the main thread above.
diff --git a/include/mupdf/fitz/document.h b/include/mupdf/fitz/document.h
index ff399dba..459a5fbd 100644
--- a/include/mupdf/fitz/document.h
+++ b/include/mupdf/fitz/document.h
@@ -27,7 +27,7 @@ typedef enum
fz_permission;
// TODO: move out of this interface (it's pdf specific)
-typedef struct fz_write_options_s fz_write_options;
+typedef struct fz_save_options_s fz_save_options;
typedef void (fz_document_close_fn)(fz_context *ctx, fz_document *doc);
typedef int (fz_document_needs_password_fn)(fz_context *ctx, fz_document *doc);
@@ -38,7 +38,7 @@ typedef void (fz_document_layout_fn)(fz_context *ctx, fz_document *doc, float w,
typedef int (fz_document_count_pages_fn)(fz_context *ctx, fz_document *doc);
typedef fz_page *(fz_document_load_page_fn)(fz_context *ctx, fz_document *doc, int number);
typedef int (fz_document_lookup_metadata_fn)(fz_context *ctx, fz_document *doc, const char *key, char *buf, int size);
-typedef void (fz_document_write_fn)(fz_context *ctx, fz_document *doc, char *filename, fz_write_options *opts);
+typedef void (fz_document_save_fn)(fz_context *ctx, fz_document *doc, char *filename, fz_save_options *opts);
typedef fz_link *(fz_page_load_links_fn)(fz_context *ctx, fz_page *page);
typedef fz_rect *(fz_page_bound_page_fn)(fz_context *ctx, fz_page *page, fz_rect *);
@@ -86,7 +86,7 @@ struct fz_document_s
fz_document_count_pages_fn *count_pages;
fz_document_load_page_fn *load_page;
fz_document_lookup_metadata_fn *lookup_metadata;
- fz_document_write_fn *write;
+ fz_document_save_fn *save;
int did_layout;
};
@@ -397,7 +397,7 @@ int fz_separation_disabled_on_page (fz_context *ctx, fz_page *, int sep);
const char *fz_get_separation_on_page(fz_context *ctx, fz_page *page, int sep, uint32_t *rgba, uint32_t *cmyk);
/*
- fz_write_gproof_file: Given a currently open document, create a
+ fz_save_gproof: Given a currently open document, create a
gproof skeleton file from that document.
doc_filename: The name of the currently opened document file.
@@ -412,7 +412,7 @@ const char *fz_get_separation_on_page(fz_context *ctx, fz_page *page, int sep, u
display_profile: The filename of the ICC profile for our display device
*/
-void fz_write_gproof_file(fz_context *ctx, const char *doc_filename, fz_document *doc, const char *filename, int res,
+void fz_save_gproof(fz_context *ctx, const char *doc_filename, fz_document *doc, const char *filename, int res,
const char *print_profile, const char *display_profile);
#endif
diff --git a/include/mupdf/fitz/output-pcl.h b/include/mupdf/fitz/output-pcl.h
index 778b31fb..83f6cd79 100644
--- a/include/mupdf/fitz/output-pcl.h
+++ b/include/mupdf/fitz/output-pcl.h
@@ -93,8 +93,8 @@ void fz_output_pcl(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, fz_
void fz_output_pcl_bitmap(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, fz_pcl_options *pcl);
-void fz_write_pcl(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, fz_pcl_options *pcl);
+void fz_save_pixmap_as_pcl(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, fz_pcl_options *pcl);
-void fz_write_pcl_bitmap(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, fz_pcl_options *pcl);
+void fz_save_bitmap_as_pcl(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, fz_pcl_options *pcl);
#endif
diff --git a/include/mupdf/fitz/output-png.h b/include/mupdf/fitz/output-png.h
index 63c167e9..3ae6d3d0 100644
--- a/include/mupdf/fitz/output-png.h
+++ b/include/mupdf/fitz/output-png.h
@@ -11,11 +11,11 @@
#include "mupdf/fitz/image.h"
/*
- fz_write_png: Save a pixmap as a png
+ fz_save_pixmap_as_png: Save a pixmap as a png
filename: The filename to save as (including extension).
*/
-void fz_write_png(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha);
+void fz_save_pixmap_as_png(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int savealpha);
/*
Output a pixmap to an output stream as a png.
diff --git a/include/mupdf/fitz/output-pnm.h b/include/mupdf/fitz/output-pnm.h
index 0ea8a894..33dcde4e 100644
--- a/include/mupdf/fitz/output-pnm.h
+++ b/include/mupdf/fitz/output-pnm.h
@@ -8,27 +8,27 @@
#include "mupdf/fitz/bitmap.h"
/*
- fz_write_pnm: Save a pixmap as a PNM image file.
+ fz_save_pixmap_as_pnm: Save a pixmap as a PNM image file.
*/
-void fz_write_pnm(fz_context *ctx, fz_pixmap *pixmap, char *filename);
+void fz_save_pixmap_as_pnm(fz_context *ctx, fz_pixmap *pixmap, char *filename);
void fz_output_pnm(fz_context *ctx, fz_output *out, fz_pixmap *pixmap);
void fz_output_pnm_header(fz_context *ctx, fz_output *out, int w, int h, int n);
void fz_output_pnm_band(fz_context *ctx, fz_output *out, int w, int h, int n, int band, int bandheight, unsigned char *p);
/*
- fz_write_pam: Save a pixmap as a PAM image file.
+ fz_save_pixmap_as_pam: Save a pixmap as a PAM image file.
*/
-void fz_write_pam(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha);
+void fz_save_pixmap_as_pam(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha);
void fz_output_pam(fz_context *ctx, fz_output *out, fz_pixmap *pixmap, int savealpha);
void fz_output_pam_header(fz_context *ctx, fz_output *out, int w, int h, int n, int savealpha);
void fz_output_pam_band(fz_context *ctx, fz_output *out, int w, int h, int n, int band, int bandheight, unsigned char *sp, int savealpha);
/*
- fz_write_pbm: Save a bitmap as a PBM image file.
+ fz_save_bitmap_as_pbm: Save a bitmap as a PBM image file.
*/
-void fz_write_pbm(fz_context *ctx, fz_bitmap *bitmap, char *filename);
+void fz_save_bitmap_as_pbm(fz_context *ctx, fz_bitmap *bitmap, char *filename);
void fz_output_pbm(fz_context *ctx, fz_output *out, fz_bitmap *bitmap);
diff --git a/include/mupdf/fitz/output-pwg.h b/include/mupdf/fitz/output-pwg.h
index d2bb4a1f..6d399848 100644
--- a/include/mupdf/fitz/output-pwg.h
+++ b/include/mupdf/fitz/output-pwg.h
@@ -52,7 +52,7 @@ struct fz_pwg_options_s
};
/*
- fz_write_pwg: Save a pixmap as a pwg
+ fz_save_pixmap_as_pwg: Save a pixmap as a pwg
filename: The filename to save as (including extension).
@@ -61,10 +61,10 @@ struct fz_pwg_options_s
pwg: NULL, or a pointer to an options structure (initialised to zero
before being filled in, for future expansion).
*/
-void fz_write_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pwg_options *pwg);
+void fz_save_pixmap_as_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pwg_options *pwg);
/*
- fz_write_pwg_bitmap: Save a bitmap as a pwg
+ fz_save_bitmap_as_pwg: Save a bitmap as a pwg
filename: The filename to save as (including extension).
@@ -73,7 +73,7 @@ void fz_write_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append
pwg: NULL, or a pointer to an options structure (initialised to zero
before being filled in, for future expansion).
*/
-void fz_write_pwg_bitmap(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pwg_options *pwg);
+void fz_save_bitmap_as_pwg(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pwg_options *pwg);
/*
Output a pixmap to an output stream as a pwg raster.
diff --git a/include/mupdf/fitz/output-tga.h b/include/mupdf/fitz/output-tga.h
index 316eb182..4bd9e2ba 100644
--- a/include/mupdf/fitz/output-tga.h
+++ b/include/mupdf/fitz/output-tga.h
@@ -5,6 +5,6 @@
#include "mupdf/fitz/context.h"
#include "mupdf/fitz/pixmap.h"
-void fz_write_tga(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int savealpha);
+void fz_save_pixmap_as_tga(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int savealpha);
#endif
diff --git a/include/mupdf/fitz/write-document.h b/include/mupdf/fitz/write-document.h
index a26077e9..f3974e71 100644
--- a/include/mupdf/fitz/write-document.h
+++ b/include/mupdf/fitz/write-document.h
@@ -6,11 +6,11 @@
#include "mupdf/fitz/document.h"
/*
- In calls to fz_write, the following options structure can be used
+ In calls to fz_save_document, the following options structure can be used
to control aspects of the writing process. This structure may grow
in future, and should be zero-filled to allow forwards compatiblity.
*/
-struct fz_write_options_s
+struct fz_save_options_s
{
int do_incremental; /* Write just the changed objects */
int do_ascii; /* If non-zero then attempt (where possible) to make
@@ -29,7 +29,7 @@ struct fz_write_options_s
};
/* An enumeration of bitflags to use in the above 'do_expand' field of
- fz_write_options.
+ fz_save_options.
*/
enum
{
@@ -39,7 +39,7 @@ enum
};
/*
- fz_write: Write a document out.
+ fz_save_document: Write a document out to a file.
(In development - Subject to change in future versions)
@@ -54,6 +54,6 @@ enum
May throw exceptions.
*/
-void fz_write_document(fz_context *ctx, fz_document *doc, char *filename, fz_write_options *opts);
+void fz_save_document(fz_context *ctx, fz_document *doc, char *filename, fz_save_options *opts);
#endif
diff --git a/include/mupdf/pdf/clean.h b/include/mupdf/pdf/clean.h
index 11ebf0c7..f1068cfb 100644
--- a/include/mupdf/pdf/clean.h
+++ b/include/mupdf/pdf/clean.h
@@ -2,6 +2,6 @@
#define MUPDF_PDF_CLEAN_H
/* Read infile, and write selected pages to outfile with the given options. */
-void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password, fz_write_options *opts, char *retainlist[], int retainlen);
+void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password, fz_save_options *opts, char *retainlist[], int retainlen);
#endif
diff --git a/include/mupdf/pdf/output-pdf.h b/include/mupdf/pdf/output-pdf.h
index 617d32fc..a1506dfb 100644
--- a/include/mupdf/pdf/output-pdf.h
+++ b/include/mupdf/pdf/output-pdf.h
@@ -13,9 +13,9 @@
fz_device *pdf_new_pdf_device(fz_context *ctx, pdf_document *doc, pdf_obj *contents, pdf_obj *resources, const fz_matrix *ctm, fz_buffer *buf);
/*
- pdf_write_document: Write out the document to a file with all changes finalised.
+ pdf_save_document: Write out the document to a file with all changes finalised.
*/
-void pdf_write_document(fz_context *ctx, pdf_document *doc, char *filename, fz_write_options *opts);
+void pdf_save_document(fz_context *ctx, pdf_document *doc, char *filename, fz_save_options *opts);
void pdf_localise_page_resources(fz_context *ctx, pdf_document *doc);
diff --git a/platform/android/jni/mupdf.c b/platform/android/jni/mupdf.c
index e7a64b34..b927bd57 100644
--- a/platform/android/jni/mupdf.c
+++ b/platform/android/jni/mupdf.c
@@ -2597,7 +2597,7 @@ JNI_FN(MuPDFCore_saveInternal)(JNIEnv * env, jobject thiz)
if (glo->doc && glo->current_path)
{
char *tmp;
- fz_write_options opts;
+ fz_save_options opts;
opts.do_incremental = 1;
opts.do_ascii = 0;
opts.do_expand = 0;
@@ -2631,7 +2631,7 @@ JNI_FN(MuPDFCore_saveInternal)(JNIEnv * env, jobject thiz)
if (!err)
{
- fz_write_document(ctx, glo->doc, tmp, &opts);
+ fz_save_document(ctx, glo->doc, tmp, &opts);
written = 1;
}
}
@@ -2756,7 +2756,7 @@ JNI_FN(MuPDFCore_startProofInternal)(JNIEnv * env, jobject thiz, int inResolutio
fz_try(ctx)
{
- fz_write_gproof_file(ctx, glo->current_path, glo->doc, tmp, theResolution, "", "");
+ fz_save_gproof(ctx, glo->current_path, glo->doc, tmp, theResolution, "", "");
LOGE("Creating %s\n", tmp);
ret = (*env)->NewStringUTF(env, tmp);
diff --git a/platform/x11/jstest_main.c b/platform/x11/jstest_main.c
index e83cbfe3..79d300ea 100644
--- a/platform/x11/jstest_main.c
+++ b/platform/x11/jstest_main.c
@@ -372,9 +372,9 @@ main(int argc, char *argv[])
sprintf(text, output, ++shotcount);
if (strstr(text, ".pgm") || strstr(text, ".ppm") || strstr(text, ".pnm"))
- fz_write_pnm(ctx, gapp.image, text);
+ fz_save_pixmap_as_pnm(ctx, gapp.image, text);
else
- fz_write_png(ctx, gapp.image, text, 0);
+ fz_save_pixmap_as_png(ctx, gapp.image, text, 0);
}
else if (match(&line, "RESIZE"))
{
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c
index be8ab751..314592a1 100644
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -551,7 +551,7 @@ static int pdfapp_save(pdfapp_t *app)
if (wingetsavepath(app, buf, PATH_MAX))
{
- fz_write_options opts;
+ fz_save_options opts;
opts.do_incremental = 1;
opts.do_ascii = 0;
@@ -562,7 +562,7 @@ static int pdfapp_save(pdfapp_t *app)
if (strcmp(buf, app->docpath) != 0)
{
wincopyfile(app->docpath, buf);
- fz_write_document(app->ctx, app->doc, buf, &opts);
+ fz_save_document(app->ctx, app->doc, buf, &opts);
return 1;
}
@@ -573,7 +573,7 @@ static int pdfapp_save(pdfapp_t *app)
fz_try(app->ctx)
{
wincopyfile(app->docpath, buf);
- fz_write_document(app->ctx, app->doc, buf, &opts);
+ fz_save_document(app->ctx, app->doc, buf, &opts);
written = 1;
}
fz_catch(app->ctx)
diff --git a/source/fitz/bitmap.c b/source/fitz/bitmap.c
index 5d2af061..a9a53a98 100644
--- a/source/fitz/bitmap.c
+++ b/source/fitz/bitmap.c
@@ -67,7 +67,7 @@ fz_output_pbm(fz_context *ctx, fz_output *out, fz_bitmap *bitmap)
}
void
-fz_write_pbm(fz_context *ctx, fz_bitmap *bitmap, char *filename)
+fz_save_bitmap_as_pbm(fz_context *ctx, fz_bitmap *bitmap, char *filename)
{
fz_output *out = fz_new_output_with_path(ctx, filename, 0);
fz_try(ctx)
diff --git a/source/fitz/document.c b/source/fitz/document.c
index 1fc4ff87..588ee71c 100644
--- a/source/fitz/document.c
+++ b/source/fitz/document.c
@@ -240,10 +240,10 @@ fz_lookup_metadata(fz_context *ctx, fz_document *doc, const char *key, char *buf
}
void
-fz_write_document(fz_context *ctx, fz_document *doc, char *filename, fz_write_options *opts)
+fz_save_document(fz_context *ctx, fz_document *doc, char *filename, fz_save_options *opts)
{
- if (doc && doc->write)
- doc->write(ctx, doc, filename, opts);
+ if (doc && doc->save)
+ doc->save(ctx, doc, filename, opts);
}
fz_page *
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index 065daaa9..08ab129a 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -63,7 +63,7 @@ static void fz_dump_blend(fz_context *ctx, fz_pixmap *pix, const char *s)
printf("%s%02d", s, group_dump_count);
group_dump_count++;
- fz_write_png(ctx, pix, name, (pix->n > 1));
+ fz_save_pixmap_as_png(ctx, pix, name, (pix->n > 1));
}
static void dump_spaces(int x, const char *s)
diff --git a/source/fitz/output-pcl.c b/source/fitz/output-pcl.c
index 9d21a6d3..a87a84a9 100644
--- a/source/fitz/output-pcl.c
+++ b/source/fitz/output-pcl.c
@@ -790,7 +790,7 @@ fz_output_pcl_bitmap(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap, f
}
void
-fz_write_pcl(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, fz_pcl_options *pcl)
+fz_save_pixmap_as_pcl(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, fz_pcl_options *pcl)
{
fz_output *out = fz_new_output_with_path(ctx, filename, append);
fz_try(ctx)
@@ -802,7 +802,7 @@ fz_write_pcl(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, fz_
}
void
-fz_write_pcl_bitmap(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, fz_pcl_options *pcl)
+fz_save_bitmap_as_pcl(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, fz_pcl_options *pcl)
{
fz_output *out = fz_new_output_with_path(ctx, filename, append);
fz_try(ctx)
diff --git a/source/fitz/output-pwg.c b/source/fitz/output-pwg.c
index d46dd04f..4810049a 100644
--- a/source/fitz/output-pwg.c
+++ b/source/fitz/output-pwg.c
@@ -258,7 +258,7 @@ fz_output_pwg(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap, const fz
}
void
-fz_write_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pwg_options *pwg)
+fz_save_pixmap_as_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, const fz_pwg_options *pwg)
{
fz_output *out = fz_new_output_with_path(ctx, filename, append);
fz_try(ctx)
@@ -274,7 +274,7 @@ fz_write_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, con
}
void
-fz_write_pwg_bitmap(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pwg_options *pwg)
+fz_save_bitmap_as_pwg(fz_context *ctx, fz_bitmap *bitmap, char *filename, int append, const fz_pwg_options *pwg)
{
fz_output *out = fz_new_output_with_path(ctx, filename, append);
fz_try(ctx)
diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c
index 9f1ec20e..255418bb 100644
--- a/source/fitz/pixmap.c
+++ b/source/fitz/pixmap.c
@@ -583,7 +583,7 @@ fz_output_pnm(fz_context *ctx, fz_output *out, fz_pixmap *pixmap)
}
void
-fz_write_pnm(fz_context *ctx, fz_pixmap *pixmap, char *filename)
+fz_save_pixmap_as_pnm(fz_context *ctx, fz_pixmap *pixmap, char *filename)
{
fz_output *out = fz_new_output_with_path(ctx, filename, 0);
fz_output_pnm_header(ctx, out, pixmap->w, pixmap->h, pixmap->n);
@@ -652,7 +652,7 @@ fz_output_pam(fz_context *ctx, fz_output *out, fz_pixmap *pixmap, int savealpha)
}
void
-fz_write_pam(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha)
+fz_save_pixmap_as_pam(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha)
{
fz_output *out = fz_new_output_with_path(ctx, filename, 0);
fz_output_pam_header(ctx, out, pixmap->w, pixmap->h, pixmap->n, savealpha);
@@ -687,7 +687,7 @@ static void putchunk(fz_context *ctx, fz_output *out, char *tag, unsigned char *
}
void
-fz_write_png(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha)
+fz_save_pixmap_as_png(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int savealpha)
{
fz_output *out = fz_new_output_with_path(ctx, filename, 0);
fz_png_output_context *poc = NULL;
@@ -978,7 +978,7 @@ static inline void tga_put_pixel(fz_context *ctx, fz_output *out, unsigned char
}
void
-fz_write_tga(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int savealpha)
+fz_save_pixmap_as_tga(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int savealpha)
{
fz_output *out;
unsigned char head[18];
diff --git a/source/gprf/gprf-skeleton.c b/source/gprf/gprf-skeleton.c
index 6ed8a29d..ad0cb6a8 100644
--- a/source/gprf/gprf-skeleton.c
+++ b/source/gprf/gprf-skeleton.c
@@ -1,7 +1,7 @@
#include "mupdf/fitz.h"
void
-fz_write_gproof_file(fz_context *ctx, const char *pdf_file, fz_document *doc, const char *filename, int res,
+fz_save_gproof(fz_context *ctx, const char *pdf_file, fz_document *doc, const char *filename, int res,
const char *print_profile, const char *display_profile)
{
int i;
diff --git a/source/pdf/pdf-clean-file.c b/source/pdf/pdf-clean-file.c
index f1302efb..69e796b3 100644
--- a/source/pdf/pdf-clean-file.c
+++ b/source/pdf/pdf-clean-file.c
@@ -190,7 +190,7 @@ static void retainpages(fz_context *ctx, globals *glo, int argc, char **argv)
}
}
-void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password, fz_write_options *opts, char *argv[], int argc)
+void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password, fz_save_options *opts, char *argv[], int argc)
{
globals glo = { 0 };
@@ -207,7 +207,7 @@ void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password
if (argc)
retainpages(ctx, &glo, argc, argv);
- pdf_write_document(ctx, glo.doc, outfile, opts);
+ pdf_save_document(ctx, glo.doc, outfile, opts);
}
fz_always(ctx)
{
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c
index 1c7a3739..b321edf7 100644
--- a/source/pdf/pdf-write.c
+++ b/source/pdf/pdf-write.c
@@ -6,7 +6,7 @@
/* #define DEBUG_HEAP_SORT */
/* #define DEBUG_WRITING */
-typedef struct pdf_write_options_s pdf_write_options;
+typedef struct pdf_save_options_s pdf_save_options;
/*
As part of linearization, we need to keep a list of what objects are used
@@ -45,7 +45,7 @@ typedef struct {
page_objects *page[1];
} page_objects_list;
-struct pdf_write_options_s
+struct pdf_save_options_s
{
fz_output *out;
int do_incremental;
@@ -181,7 +181,7 @@ page_objects_insert(fz_context *ctx, page_objects **ppo, int i)
}
static void
-page_objects_list_insert(fz_context *ctx, pdf_write_options *opts, int page, int object)
+page_objects_list_insert(fz_context *ctx, pdf_save_options *opts, int page, int object)
{
page_objects_list_ensure(ctx, &opts->page_object_lists, page+1);
if (opts->page_object_lists->len < page+1)
@@ -190,7 +190,7 @@ page_objects_list_insert(fz_context *ctx, pdf_write_options *opts, int page, int
}
static void
-page_objects_list_set_page_object(fz_context *ctx, pdf_write_options *opts, int page, int object)
+page_objects_list_set_page_object(fz_context *ctx, pdf_save_options *opts, int page, int object)
{
page_objects_list_ensure(ctx, &opts->page_object_lists, page+1);
opts->page_object_lists->page[page]->page_object_number = object;
@@ -472,7 +472,7 @@ page_objects_list_sort_and_dedupe(fz_context *ctx, page_objects_list *pol)
#ifdef DEBUG_LINEARIZATION
static void
-page_objects_dump(pdf_write_options *opts)
+page_objects_dump(pdf_save_options *opts)
{
page_objects_list *pol = opts->page_object_lists;
int i, j;
@@ -493,7 +493,7 @@ page_objects_dump(pdf_write_options *opts)
}
static void
-objects_dump(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+objects_dump(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
int i;
@@ -513,7 +513,7 @@ objects_dump(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
* that we can continue our recursive marking. If it's a duff reference
* return the fact so that we can remove the reference at source.
*/
-static pdf_obj *markref(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *obj, int *duff)
+static pdf_obj *markref(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *obj, int *duff)
{
int num = pdf_to_num(ctx, obj);
int gen = pdf_to_gen(ctx, obj);
@@ -561,7 +561,7 @@ static pdf_obj *markref(fz_context *ctx, pdf_document *doc, pdf_write_options *o
/* Recursively mark an object. If any references found are duff, then
* replace them with nulls. */
-static int markobj(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *obj)
+static int markobj(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *obj)
{
int i;
@@ -596,7 +596,7 @@ static int markobj(fz_context *ctx, pdf_document *doc, pdf_write_options *opts,
* Scan for and remove duplicate objects (slow)
*/
-static void removeduplicateobjs(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+static void removeduplicateobjs(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
int num, other;
int xref_len = pdf_xref_len(ctx, doc);
@@ -696,7 +696,7 @@ static void removeduplicateobjs(fz_context *ctx, pdf_document *doc, pdf_write_op
* This code assumes that any opts->renumber_map[n] <= n for all n.
*/
-static void compactxref(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+static void compactxref(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
int num, newnum;
int xref_len = pdf_xref_len(ctx, doc);
@@ -738,7 +738,7 @@ static void compactxref(fz_context *ctx, pdf_document *doc, pdf_write_options *o
* removing duplicate objects and compacting the xref.
*/
-static void renumberobj(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *obj)
+static void renumberobj(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *obj)
{
int i;
int xref_len = pdf_xref_len(ctx, doc);
@@ -791,7 +791,7 @@ static void renumberobj(fz_context *ctx, pdf_document *doc, pdf_write_options *o
}
}
-static void renumberobjs(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+static void renumberobjs(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
pdf_xref_entry *newxref = NULL;
int newlen;
@@ -877,7 +877,7 @@ static void renumberobjs(fz_context *ctx, pdf_document *doc, pdf_write_options *
}
}
-static void page_objects_list_renumber(pdf_write_options *opts)
+static void page_objects_list_renumber(pdf_save_options *opts)
{
int i, j;
@@ -893,7 +893,7 @@ static void page_objects_list_renumber(pdf_write_options *opts)
}
static void
-mark_all(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *val, int flag, int page)
+mark_all(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *val, int flag, int page)
{
if (pdf_mark_obj(ctx, val))
@@ -943,7 +943,7 @@ mark_all(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *v
}
static int
-mark_pages(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *val, int pagenum)
+mark_pages(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *val, int pagenum)
{
if (pdf_mark_obj(ctx, val))
@@ -1011,7 +1011,7 @@ mark_pages(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj
}
static void
-mark_root(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *dict)
+mark_root(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *dict)
{
int i, n = pdf_dict_len(ctx, dict);
@@ -1063,7 +1063,7 @@ mark_root(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *
}
static void
-mark_trailer(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *dict)
+mark_trailer(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *dict)
{
int i, n = pdf_dict_len(ctx, dict);
@@ -1094,7 +1094,7 @@ mark_trailer(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_ob
}
static void
-add_linearization_objs(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+add_linearization_objs(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
pdf_obj *params_obj = NULL;
pdf_obj *params_ref = NULL;
@@ -1357,7 +1357,7 @@ pdf_localise_page_resources(fz_context *ctx, pdf_document *doc)
}
static void
-linearize(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+linearize(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
int i;
int n = pdf_xref_len(ctx, doc) + 2;
@@ -1433,7 +1433,7 @@ linearize(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
}
static void
-update_linearization_params(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+update_linearization_params(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
fz_off_t offset;
pdf_set_int(ctx, opts->linear_l, opts->file_len);
@@ -1587,7 +1587,7 @@ static fz_buffer *deflatebuf(fz_context *ctx, unsigned char *p, int n)
return buf;
}
-static void copystream(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *obj_orig, int num, int gen)
+static void copystream(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *obj_orig, int num, int gen)
{
fz_buffer *buf, *tmp;
pdf_obj *newlen;
@@ -1631,7 +1631,7 @@ static void copystream(fz_context *ctx, pdf_document *doc, pdf_write_options *op
pdf_drop_obj(ctx, obj);
}
-static void expandstream(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *obj_orig, int num, int gen)
+static void expandstream(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *obj_orig, int num, int gen)
{
fz_buffer *buf, *tmp;
pdf_obj *newlen;
@@ -1708,7 +1708,7 @@ static int filter_implies_image(fz_context *ctx, pdf_document *doc, pdf_obj *o)
return 0;
}
-static void writeobject(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int num, int gen, int skip_xrefs)
+static void writeobject(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, int num, int gen, int skip_xrefs)
{
pdf_xref_entry *entry;
pdf_obj *obj;
@@ -1821,7 +1821,7 @@ static void writeobject(fz_context *ctx, pdf_document *doc, pdf_write_options *o
pdf_drop_obj(ctx, obj);
}
-static void writexrefsubsect(fz_context *ctx, pdf_write_options *opts, int from, int to)
+static void writexrefsubsect(fz_context *ctx, pdf_save_options *opts, int from, int to)
{
int num;
@@ -1835,7 +1835,7 @@ static void writexrefsubsect(fz_context *ctx, pdf_write_options *opts, int from,
}
}
-static void writexref(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int from, int to, int first, int main_xref_offset, int startxref)
+static void writexref(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, int from, int to, int first, int main_xref_offset, int startxref)
{
pdf_obj *trailer = NULL;
pdf_obj *obj;
@@ -1935,7 +1935,7 @@ static void writexref(fz_context *ctx, pdf_document *doc, pdf_write_options *opt
doc->has_xref_streams = 0;
}
-static void writexrefstreamsubsect(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *index, fz_buffer *fzbuf, int from, int to)
+static void writexrefstreamsubsect(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *index, fz_buffer *fzbuf, int from, int to)
{
int num;
@@ -1952,7 +1952,7 @@ static void writexrefstreamsubsect(fz_context *ctx, pdf_document *doc, pdf_write
}
}
-static void writexrefstream(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int from, int to, int first, int main_xref_offset, int startxref)
+static void writexrefstream(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, int from, int to, int first, int main_xref_offset, int startxref)
{
int num;
pdf_obj *dict = NULL;
@@ -2082,7 +2082,7 @@ padto(fz_context *ctx, fz_output *out, fz_off_t target)
}
static void
-dowriteobject(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int num, int pass)
+dowriteobject(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, int num, int pass)
{
pdf_xref_entry *entry = pdf_get_xref_entry(ctx, doc, num);
if (entry->type == 'f')
@@ -2118,7 +2118,7 @@ dowriteobject(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int n
}
static void
-writeobjects(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int pass)
+writeobjects(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, int pass)
{
int num;
int xref_len = pdf_xref_len(ctx, doc);
@@ -2174,7 +2174,7 @@ my_log2(int x)
}
static void
-make_page_offset_hints(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, fz_buffer *buf)
+make_page_offset_hints(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, fz_buffer *buf)
{
int i, j;
int min_objs_per_page, max_objs_per_page;
@@ -2444,7 +2444,7 @@ make_page_offset_hints(fz_context *ctx, pdf_document *doc, pdf_write_options *op
}
static void
-make_hint_stream(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+make_hint_stream(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
fz_buffer *buf = fz_new_buffer(ctx, 100);
@@ -2463,7 +2463,7 @@ make_hint_stream(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
}
#ifdef DEBUG_WRITING
-static void dump_object_details(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+static void dump_object_details(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
int i;
@@ -2511,7 +2511,7 @@ static void presize_unsaved_signature_byteranges(fz_context *ctx, pdf_document *
}
}
-static void complete_signatures(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, char *filename)
+static void complete_signatures(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, char *filename)
{
pdf_unsaved_sig *usig;
char buf[5120];
@@ -2615,9 +2615,9 @@ static void sanitize(fz_context *ctx, pdf_document *doc, int ascii)
}
}
-/* Initialise the pdf_write_options, used dynamically during the write, from the static
- * fz_write_options, passed into pdf_write_document */
-static void initialise_write_options(fz_context *ctx, pdf_document *doc, const fz_write_options *fz_opts, pdf_write_options *opts)
+/* Initialise the pdf_save_options, used dynamically during the write, from the static
+ * fz_save_options, passed into pdf_save_document */
+static void initialise_write_options(fz_context *ctx, pdf_document *doc, const fz_save_options *fz_opts, pdf_save_options *opts)
{
int num;
int xref_len = pdf_xref_len(ctx, doc);
@@ -2655,7 +2655,7 @@ static void initialise_write_options(fz_context *ctx, pdf_document *doc, const f
}
/* Free the resources held by the dynamic write options */
-static void finalise_write_options(fz_context *ctx, pdf_write_options *opts)
+static void finalise_write_options(fz_context *ctx, pdf_save_options *opts)
{
fz_free(ctx, opts->use_list);
fz_free(ctx, opts->ofs_list);
@@ -2676,10 +2676,10 @@ static void finalise_write_options(fz_context *ctx, pdf_write_options *opts)
fz_drop_output(ctx, opts->out);
}
-void pdf_write_document(fz_context *ctx, pdf_document *doc, char *filename, fz_write_options *fz_opts)
+void pdf_save_document(fz_context *ctx, pdf_document *doc, char *filename, fz_save_options *fz_opts)
{
- fz_write_options opts_defaults = { 0 };
- pdf_write_options opts = { 0 };
+ fz_save_options opts_defaults = { 0 };
+ pdf_save_options opts = { 0 };
int lastfree;
int num;
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index f65edefc..960c1c34 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -2336,7 +2336,7 @@ pdf_new_document(fz_context *ctx, fz_stream *file)
doc->super.count_pages = (fz_document_count_pages_fn *)pdf_count_pages;
doc->super.load_page = (fz_document_load_page_fn *)pdf_load_page;
doc->super.lookup_metadata = (fz_document_lookup_metadata_fn *)pdf_lookup_metadata;
- doc->super.write = (fz_document_write_fn *)pdf_write_document;
+ doc->super.save = (fz_document_save_fn *)pdf_save_document;
doc->update_appearance = pdf_update_appearance;
pdf_lexbuf_init(ctx, &doc->lexbuf.base, PDF_LEXBUF_LARGE);
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index b486171a..f80c2c0e 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -615,11 +615,11 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
if (out_cs == CS_MONO)
{
fz_bitmap *bit = fz_halftone_pixmap(ctx, pix, NULL);
- fz_write_pwg_bitmap(ctx, bit, filename_buf, append, NULL);
+ fz_save_bitmap_as_pwg(ctx, bit, filename_buf, append, NULL);
fz_drop_bitmap(ctx, bit);
}
else
- fz_write_pwg(ctx, pix, filename_buf, append, NULL);
+ fz_save_pixmap_as_pwg(ctx, pix, filename_buf, append, NULL);
append = 1;
}
else if (output_format == OUT_PCL)
@@ -633,21 +633,21 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
if (out_cs == CS_MONO)
{
fz_bitmap *bit = fz_halftone_pixmap(ctx, pix, NULL);
- fz_write_pcl_bitmap(ctx, bit, filename_buf, append, &options);
+ fz_save_bitmap_as_pcl(ctx, bit, filename_buf, append, &options);
fz_drop_bitmap(ctx, bit);
}
else
- fz_write_pcl(ctx, pix, filename_buf, append, &options);
+ fz_save_pixmap_as_pcl(ctx, pix, filename_buf, append, &options);
append = 1;
}
else if (output_format == OUT_PBM) {
fz_bitmap *bit = fz_halftone_pixmap(ctx, pix, NULL);
- fz_write_pbm(ctx, bit, filename_buf);
+ fz_save_bitmap_as_pbm(ctx, bit, filename_buf);
fz_drop_bitmap(ctx, bit);
}
else if (output_format == OUT_TGA)
{
- fz_write_tga(ctx, pix, filename_buf, savealpha);
+ fz_save_pixmap_as_tga(ctx, pix, filename_buf, savealpha);
}
}
ctm.f -= drawheight;
@@ -1094,7 +1094,7 @@ int mudraw_main(int argc, char **argv)
fz_printf(ctx, out, "<document name=\"%s\">\n", filename);
if (output_format == OUT_GPROOF)
{
- fz_write_gproof_file(ctx, filename, doc, output, resolution, "", "");
+ fz_save_gproof(ctx, filename, doc, output, resolution, "", "");
}
else
{
@@ -1130,9 +1130,9 @@ int mudraw_main(int argc, char **argv)
if (pdfout)
{
- fz_write_options opts = { 0 };
+ fz_save_options opts = { 0 };
- pdf_write_document(ctx, pdfout, output, &opts);
+ pdf_save_document(ctx, pdfout, output, &opts);
pdf_close_document(ctx, pdfout);
}
diff --git a/source/tools/pdfclean.c b/source/tools/pdfclean.c
index 7a7f68bc..93ec762d 100644
--- a/source/tools/pdfclean.c
+++ b/source/tools/pdfclean.c
@@ -37,7 +37,7 @@ int pdfclean_main(int argc, char **argv)
char *outfile = "out.pdf";
char *password = "";
int c;
- fz_write_options opts;
+ fz_save_options opts;
int errors = 0;
fz_context *ctx;
diff --git a/source/tools/pdfextract.c b/source/tools/pdfextract.c
index 0c89931a..6f2ed1ca 100644
--- a/source/tools/pdfextract.c
+++ b/source/tools/pdfextract.c
@@ -48,13 +48,13 @@ static void writepixmap(fz_context *ctx, fz_pixmap *pix, char *file, int rgb)
{
snprintf(buf, sizeof(buf), "%s.png", file);
printf("extracting image %s\n", buf);
- fz_write_png(ctx, pix, buf, 0);
+ fz_save_pixmap_as_png(ctx, pix, buf, 0);
}
else
{
snprintf(buf, sizeof(buf), "%s.pam", file);
printf("extracting image %s\n", buf);
- fz_write_pam(ctx, pix, buf, 0);
+ fz_save_pixmap_as_pam(ctx, pix, buf, 0);
}
fz_drop_pixmap(ctx, converted);
diff --git a/source/tools/pdfposter.c b/source/tools/pdfposter.c
index 9a58909e..16bbc080 100644
--- a/source/tools/pdfposter.c
+++ b/source/tools/pdfposter.c
@@ -157,7 +157,7 @@ int pdfposter_main(int argc, char **argv)
char *outfile = "out.pdf";
char *password = "";
int c;
- fz_write_options opts = { 0 };
+ fz_save_options opts = { 0 };
pdf_document *doc;
fz_context *ctx;
@@ -203,7 +203,7 @@ int pdfposter_main(int argc, char **argv)
decimatepages(ctx, doc);
- pdf_write_document(ctx, doc, outfile, &opts);
+ pdf_save_document(ctx, doc, outfile, &opts);
pdf_close_document(ctx, doc);
fz_drop_context(ctx);