Skip to content

Commit

Permalink
Add support new colorspaces in IM 6.2.x and GM 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rmagick committed Jan 20, 2006
1 parent 3f97c9c commit 2449394
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 4 deletions.
106 changes: 106 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,112 @@ if test "$rm_cv_enum_hsbcolorspace" = yes; then
AC_DEFINE(HAVE_HSBCOLORSPACE)
fi

AC_CACHE_CHECK(for CineonLogRGBColorspace enum value, rm_cv_enum_cineonlogrgbcolorspace,
[AC_TRY_COMPILE(
[#include <stdio.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "magick/api.h"],
[ColorspaceType x; x = CineonLogRGBColorspace],
rm_cv_enum_cineonlogrgbcolorspace='yes',
rm_cv_enum_cineonlogrgbcolorspace='no')])

if test "$rm_cv_enum_cineonlogrgbcolorspace" = yes; then
AC_DEFINE(HAVE_CINEONLOGRGBCOLORSPACE)
fi

AC_CACHE_CHECK(for LABColorspace enum value, rm_cv_enum_labcolorspace,
[AC_TRY_COMPILE(
[#include <stdio.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "magick/api.h"],
[ColorspaceType x; x = LABColorspace],
rm_cv_enum_labcolorspace='yes',
rm_cv_enum_labcolorspace='no')])

if test "$rm_cv_enum_labcolorspace" = yes; then
AC_DEFINE(HAVE_LABCOLORSPACE)
fi

AC_CACHE_CHECK(for Rec601LumaColorspace enum value, rm_cv_enum_rec601lumacolorspace,
[AC_TRY_COMPILE(
[#include <stdio.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "magick/api.h"],
[ColorspaceType x; x = Rec601LumaColorspace],
rm_cv_enum_rec601lumacolorspace='yes',
rm_cv_enum_rec601lumacolorspace='no')])

if test "$rm_cv_enum_rec601lumacolorspace" = yes; then
AC_DEFINE(HAVE_REC601LUMACOLORSPACE)
fi

AC_CACHE_CHECK(for Rec601YCbCrColorspace enum value, rm_cv_enum_rec601ycbcrcolorspace,
[AC_TRY_COMPILE(
[#include <stdio.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "magick/api.h"],
[ColorspaceType x; x = Rec601YCbCrColorspace],
rm_cv_enum_rec601ycbcrcolorspace='yes',
rm_cv_enum_rec601ycbcrcolorspace='no')])

if test "$rm_cv_enum_rec601ycbcrcolorspace" = yes; then
AC_DEFINE(HAVE_REC601YCBCRCOLORSPACE)
fi

AC_CACHE_CHECK(for Rec709LumaColorspace enum value, rm_cv_enum_rec709lumacolorspace,
[AC_TRY_COMPILE(
[#include <stdio.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "magick/api.h"],
[ColorspaceType x; x = Rec709LumaColorspace],
rm_cv_enum_rec709lumacolorspace='yes',
rm_cv_enum_rec709lumacolorspace='no')])

if test "$rm_cv_enum_rec709lumacolorspace" = yes; then
AC_DEFINE(HAVE_REC709LUMACOLORSPACE)
fi

AC_CACHE_CHECK(for Rec709YCbCrColorspace enum value, rm_cv_enum_rec709ycbcrcolorspace,
[AC_TRY_COMPILE(
[#include <stdio.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "magick/api.h"],
[ColorspaceType x; x = Rec709YCbCrColorspace],
rm_cv_enum_rec709ycbcrcolorspace='yes',
rm_cv_enum_rec709ycbcrcolorspace='no')])

if test "$rm_cv_enum_rec709ycbcrcolorspace" = yes; then
AC_DEFINE(HAVE_REC709YCBCRCOLORSPACE)
fi

AC_CACHE_CHECK(for LogColorspace enum value, rm_cv_enum_logcolorspace,
[AC_TRY_COMPILE(
[#include <stdio.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "magick/api.h"],
[ColorspaceType x; x = LogColorspace],
rm_cv_enum_logcolorspace='yes',
rm_cv_enum_logcolorspace='no')])

if test "$rm_cv_enum_logcolorspace" = yes; then
AC_DEFINE(HAVE_LOGCOLORSPACE)
fi


AC_CACHE_CHECK(for CopyCyanCompositeOp enum value, rm_cv_enum_copycyancompositeop,
[AC_TRY_COMPILE(
[#include <stdio.h>
Expand Down
11 changes: 11 additions & 0 deletions ext/RMagick/rmagick_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#undef HAVE_BLACKTHRESHOLDIMAGE
/* Introduced in IM 6.0.1 */
#undef HAVE_BLURIMAGECHANNEL
/* Introduced in GM 1.2 */
#undef HAVE_CINEONLOGRGBCOLORSPACE
/* Introduced in IM 6.0.0 */
#undef HAVE_COLORDODGECOMPOSITEOP
/* Introduced in IM 6.0.0, GM 1.1 */
Expand Down Expand Up @@ -107,6 +109,10 @@
#undef HAVE_ISCOLORSIMILAR
/* Introduced in IM 6.2.2 */
#undef HAVE_JPEG2000COMPRESSION
/* Introduced in GM 1.2 */
#undef HAVE_LABCOLORSPACE
/* Introduced in IM 6.2.3 */
#undef HAVE_LOGCOLORSPACE
/* Introduced in IM 6.0.2 */
#undef HAVE_MAGICKBOOLEANTYPE
/* Introduced in IM 5.5.3, GM 1.0 */
Expand Down Expand Up @@ -134,6 +140,11 @@
#undef HAVE_RADIALBLURIMAGE
#undef HAVE_RANDOMCHANNELTHRESHOLDIMAGE
#undef HAVE_RANDOMTHRESHOLDIMAGECHANNEL
/* Introduced in GM 1.2 & IM 6.2.2 */
#undef HAVE_REC601LUMACOLORSPACE
#undef HAVE_REC601YCBCRCOLORSPACE
#undef HAVE_REC709LUMACOLORSPACE
#undef HAVE_REC709YCBCRCOLORSPACE
/* Introduced in IM 6.2.1 */
#undef HAVE_NEW_REMOVEIMAGEPROFILE
#undef HAVE_REPLACECOMPOSITEOP
Expand Down
27 changes: 24 additions & 3 deletions ext/RMagick/rmmain.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: rmmain.c,v 1.109 2006/01/11 23:53:06 rmagick Exp $ */
/* $Id: rmmain.c,v 1.110 2006/01/20 23:59:46 rmagick Exp $ */
/*============================================================================\
| Copyright (C) 2006 by Timothy P. Hunter
| Name: rmmain.c
Expand Down Expand Up @@ -1124,7 +1124,28 @@ Init_RMagick(void)
ENUMERATOR(HSLColorspace)
ENUMERATOR(HWBColorspace)
#if defined(HAVE_HSBCOLORSPACE)
ENUMERATOR(HSBColorspace) // 6.0.0
ENUMERATOR(HSBColorspace) // IM 6.0.0
#endif
#if defined(HAVE_CINEONLOGRGBCOLORSPACE)
ENUMERATOR(CineonLogRGBColorspace) // GM 1.2
#endif
#if defined(HAVE_LABCOLORSPACE)
ENUMERATOR(LABColorspace) // GM 1.2
#endif
#if defined(HAVE_REC601LUMACOLORSPACE)
ENUMERATOR(Rec601LumaColorspace) // GM 1.2 && IM 6.2.2
#endif
#if defined(HAVE_REC601YCBCRCOLORSPACE)
ENUMERATOR(Rec601YCbCrColorspace) // GM 1.2 && IM 6.2.2
#endif
#if defined(HAVE_REC709LUMACOLORSPACE)
ENUMERATOR(Rec709LumaColorspace) // GM 1.2 && IM 6.2.2
#endif
#if defined(HAVE_REC709YCBCRCOLORSPACE)
ENUMERATOR(Rec709YCbCrColorspace) // GM 1.2 && IM 6.2.2
#endif
#if defined(HAVE_LOGCOLORSPACE)
ENUMERATOR(LogColorspace) // IM 6.2.3
#endif
END_ENUM

Expand Down Expand Up @@ -1640,7 +1661,7 @@ static void version_constants(void)
rb_define_const(Module_Magick, "Version", str);

sprintf(long_version,
"This is %s ($Date: 2006/01/11 23:53:06 $) Copyright (C) 2006 by Timothy P. Hunter\n"
"This is %s ($Date: 2006/01/20 23:59:46 $) Copyright (C) 2006 by Timothy P. Hunter\n"
"Built with %s\n"
"Built for %s\n"
"Web page: http://rmagick.rubyforge.org\n"
Expand Down
45 changes: 44 additions & 1 deletion ext/RMagick/rmutil.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: rmutil.c,v 1.65 2006/01/01 23:25:12 rmagick Exp $ */
/* $Id: rmutil.c,v 1.66 2006/01/20 23:59:46 rmagick Exp $ */
/*============================================================================\
| Copyright (C) 2006 by Timothy P. Hunter
| Name: rmutil.c
Expand Down Expand Up @@ -1039,6 +1039,19 @@ ColorspaceType_new(ColorspaceType cs)
{
const char *name;

#if defined(HAVE_REC601YCBCRCOLORSPACE)
// GM 1.2 defines this symbol to be equal to YCbCrColorspace, so we
// can't use it as a case label. GM wants the string version of this
// enumerator to be Rec601YCbCrColorspace (see ColorspaceTypeToString
// in colorspace.c) so that's what we return for both versions of the
// enumerator.
if (cs == Rec601YCbCrColorspace)
{
return rm_enum_new(Class_ColorspaceType
, ID2SYM(rb_intern("Rec601YCbCrColorspace")), INT2FIX(cs));
}
#endif

switch(cs)
{
default:
Expand Down Expand Up @@ -1091,6 +1104,36 @@ ColorspaceType_new(ColorspaceType cs)
case HSBColorspace:
name = "HSBColorspace";
break;
#endif
#if defined(HAVE_LABCOLORSPACE)
case LABColorspace:
name = "LABColorspace";
break;
#endif
#if defined(HAVE_CINEONLOGRGBCOLORSPACE)
case CineonLogRGBColorspace:
name = "CineonLogRGBColorspace";
break;
#endif
#if defined(HAVE_REC601LUMACOLORSPACE)
case Rec601LumaColorspace:
name = "Rec601LumaColorspace";
break;
#endif
#if defined(HAVE_REC709LUMACOLORSPACE)
case Rec709LumaColorspace:
name = "Rec709LumaColorspace";
break;
#endif
#if defined(HAVE_REC709YCBCRCOLORSPACE)
case Rec709YCbCrColorspace:
name = "Rec709YCbCrColorspace";
break;
#endif
#if defined(HAVE_LOGCOLORSPACE)
case LogColorspace:
name = "LogColorspace";
break;
#endif
}

Expand Down

0 comments on commit 2449394

Please sign in to comment.