diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-04-12 15:54:22 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-04-26 15:12:57 +0200 |
commit | 38d0278ffd22928cfcc66516a5f5a75f2480e702 (patch) | |
tree | 1ca80dadfab5ffb41eeb00808c715b53739f4786 /source/fitz/writer.c | |
parent | ebba90e528308e2e5bfdc69b24ed9dd32d42121a (diff) | |
download | mupdf-38d0278ffd22928cfcc66516a5f5a75f2480e702.tar.xz |
Add 'mutool convert' and new document writer interface.
Only supports CBZ writing for now.
Also add a zip file writer.
Diffstat (limited to 'source/fitz/writer.c')
-rw-r--r-- | source/fitz/writer.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/fitz/writer.c b/source/fitz/writer.c new file mode 100644 index 00000000..a127a47d --- /dev/null +++ b/source/fitz/writer.c @@ -0,0 +1,38 @@ +#include "mupdf/fitz.h" + +fz_document_writer * +fz_new_document_writer(fz_context *ctx, const char *path, const char *format, const char *options) +{ + if (!format) + { + format = strrchr(path, '.'); + if (!format) + fz_throw(ctx, FZ_ERROR_GENERIC, "cannot detect document format"); + format += 1; /* skip the '.' */ + } + + if (!strcasecmp(format, "cbz")) + return fz_new_cbz_writer(ctx, path, options); + + fz_throw(ctx, FZ_ERROR_GENERIC, "unknown document format: %s", format); +} + +void +fz_drop_document_writer(fz_context *ctx, fz_document_writer *wri) +{ + if (wri->drop_imp) + wri->drop_imp(ctx, wri); + fz_free(ctx, wri); +} + +fz_device * +fz_begin_page(fz_context *ctx, fz_document_writer *wri, const fz_rect *mediabox, fz_matrix *ctm) +{ + return wri->begin_page(ctx, wri, mediabox, ctm); +} + +void +fz_end_page(fz_context *ctx, fz_document_writer *wri, fz_device *dev) +{ + return wri->end_page(ctx, wri, dev); +} |