/* Common code shared between remap and concretize for defg */ static int gx_ciedefg_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, gs_memory_t *memory) { int code = 0; gs_color_space *palt_cs = pcs->base_space; gx_cie_vector_cache *abc_caches = &(pcs->params.abc->caches.DecodeABC.caches[0]); gx_cie_scalar_cache *lmn_caches = &(pcs->params.abc->common.caches.DecodeLMN[0]); gx_cie_scalar_cache *defg_caches = &(pcs->params.defg->caches_defg.DecodeDEFG[0]); if_debug0(gs_debug_flag_icc,"[icc] Creating ICC profile from defg object"); /* build the ICC color space object */ code = gs_cspace_build_ICC(ppcs_icc, NULL, memory->stable_memory); /* record the cie alt space as the icc alternative color space */ (*ppcs_icc)->base_space = palt_cs; rc_increment_cs(palt_cs); (*ppcs_icc)->cmm_icc_profile_data = gsicc_profile_new(NULL, memory, NULL, 0); code = gsicc_create_fromdefg(pcs, &((*ppcs_icc)->cmm_icc_profile_data->buffer), &((*ppcs_icc)->cmm_icc_profile_data->buffer_size), memory, abc_caches, lmn_caches, defg_caches); gsicc_init_profile_info((*ppcs_icc)->cmm_icc_profile_data); (*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_DEFG; pcs->icc_equivalent = *ppcs_icc; pcs->icc_equivalent->cmm_icc_profile_data->data_cs = gsCMYK; return(0); }
/* Common code shared between remap and concretize */ static int gx_ciea_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, gs_memory_t *memory) { int code = 0; gs_color_space *palt_cs = pcs->base_space; gx_cie_vector_cache *a_cache = &(pcs->params.a->caches.DecodeA); gx_cie_scalar_cache *lmn_caches = &(pcs->params.a->common.caches.DecodeLMN[0]); if_debug0(gs_debug_flag_icc,"[icc] Creating ICC profile from CIEA object"); /* build the ICC color space object */ code = gs_cspace_build_ICC(ppcs_icc, NULL, memory); /* record the cie alt space as the icc alternative color space */ (*ppcs_icc)->base_space = palt_cs; rc_increment_cs(palt_cs); (*ppcs_icc)->cmm_icc_profile_data = gsicc_profile_new(NULL, memory, NULL, 0); code = gsicc_create_froma(pcs, &((*ppcs_icc)->cmm_icc_profile_data->buffer), &((*ppcs_icc)->cmm_icc_profile_data->buffer_size), memory, a_cache, lmn_caches); gsicc_init_profile_info((*ppcs_icc)->cmm_icc_profile_data); (*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_A; /* Assign to the icc_equivalent member variable */ pcs->icc_equivalent = *ppcs_icc; pcs->icc_equivalent->cmm_icc_profile_data->data_cs = gsGRAY; return(code); }
/* Common code shared between remap and concretize */ static int gx_cieabc_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, bool *islab, gs_memory_t *memory) { int code; gs_color_space *palt_cs = pcs->base_space; gx_cie_vector_cache *abc_caches = &(pcs->params.abc->caches.DecodeABC.caches[0]); gx_cie_scalar_cache *lmn_caches = &(pcs->params.abc->common.caches.DecodeLMN[0]); if_debug0m(gs_debug_flag_icc, memory, "[icc] Creating ICC profile from abc object"); /* build the ICC color space object */ code = gs_cspace_build_ICC(ppcs_icc, NULL, memory); if (code < 0) return gs_rethrow(code, "Failed to create ICC profile"); /* record the cie alt space as the icc alternative color space */ (*ppcs_icc)->base_space = palt_cs; rc_increment_cs(palt_cs); (*ppcs_icc)->cmm_icc_profile_data = gsicc_profile_new(NULL, memory, NULL, 0); if ((*ppcs_icc)->cmm_icc_profile_data == NULL) gs_throw(gs_error_VMerror, "Failed to create ICC profile"); code = gsicc_create_fromabc(pcs, &((*ppcs_icc)->cmm_icc_profile_data->buffer), &((*ppcs_icc)->cmm_icc_profile_data->buffer_size), memory, abc_caches, lmn_caches, islab); if (code < 0) return gs_rethrow(code, "Failed to build ICC profile from CIEABC"); code = gsicc_init_profile_info((*ppcs_icc)->cmm_icc_profile_data); if (code < 0) return gs_rethrow(code, "Failed to build ICC profile from CIEDEF"); (*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_ABC; /* Assign to the icc_equivalent member variable */ pcs->icc_equivalent = *ppcs_icc; pcs->icc_equivalent->cmm_icc_profile_data->data_cs = gsRGB; return 0; }