Commit 2622d0fc authored by cristy's avatar cristy

git-svn-id:...

git-svn-id: https://subversion.imagemagick.org/subversion/ImageMagick/trunk@1546 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74
parent a4c79d99
......@@ -247,9 +247,15 @@
/* Define to 1 if you have the `j1' function. */
#undef HAVE_J1
/* Define if you have the <lcms2.h> header file. */
#undef HAVE_LCMS2_H
/* Define if you have the <lcms.h> header file. */
#undef HAVE_LCMS_H
/* Define if you have the <lcms/lcms2.h> header file. */
#undef HAVE_LCMS_LCMS2_H
/* Define if you have the <lcms/lcms.h> header file. */
#undef HAVE_LCMS_LCMS_H
......
......@@ -26498,9 +26498,9 @@ if test "$have_fontconfig" = 'yes'; then
$as_echo "#define FONTCONFIG_DELEGATE 1" >>confdefs.h
if test "$with_modules" = 'no'; then
if test "$with_modules" = 'no'; then
CPPFLAGS="$FONTCONFIG_CFLAGS $CPPFLAGS"
fi
fi
fi
if test "$have_fontconfig" = 'yes'; then
......@@ -27441,6 +27441,109 @@ $as_echo "-------------------------------------------------------------" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LCMS" >&5
$as_echo_n "checking for LCMS... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
$as_echo "" >&6; }
failed=0
passed=0
have_lcms_header='no'
ac_fn_c_check_header_mongrel "$LINENO" "lcms2.h" "ac_cv_header_lcms2_h" "$ac_includes_default"
if test "x$ac_cv_header_lcms2_h" = x""yes; then :
have_lcms_header='yes'
fi
if test "$have_lcms_header" = 'yes'; then
passed=`expr $passed + 1`
$as_echo "#define HAVE_LCMS2_H 1" >>confdefs.h
else
ac_fn_c_check_header_mongrel "$LINENO" "lcms/lcms2.h" "ac_cv_header_lcms_lcms2_h" "$ac_includes_default"
if test "x$ac_cv_header_lcms_lcms2_h" = x""yes; then :
have_lcms_header='yes'
fi
if test "$have_lcms_header" = 'yes'; then
passed=`expr $passed + 1`
$as_echo "#define HAVE_LCMS_LCMS2_H 1" >>confdefs.h
else
failed=`expr $failed + 1`
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cmsOpenProfileFromMem in -llcms2" >&5
$as_echo_n "checking for cmsOpenProfileFromMem in -llcms2... " >&6; }
if test "${ac_cv_lib_lcms2_cmsOpenProfileFromMem+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-llcms2 $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char cmsOpenProfileFromMem ();
int
main ()
{
return cmsOpenProfileFromMem ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_lcms2_cmsOpenProfileFromMem=yes
else
ac_cv_lib_lcms2_cmsOpenProfileFromMem=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lcms2_cmsOpenProfileFromMem" >&5
$as_echo "$ac_cv_lib_lcms2_cmsOpenProfileFromMem" >&6; }
if test "x$ac_cv_lib_lcms2_cmsOpenProfileFromMem" = x""yes; then :
passed=`expr $passed + 1`
else
failed=`expr $failed + 1`
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if LCMS2 package is complete" >&5
$as_echo_n "checking if LCMS2 package is complete... " >&6; }
if test $passed -gt 0; then
if test $failed -gt 0; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no -- some components failed test" >&5
$as_echo "no -- some components failed test" >&6; }
have_lcms='no (failed tests)'
else
LCMS_LIBS='-llcms2'
LIBS="$LCMS_LIBS $LIBS"
$as_echo "#define LCMS_DELEGATE 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
have_lcms='yes'
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test "$with_lcms" != 'no'; then
if test "$have_lcms" == 'no'; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: -------------------------------------------------------------" >&5
$as_echo "-------------------------------------------------------------" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LCMS" >&5
$as_echo_n "checking for LCMS... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
$as_echo "" >&6; }
failed=0
passed=0
......@@ -27535,6 +27638,7 @@ $as_echo "yes" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
fi
if test "$have_lcms" = 'yes'; then
LCMS_DELEGATE_TRUE=
......
......@@ -1719,10 +1719,10 @@ if test "x$with_fontconfig" = "xyes"; then
fi
if test "$have_fontconfig" = 'yes'; then
AC_DEFINE(FONTCONFIG_DELEGATE,1,Define if you have FONTCONFIG library)
if test "$with_modules" = 'no'; then
AC_DEFINE(FONTCONFIG_DELEGATE,1,Define if you have FONTCONFIG library)
if test "$with_modules" = 'no'; then
CPPFLAGS="$FONTCONFIG_CFLAGS $CPPFLAGS"
fi
fi
fi
AM_CONDITIONAL(FONTCONFIG_DELEGATE,test "$have_fontconfig" = 'yes')
......@@ -2102,6 +2102,45 @@ fi
have_lcms='no'
LCMS_LIBS=''
if test "$with_lcms" != 'no'; then
AC_MSG_RESULT([-------------------------------------------------------------])
AC_MSG_CHECKING([for LCMS])
AC_MSG_RESULT([])
failed=0
passed=0
have_lcms_header='no'
AC_CHECK_HEADER(lcms2.h,have_lcms_header='yes',,)
if test "$have_lcms_header" = 'yes'; then
passed=`expr $passed + 1`
AC_DEFINE(HAVE_LCMS2_H,1,Define if you have the <lcms2.h> header file.)
else
AC_CHECK_HEADER(lcms/lcms2.h,have_lcms_header='yes',,)
if test "$have_lcms_header" = 'yes'; then
passed=`expr $passed + 1`
AC_DEFINE(HAVE_LCMS_LCMS2_H,1,Define if you have the <lcms/lcms2.h> header file.)
else
failed=`expr $failed + 1`
fi
fi
AC_CHECK_LIB(lcms2,cmsOpenProfileFromMem,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
AC_MSG_CHECKING([if LCMS2 package is complete])
if test $passed -gt 0; then
if test $failed -gt 0; then
AC_MSG_RESULT([no -- some components failed test])
have_lcms='no (failed tests)'
else
LCMS_LIBS='-llcms2'
LIBS="$LCMS_LIBS $LIBS"
AC_DEFINE(LCMS_DELEGATE,1,Define if you have LCMS library)
AC_MSG_RESULT([yes])
have_lcms='yes'
fi
else
AC_MSG_RESULT([no])
fi
fi
if test "$with_lcms" != 'no'; then
if test "$have_lcms" == 'no'; then
AC_MSG_RESULT([-------------------------------------------------------------])
AC_MSG_CHECKING([for LCMS])
AC_MSG_RESULT([])
......@@ -2138,6 +2177,7 @@ if test "$with_lcms" != 'no'; then
AC_MSG_RESULT([no])
fi
fi
fi
AM_CONDITIONAL(LCMS_DELEGATE, test "$have_lcms" = 'yes')
AC_SUBST(LCMS_LIBS)
......
......@@ -94,13 +94,26 @@
#include "magick/utility.h"
#include "magick/version.h"
#if defined(MAGICKCORE_LCMS_DELEGATE)
#if defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
#if defined(MAGICKCORE_HAVE_LCMS_LCMS2_H)
#include <lcms/lcms2.h>
#elif defined(MAGICKCORE_HAVE_LCMS2_H)
#include "lcms2.h"
#elif defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
#include <lcms/lcms.h>
#else
#include "lcms.h"
#endif
#endif
/*
Define declarations.
*/
#if defined(MAGICKCORE_LCMS_DELEGATE)
#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
#define cmsUInt32Number DWORD
#endif
#endif
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
......@@ -850,15 +863,33 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
icc_profile;
icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
(DWORD) GetStringInfoLength(profile));
(cmsUInt32Number) GetStringInfoLength(profile));
if (icc_profile != (cmsHPROFILE *) NULL)
{
#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
const char
*name;
name=cmsTakeProductName(icc_profile);
if (name != (const char *) NULL)
(void) fprintf(file," %s\n",name);
#else
char
info[MaxTextExtent];
(void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
"en","US",info,MaxTextExtent);
(void) fprintf(file," Description: %s\n",info);
(void) cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
"en","US",info,MaxTextExtent);
(void) fprintf(file," Manufacturer: %s\n",info);
(void) cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,"en",
"US",info,MaxTextExtent);
(void) fprintf(file," Model: %s\n",info);
(void) cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
"en","US",info,MaxTextExtent);
(void) fprintf(file," Copyright: %s\n",info);
#endif
(void) cmsCloseProfile(icc_profile);
}
}
......
......@@ -372,11 +372,17 @@
#define MAGICKCORE_HAVE_J1 1
#endif
/* Define if you have the <lcms2.h> header file. */
/* #undef HAVE_LCMS2_H */
/* Define if you have the <lcms.h> header file. */
#ifndef MAGICKCORE_HAVE_LCMS_H
#define MAGICKCORE_HAVE_LCMS_H 1
#endif
/* Define if you have the <lcms/lcms2.h> header file. */
/* #undef HAVE_LCMS_LCMS2_H */
/* Define if you have the <lcms/lcms.h> header file. */
/* #undef HAVE_LCMS_LCMS_H */
......
......@@ -61,13 +61,35 @@
#include "magick/token.h"
#include "magick/utility.h"
#if defined(MAGICKCORE_LCMS_DELEGATE)
#if defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
#if defined(MAGICKCORE_HAVE_LCMS_LCMS2_H)
#include <wchar.h>
#include <lcms/lcms2.h>
#elif defined(MAGICKCORE_HAVE_LCMS2_H)
#include <wchar.h>
#include "lcms2.h"
#elif defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
#include <lcms/lcms.h>
#else
#include "lcms.h"
#endif
#endif
/*
* Define declarations.
* */
#if defined(MAGICKCORE_LCMS_DELEGATE)
#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
#define cmsUInt32Number DWORD
#define cmsSigCmykData icSigCmykData
#define cmsSigGrayData icSigGrayData
#define cmsSigLabData icSigLabData
#define cmsSigLuvData icSigLuvData
#define cmsSigRgbData icSigRgbData
#define cmsSigXYZData icSigXYZData
#define cmsSigYCbCrData icSigYCbCrData
#endif
#endif
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
......@@ -367,9 +389,9 @@ static cmsHTRANSFORM *DestroyTransformThreadSet(cmsHTRANSFORM *transform)
}
static cmsHTRANSFORM *AcquireTransformThreadSet(
const cmsHPROFILE source_profile,const DWORD source_type,
const cmsHPROFILE target_profile,const DWORD target_type,const int intent,
const DWORD flags)
const cmsHPROFILE source_profile,const cmsUInt32Number source_type,
const cmsHPROFILE target_profile,const cmsUInt32Number target_type,const int intent,
const cmsUInt32Number flags)
{
cmsHTRANSFORM
*transform;
......@@ -782,6 +804,7 @@ static MagickBooleanType SetsRGBImageProfile(Image *image)
return(status);
}
#if defined(MAGICKCORE_LCMS_DELEGATE)
#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
#if defined(LCMS_VERSION) && (LCMS_VERSION > 1010)
static int LCMSErrorHandler(int severity,const char *message)
{
......@@ -791,6 +814,7 @@ static int LCMSErrorHandler(int severity,const char *message)
}
#endif
#endif
#endif
MagickExport MagickBooleanType ProfileImage(Image *image,const char *name,
const void *datum,const size_t length,
......@@ -913,7 +937,7 @@ MagickExport MagickBooleanType ProfileImage(Image *image,const char *name,
cmsHTRANSFORM
*restrict transform;
DWORD
cmsUInt32Number
flags,
source_type,
target_type;
......@@ -943,133 +967,135 @@ MagickExport MagickBooleanType ProfileImage(Image *image,const char *name,
/*
Transform pixel colors as defined by the color profiles.
*/
#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
#if defined(LCMS_VERSION) && (LCMS_VERSION > 1010)
cmsSetErrorHandler(LCMSErrorHandler);
#else
(void) cmsErrorAction(LCMS_ERROR_SHOW);
#endif
#endif
source_profile=cmsOpenProfileFromMem(GetStringInfoDatum(icc_profile),
(DWORD) GetStringInfoLength(icc_profile));
(cmsUInt32Number) GetStringInfoLength(icc_profile));
target_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
(DWORD) GetStringInfoLength(profile));
(cmsUInt32Number) GetStringInfoLength(profile));
if ((source_profile == (cmsHPROFILE) NULL) ||
(target_profile == (cmsHPROFILE) NULL))
ThrowBinaryException(ResourceLimitError,
"ColorspaceColorProfileMismatch",name);
switch (cmsGetColorSpace(source_profile))
{
case icSigCmykData:
case cmsSigCmykData:
{
source_colorspace=CMYKColorspace;
source_type=(DWORD) TYPE_CMYK_16;
source_type=(cmsUInt32Number) TYPE_CMYK_16;
source_channels=4;
break;
}
case icSigGrayData:
case cmsSigGrayData:
{
source_colorspace=GRAYColorspace;
source_type=(DWORD) TYPE_GRAY_16;
source_type=(cmsUInt32Number) TYPE_GRAY_16;
source_channels=1;
break;
}
case icSigLabData:
case cmsSigLabData:
{
source_colorspace=LabColorspace;
source_type=(DWORD) TYPE_Lab_16;
source_type=(cmsUInt32Number) TYPE_Lab_16;
source_channels=3;
break;
}
case icSigLuvData:
case cmsSigLuvData:
{
source_colorspace=YUVColorspace;
source_type=(DWORD) TYPE_YUV_16;
source_type=(cmsUInt32Number) TYPE_YUV_16;
source_channels=3;
break;
}
case icSigRgbData:
case cmsSigRgbData:
{
source_colorspace=RGBColorspace;
source_type=(DWORD) TYPE_RGB_16;
source_type=(cmsUInt32Number) TYPE_RGB_16;
source_channels=3;
break;
}
case icSigXYZData:
case cmsSigXYZData:
{
source_colorspace=XYZColorspace;
source_type=(DWORD) TYPE_XYZ_16;
source_type=(cmsUInt32Number) TYPE_XYZ_16;
source_channels=3;
break;
}
case icSigYCbCrData:
case cmsSigYCbCrData:
{
source_colorspace=YCbCrColorspace;
source_type=(DWORD) TYPE_YCbCr_16;
source_type=(cmsUInt32Number) TYPE_YCbCr_16;
source_channels=3;
break;
}
default:
{
source_colorspace=UndefinedColorspace;
source_type=(DWORD) TYPE_RGB_16;
source_type=(cmsUInt32Number) TYPE_RGB_16;
source_channels=3;
break;
}
}
switch (cmsGetColorSpace(target_profile))
{
case icSigCmykData:
case cmsSigCmykData:
{
target_colorspace=CMYKColorspace;
target_type=(DWORD) TYPE_CMYK_16;
target_type=(cmsUInt32Number) TYPE_CMYK_16;
target_channels=4;
break;
}
case icSigLabData:
case cmsSigLabData:
{
target_colorspace=LabColorspace;
target_type=(DWORD) TYPE_Lab_16;
target_type=(cmsUInt32Number) TYPE_Lab_16;
target_channels=3;
break;
}
case icSigGrayData:
case cmsSigGrayData:
{
target_colorspace=GRAYColorspace;
target_type=(DWORD) TYPE_GRAY_16;
target_type=(cmsUInt32Number) TYPE_GRAY_16;
target_channels=1;
break;
}
case icSigLuvData:
case cmsSigLuvData:
{
target_colorspace=YUVColorspace;
target_type=(DWORD) TYPE_YUV_16;
target_type=(cmsUInt32Number) TYPE_YUV_16;
target_channels=3;
break;
}
case icSigRgbData:
case cmsSigRgbData:
{
target_colorspace=RGBColorspace;
target_type=(DWORD) TYPE_RGB_16;
target_type=(cmsUInt32Number) TYPE_RGB_16;
target_channels=3;
break;
}
case icSigXYZData:
case cmsSigXYZData:
{
target_colorspace=XYZColorspace;
target_type=(DWORD) TYPE_XYZ_16;
target_type=(cmsUInt32Number) TYPE_XYZ_16;
target_channels=3;
break;
}
case icSigYCbCrData:
case cmsSigYCbCrData:
{
target_colorspace=YCbCrColorspace;
target_type=(DWORD) TYPE_YCbCr_16;
target_type=(cmsUInt32Number) TYPE_YCbCr_16;
target_channels=3;
break;
}
default:
{
target_colorspace=UndefinedColorspace;
target_type=(DWORD) TYPE_RGB_16;
target_type=(cmsUInt32Number) TYPE_RGB_16;
target_channels=3;
break;
}
......@@ -1239,19 +1265,19 @@ MagickExport MagickBooleanType ProfileImage(Image *image,const char *name,
(void) SetImageColorspace(image,target_colorspace);
switch (cmsGetColorSpace(target_profile))
{
case icSigRgbData:
case cmsSigRgbData:
{
image->type=image->matte == MagickFalse ? TrueColorType :
TrueColorMatteType;
break;
}
case icSigCmykData:
case cmsSigCmykData:
{
image->type=image->matte == MagickFalse ? ColorSeparationType :
ColorSeparationMatteType;
break;
}
case icSigGrayData:
case cmsSigGrayData:
{
image->type=image->matte == MagickFalse ? GrayscaleType :
GrayscaleMatteType;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment