/* * Install an ICCBased color space. * * Note that an ICCBased color space must be installed before it is known if * the ICC profile or the alternate color space is to be used. */ static int gx_install_CIEICC(gs_color_space * pcs, gs_state * pgs) { const gs_icc_params * picc_params = (const gs_icc_params *)&pcs->params.icc; gs_cie_icc * picc_info = picc_params->picc_info; #if ENABLE_CUSTOM_COLOR_CALLBACK { /* * Check if we want to use the callback color processing for this * color space. */ client_custom_color_params_t * pcb = (client_custom_color_params_t *) pgs->memory->gs_lib_ctx->custom_color_callback; if (pcb != NULL) { if (pcb->client_procs->install_ICCBased(pcb, pcs, pgs)) /* Exit if the client will handle the colorspace completely */ return 0; } } #endif /* update the stub information used by the joint caches */ gx_cie_load_common_cache(&picc_info->common, pgs); gx_cie_common_complete(&picc_info->common); return gs_cie_cs_complete(pgs, true); }
client_install_ICCtoXYZ(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs) { int code; const gs_icc_params * picc_params = (const gs_icc_params *)&pcs->params.icc; gs_cie_icc * picc_info = picc_params->picc_info; /* update the stub information used by the joint caches */ gx_cie_load_common_cache(&picc_info->common, pgs); gx_cie_common_complete(&picc_info->common); if ((code=gs_cie_cs_complete(pgs, true)) < 0) { client_adjust_cspace_count(pcs, -1); /* free it up */ return false; } return true; }
static bool client_install_ICCtoXYZ(client_custom_color_params_t * pparams, gs_color_space * pcs, gs_state * pgs) { int code; const gs_icc_params * picc_params = (const gs_icc_params *)&pcs->params.icc; gs_cie_icc * picc_info = picc_params->picc_info; demo_color_space_data_t * pdata; if (pcs->pclient_color_space_data != NULL) return true; pdata = allocate_client_data_block(1, pcs->rc.memory->stable_memory); pcs->pclient_color_space_data = (client_color_space_data_t *) pdata; /* Need to initialize the client data. The imager_state is what is needed in pdata->CIEtoXZY_ps */ /* update the stub information used by the joint caches */ gx_cie_load_common_cache(&picc_info->common, pgs); gx_cie_common_complete(&picc_info->common); if ((code=gs_cie_cs_complete(pgs, true)) < 0) { client_adjust_cspace_count(pcs, -1); /* free it up */ return false; } /* Now allocate the conversion imager state in stable_memory */ /* so that the garbage collector won't free it */ code = gx_cie_to_xyz_alloc(&pdata->CIEtoXYZ_pis, pcs, pcs->rc.memory->stable_memory); if (code < 0) { client_adjust_cspace_count(pcs, -1); /* free it up */ return false; } return true; }