diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-10-16 14:11:26 +0200 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2017-10-24 15:16:36 +0100 |
commit | a336a599666e34a438852d22d068a2267465376e (patch) | |
tree | 39ef9cfeb1da62d28dddb3ed150a8b1daa69422d | |
parent | f2e0ab5afee63d9f446f37201291010e68282cc4 (diff) | |
download | mupdf-a336a599666e34a438852d22d068a2267465376e.tar.xz |
Make a public fz_new_icc_colorspace_from_file function.
-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 7bd87adf..2374feec 100644 --- a/include/mupdf/fitz/colorspace.h +++ b/include/mupdf/fitz/colorspace.h @@ -196,6 +196,7 @@ struct fz_cal_colorspace_s { icc methods */ 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_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 da4a4f29..17892256 100644 --- a/source/fitz/colorspace.c +++ b/source/fitz/colorspace.c @@ -3701,6 +3701,19 @@ fz_new_icc_colorspace(fz_context *ctx, const char *name, int num, fz_buffer *buf return cs; } +fz_colorspace *fz_new_icc_colorspace_from_file(fz_context *ctx, const char *name, const char *path) +{ + fz_colorspace *cs = NULL; + fz_buffer *buffer = fz_read_file(ctx, path); + 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. */ |