29.2 ICC-based colorspaces

If you have an ICC profile for your colorspace, then you can call one of these functions:

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);

They all load the ICC profile from the specified source, and create the ICC based fz_colorspace.

Unfortunately, in non-ICC based workflows, ICC profiles can’t be loaded. This means that document handlers have to be prepared to ‘fall back’ to a non-ICC based approximation. This has to be done at the document handler level; for example the PDF agent calls fz_get_cmm_engine, and if it returns NULL, drops back to the alternate specified space.