diff options
-rw-r--r-- | include/mupdf/fitz/colorspace.h | 1 | ||||
-rw-r--r-- | source/fitz/colorspace.c | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/mupdf/fitz/colorspace.h b/include/mupdf/fitz/colorspace.h index ec599493..32a8f846 100644 --- a/include/mupdf/fitz/colorspace.h +++ b/include/mupdf/fitz/colorspace.h @@ -198,6 +198,7 @@ struct fz_cal_colorspace_s { */ fz_colorspace *fz_new_icc_colorspace(fz_context *ctx, const char *name, int num, fz_buffer *buf); fz_colorspace *fz_new_icc_colorspace_from_file(fz_context *ctx, const char *name, const char *path); +fz_colorspace *fz_new_icc_colorspace_from_stream(fz_context *ctx, const char *name, fz_stream *in); fz_colorspace *fz_new_cal_colorspace(fz_context *ctx, const char *name, float *wp, float *bp, float *gamma, float *matrix); fz_buffer *fz_new_icc_data_from_cal_colorspace(fz_context *ctx, fz_cal_colorspace *cal); fz_buffer *fz_icc_data_from_icc_colorspace(fz_context *ctx, const fz_colorspace *cs); diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c index 0241742e..1955cd10 100644 --- a/source/fitz/colorspace.c +++ b/source/fitz/colorspace.c @@ -3735,6 +3735,19 @@ fz_colorspace *fz_new_icc_colorspace_from_file(fz_context *ctx, const char *name return cs; } +fz_colorspace *fz_new_icc_colorspace_from_stream(fz_context *ctx, const char *name, fz_stream *in) +{ + fz_colorspace *cs = NULL; + fz_buffer *buffer = fz_read_all(ctx, in, 1024); + fz_try(ctx) + cs = fz_new_icc_colorspace(ctx, name, 0, buffer); + fz_always(ctx) + fz_drop_buffer(ctx, buffer); + fz_catch(ctx) + fz_rethrow(ctx); + return cs; +} + /* Gets the icc data from a color space. Used in the writing out of the icc * data for output formats. */ |