summaryrefslogtreecommitdiff
path: root/gs/base/gsicc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gs/base/gsicc.c')
-rw-r--r--gs/base/gsicc.c76
1 files changed, 72 insertions, 4 deletions
diff --git a/gs/base/gsicc.c b/gs/base/gsicc.c
index 6b7ce867e..d1fc60467 100644
--- a/gs/base/gsicc.c
+++ b/gs/base/gsicc.c
@@ -51,6 +51,7 @@ static cs_proc_final(gx_final_ICC);
static cs_proc_serialize(gx_serialize_ICC);
static cs_proc_is_linear(gx_cspace_is_linear_ICC);
static cs_proc_set_overprint(gx_set_overprint_ICC);
+cs_proc_remap_color(gx_remap_ICC_imagelab);
const gs_color_space_type gs_color_space_type_ICC = {
gs_color_space_index_ICC, /* index */
@@ -336,7 +337,8 @@ gx_remap_ICC(const gs_client_color * pcc, const gs_color_space * pcs,
memset(psrc_cm,0,sizeof(unsigned short)*GS_CLIENT_COLOR_MAX_COMPONENTS);
/* This needs to be optimized */
- if (pcs->cmm_icc_profile_data->data_cs == gsCIELAB) {
+ if (pcs->cmm_icc_profile_data->data_cs == gsCIELAB ||
+ pcs->cmm_icc_profile_data->islab) {
psrc[0] = (unsigned short) (pcc->paint.values[0]*65535.0/100.0);
psrc[1] = (unsigned short) ((pcc->paint.values[1]+128)/255.0*65535.0);
psrc[2] = (unsigned short) ((pcc->paint.values[2]+128)/255.0*65535.0);
@@ -390,9 +392,75 @@ gx_remap_ICC(const gs_client_color * pcc, const gs_color_space * pcs,
return 0;
}
- /*
- * Convert an ICCBased color space to a concrete color space.
- */
+/*
+ * Same as above, but there is no rescale of CIELAB colors. This is needed
+ since the rescale is not needed when the source data is image based.
+ The DeviceN image rendering case uses the remap proc vs. the ICC based method
+ which handles the remapping itself.
+ */
+int
+gx_remap_ICC_imagelab(const gs_client_color * pcc, const gs_color_space * pcs,
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
+{
+ gsicc_link_t *icc_link;
+ gsicc_rendering_param_t rendering_params;
+ unsigned short psrc[GS_CLIENT_COLOR_MAX_COMPONENTS], psrc_cm[GS_CLIENT_COLOR_MAX_COMPONENTS];
+ unsigned short *psrc_temp;
+ frac conc[GS_CLIENT_COLOR_MAX_COMPONENTS];
+ int k,i;
+ int num_des_comps;
+ int code;
+ cmm_dev_profile_t *dev_profile;
+
+ code = dev_proc(dev, get_profile)(dev, &dev_profile);
+ num_des_comps = gsicc_get_device_profile_comps(dev_profile);
+ rendering_params.black_point_comp = BP_ON;
+ rendering_params.graphics_type_tag = dev->graphics_type_tag;
+ /* Need to figure out which one rules here on rendering intent. The
+ source of the device */
+ rendering_params.rendering_intent = pis->renderingintent;
+
+ /* Need to clear out psrc_cm in case we have separation bands that are
+ not color managed */
+ memset(psrc_cm,0,sizeof(unsigned short)*GS_CLIENT_COLOR_MAX_COMPONENTS);
+
+ for (k = 0; k < pcs->cmm_icc_profile_data->num_comps; k++)
+ psrc[k] = (unsigned short) (pcc->paint.values[k]*65535.0);
+
+ /* Get a link from the cache, or create if it is not there. Need to get 16 bit profile */
+ icc_link = gsicc_get_link(pis, dev, pcs, NULL, &rendering_params, pis->memory);
+ if (icc_link == NULL) {
+ return gs_rethrow(-1, "Could not create ICC link: Check profiles");
+ }
+ if (icc_link->is_identity) {
+ psrc_temp = &(psrc[0]);
+ } else {
+ /* Transform the color */
+ psrc_temp = &(psrc_cm[0]);
+ (icc_link->procs.map_color)(dev, icc_link, psrc, psrc_temp, 2);
+ }
+ /* Release the link */
+ gsicc_release_link(icc_link);
+ /* Now do the remap for ICC which amounts to the alpha application
+ the transfer function and potentially the halftoning */
+ /* Right now we need to go from unsigned short to frac. I really
+ would like to avoid this sort of stuff. That will come. */
+ for ( k = 0; k < num_des_comps; k++){
+ conc[k] = ushort2frac(psrc_temp[k]);
+ }
+ gx_remap_concrete_ICC(conc, pcs, pdc, pis, dev, select);
+
+ /* Save original color space and color info into dev color */
+ i = pcs->cmm_icc_profile_data->num_comps;
+ for (i--; i >= 0; i--)
+ pdc->ccolor.paint.values[i] = pcc->paint.values[i];
+ pdc->ccolor_valid = true;
+ return 0;
+}
+
+/* Convert an ICCBased color space to a concrete color space. */
+
static int
gx_concretize_ICC(
const gs_client_color * pcc,