MissingDelegateWarning,"DelegateLibrarySupportNotBuiltIn","`%s' (LCMS)",
image->filename);
#else
- if (icc_profile != (StringInfo *) NULL)
+ if ((icc_profile != (StringInfo *) NULL) ||
+ (cmsGetDeviceClass(profile) == cmsSigLinkClass))
{
CacheView
*image_view;
/*
Transform pixel colors as defined by the color profiles.
*/
+ exception=(&image->exception);
#if defined(LCMS_VERSION) && (LCMS_VERSION >= 2000)
cmsSetLogErrorHandler(LCMSErrorHandler);
#endif
(void) cmsErrorAction(LCMS_ERROR_SHOW);
#endif
#endif
- source_profile=cmsOpenProfileFromMem(GetStringInfoDatum(icc_profile),
- (cmsUInt32Number) GetStringInfoLength(icc_profile));
- target_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
- (cmsUInt32Number) GetStringInfoLength(profile));
- if ((source_profile == (cmsHPROFILE) NULL) ||
- (target_profile == (cmsHPROFILE) NULL))
- ThrowBinaryException(ResourceLimitError,
- "ColorspaceColorProfileMismatch",name);
+ if (icc_profile == (StringInfo *) NULL)
+ {
+ /*
+ Device link profile, embeds source and target transforms.
+ */
+ source_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
+ (cmsUInt32Number) GetStringInfoLength(profile));
+ if (source_profile == (cmsHPROFILE) NULL)
+ ThrowBinaryException(ResourceLimitError,
+ "ColorspaceColorProfileMismatch",name);
+ }
+ else
+ {
+ source_profile=cmsOpenProfileFromMem(
+ GetStringInfoDatum(icc_profile),(cmsUInt32Number)
+ GetStringInfoLength(icc_profile));
+ target_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
+ (cmsUInt32Number) GetStringInfoLength(profile));
+ if ((source_profile == (cmsHPROFILE) NULL) ||
+ (target_profile == (cmsHPROFILE) NULL))
+ ThrowBinaryException(ResourceLimitError,
+ "ColorspaceColorProfileMismatch",name);
+ }
switch (cmsGetColorSpace(source_profile))
{
case cmsSigCmykData:
break;
}
}
- switch (cmsGetColorSpace(target_profile))
- {
- case cmsSigCmykData:
- {
- target_colorspace=CMYKColorspace;
- target_type=(cmsUInt32Number) TYPE_CMYK_16;
- target_channels=4;
- break;
- }
- case cmsSigLabData:
- {
- target_colorspace=LabColorspace;
- target_type=(cmsUInt32Number) TYPE_Lab_16;
- target_channels=3;
- break;
- }
- case cmsSigGrayData:
- {
- target_colorspace=GRAYColorspace;
- target_type=(cmsUInt32Number) TYPE_GRAY_16;
- target_channels=1;
- break;
- }
- case cmsSigLuvData:
- {
- target_colorspace=YUVColorspace;
- target_type=(cmsUInt32Number) TYPE_YUV_16;
- target_channels=3;
- break;
- }
- case cmsSigRgbData:
- {
- target_colorspace=RGBColorspace;
- target_type=(cmsUInt32Number) TYPE_RGB_16;
- target_channels=3;
- break;
- }
- case cmsSigXYZData:
- {
- target_colorspace=XYZColorspace;
- target_type=(cmsUInt32Number) TYPE_XYZ_16;
- target_channels=3;
- break;
- }
- case cmsSigYCbCrData:
+ target_colorspace=source_colorspace;
+ target_type=source_type;
+ target_channels=source_channels;
+ if (target_profile != (cmsHPROFILE) NULL)
{
- target_colorspace=YCbCrColorspace;
- target_type=(cmsUInt32Number) TYPE_YCbCr_16;
- target_channels=3;
- break;
- }
- default:
- {
- target_colorspace=UndefinedColorspace;
- target_type=(cmsUInt32Number) TYPE_RGB_16;
- target_channels=3;
- break;
+ switch (cmsGetColorSpace(target_profile))
+ {
+ case cmsSigCmykData:
+ {
+ target_colorspace=CMYKColorspace;
+ target_type=(cmsUInt32Number) TYPE_CMYK_16;
+ target_channels=4;
+ break;
+ }
+ case cmsSigLabData:
+ {
+ target_colorspace=LabColorspace;
+ target_type=(cmsUInt32Number) TYPE_Lab_16;
+ target_channels=3;
+ break;
+ }
+ case cmsSigGrayData:
+ {
+ target_colorspace=GRAYColorspace;
+ target_type=(cmsUInt32Number) TYPE_GRAY_16;
+ target_channels=1;
+ break;
+ }
+ case cmsSigLuvData:
+ {
+ target_colorspace=YUVColorspace;
+ target_type=(cmsUInt32Number) TYPE_YUV_16;
+ target_channels=3;
+ break;
+ }
+ case cmsSigRgbData:
+ {
+ target_colorspace=RGBColorspace;
+ target_type=(cmsUInt32Number) TYPE_RGB_16;
+ target_channels=3;
+ break;
+ }
+ case cmsSigXYZData:
+ {
+ target_colorspace=XYZColorspace;
+ target_type=(cmsUInt32Number) TYPE_XYZ_16;
+ target_channels=3;
+ break;
+ }
+ case cmsSigYCbCrData:
+ {
+ target_colorspace=YCbCrColorspace;
+ target_type=(cmsUInt32Number) TYPE_YCbCr_16;
+ target_channels=3;
+ break;
+ }
+ default:
+ {
+ target_colorspace=UndefinedColorspace;
+ target_type=(cmsUInt32Number) TYPE_RGB_16;
+ target_channels=3;
+ break;
+ }
+ }
+ if ((source_colorspace == UndefinedColorspace) ||
+ (target_colorspace == UndefinedColorspace))
+ ThrowProfileException(ImageError,
+ "ColorspaceColorProfileMismatch",name);
+ if ((source_colorspace == GRAYColorspace) &&
+ (IsGrayImage(image,exception) == MagickFalse))
+ ThrowProfileException(ImageError,
+ "ColorspaceColorProfileMismatch",name);
+ if ((source_colorspace == CMYKColorspace) &&
+ (image->colorspace != CMYKColorspace))
+ ThrowProfileException(ImageError,
+ "ColorspaceColorProfileMismatch",name);
+ if ((source_colorspace == XYZColorspace) &&
+ (image->colorspace != XYZColorspace))
+ ThrowProfileException(ImageError,
+ "ColorspaceColorProfileMismatch",name);
+ if ((source_colorspace == YCbCrColorspace) &&
+ (image->colorspace != YCbCrColorspace))
+ ThrowProfileException(ImageError,
+ "ColorspaceColorProfileMismatch",name);
+ if ((source_colorspace != CMYKColorspace) &&
+ (source_colorspace != GRAYColorspace) &&
+ (source_colorspace != LabColorspace) &&
+ (source_colorspace != XYZColorspace) &&
+ (source_colorspace != YCbCrColorspace) &&
+ (image->colorspace != RGBColorspace))
+ ThrowProfileException(ImageError,
+ "ColorspaceColorProfileMismatch",name);
}
- }
- exception=(&image->exception);
- if ((source_colorspace == UndefinedColorspace) ||
- (target_colorspace == UndefinedColorspace))
- ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
- name);
- if ((source_colorspace == GRAYColorspace) &&
- (IsGrayImage(image,exception) == MagickFalse))
- ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
- name);
- if ((source_colorspace == CMYKColorspace) &&
- (image->colorspace != CMYKColorspace))
- ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
- name);
- if ((source_colorspace == XYZColorspace) &&
- (image->colorspace != XYZColorspace))
- ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
- name);
- if ((source_colorspace == YCbCrColorspace) &&
- (image->colorspace != YCbCrColorspace))
- ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
- name);
- if ((source_colorspace != CMYKColorspace) &&
- (source_colorspace != GRAYColorspace) &&
- (source_colorspace != LabColorspace) &&
- (source_colorspace != XYZColorspace) &&
- (source_colorspace != YCbCrColorspace) &&
- (image->colorspace != RGBColorspace))
- ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
- name);
switch (image->rendering_intent)
{
case AbsoluteIntent: intent=INTENT_ABSOLUTE_COLORIMETRIC; break;