summaryrefslogtreecommitdiff
path: root/include/mupdf/fitz
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2018-01-04 15:11:24 +0000
committerPaul Gardiner <paul.gardiner@artifex.com>2018-01-19 13:52:25 +0000
commit457873fbf7fd6d40242722f3a51b41428302d0ca (patch)
tree2539ea3bc1490012f5f5bd95d0f9064d999eca04 /include/mupdf/fitz
parent371890461adeff0bcc8d4986f666c59055bebc70 (diff)
downloadmupdf-457873fbf7fd6d40242722f3a51b41428302d0ca.tar.xz
Add fz_output_as_stream
This provides a way for some output streams to also be read, a feature needed for the sake of document signing. Currently this is supported only for file output.
Diffstat (limited to 'include/mupdf/fitz')
-rw-r--r--include/mupdf/fitz/output.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/mupdf/fitz/output.h b/include/mupdf/fitz/output.h
index 0425e353..2530be47 100644
--- a/include/mupdf/fitz/output.h
+++ b/include/mupdf/fitz/output.h
@@ -5,6 +5,7 @@
#include "mupdf/fitz/context.h"
#include "mupdf/fitz/buffer.h"
#include "mupdf/fitz/string-util.h"
+#include "mupdf/fitz/stream.h"
/*
Generic output streams - generalise between outputting to a file,
@@ -62,6 +63,13 @@ typedef void (fz_output_close_fn)(fz_context *ctx, void *state);
*/
typedef void (fz_output_drop_fn)(fz_context *ctx, void *state);
+/*
+ fz_stream_from_output_fn: A function type for use when implementing
+ fz_outputs. The supplied function of this type is called
+ when the fz_stream_from_output is called.
+*/
+typedef fz_stream *(fz_stream_from_output_fn)(fz_context *ctx, void *state);
+
struct fz_output_s
{
@@ -71,6 +79,7 @@ struct fz_output_s
fz_output_tell_fn *tell;
fz_output_close_fn *close;
fz_output_drop_fn *drop;
+ fz_stream_from_output_fn *as_stream;
};
/*
@@ -172,6 +181,16 @@ void fz_close_output(fz_context *, fz_output *);
void fz_drop_output(fz_context *, fz_output *);
/*
+ fz_stream_from_output: obtain the fz_output in the form of a fz_stream
+
+ This allows data to be read back from some forms of fz_output object.
+ When finished reading, the fz_stream should be released by calling
+ fz_drop_stream. Until the fz_stream is dropped, no further operations
+ should be performed on the fz_output object.
+*/
+fz_stream *fz_stream_from_output(fz_context *, fz_output *);
+
+/*
fz_write_data: Write data to output.
data: Pointer to data to write.