Esempio n. 1
0
int
gs_push_pdf14trans_device(gs_state * pgs, bool is_pattern)
{
    gs_pdf14trans_params_t params = { 0 };
    cmm_profile_t *icc_profile;
    gsicc_rendering_intents_t rendering_intent;
    int code;
    cmm_dev_profile_t *dev_profile;

    code = dev_proc(pgs->device, get_profile)(pgs->device,  &dev_profile);
    gsicc_extract_profile(GS_UNKNOWN_TAG, dev_profile, &icc_profile,
                          &rendering_intent);

    params.pdf14_op = PDF14_PUSH_DEVICE;
    /*
     * We really only care about the number of spot colors when we have
     * a device which supports spot colors.  With the other devices we use
     * the tint transform function for DeviceN and Separation color spaces
     * and convert spot colors into process colors.
     */
    params.num_spot_colors = get_num_pdf14_spot_colors(pgs);
    params.is_pattern = is_pattern;
    /* If we happen to be in a situation where we are going out to a device
       whose profile is CIELAB then we will need to make sure that we
       do our blending in RGB and convert to CIELAB when we do the put_image
       command */
    if (icc_profile->data_cs == gsCIELAB ||
        icc_profile->islab) {
        params.iccprofile = pgs->icc_manager->default_rgb;
    }
    /* Note: Other parameters not used */
    return gs_state_update_pdf14trans(pgs, &params);
}
Esempio n. 2
0
/*
 * Note:  The color space (pcs) has already been modified to use the
 * alternate color space.
 */
void
capture_spot_equivalent_cmyk_colors(gx_device * pdev, const gs_state * pgs,
    const gs_client_color * pcc, const gs_color_space * pcs,
    int sep_num, equivalent_cmyk_color_params * pparams)
{
    gs_imager_state temp_state = *((const gs_imager_state *)pgs);
    color_capture_device temp_device = { 0 };
    gx_device_color dev_color;
    gsicc_rendering_intents_t rendering_intent;
    int code;
    cmm_dev_profile_t *dev_profile;
    cmm_profile_t *curr_output_profile;
    cmm_dev_profile_t temp_profile;

    code = dev_proc(pdev, get_profile)(pdev, &dev_profile);
    gsicc_extract_profile(pdev->graphics_type_tag,
                          dev_profile, &(curr_output_profile),
                          &rendering_intent);
    /*
     * Create a temp device.  The primary purpose of this device is pass the
     * separation number and a pointer to the original device's equivalent
     * color parameters.  Since we only using this device for a very specific
     * purpose, we only set up the color_info structure and our data.
     */
    temp_device.color_info = pdev->color_info;
    temp_device.sep_num = sep_num;
    temp_device.pequiv_cmyk_colors = pparams;
    temp_device.memory = pgs->memory; 

    temp_profile.usefastcolor = false;  /* This avoids a few headaches */
    temp_profile.device_profile[0] = curr_output_profile;
    temp_profile.device_profile[1] = NULL;
    temp_profile.device_profile[2] = NULL;
    temp_profile.device_profile[2] = NULL;
    temp_profile.link_profile = NULL;
    temp_profile.proof_profile = NULL;
    temp_device.icc_struct = &temp_profile;
    set_dev_proc(&temp_device, get_profile, gx_default_get_profile);

    /*
     * Create a temp copy of the imager state.  We do this so that we
     * can modify the color space mapping (cmap) procs.  We use our
     * replacment procs to capture the color.  The installation of a
     * Separation or DeviceN color space also sets a use_alt_cspace flag
     * in the state.  We also need to set this to use the alternate space.
     */
    temp_state.cmap_procs = &cmap_capture_cmyk_color;
    temp_state.color_component_map.use_alt_cspace = true;

    /* Now capture the color */
    pcs->type->remap_color (pcc, pcs, &dev_color, &temp_state, 
                            (gx_device *)&temp_device, gs_color_select_texture);
}