ext/RMagick/rmutil.c in rmagick-1.15.9 vs ext/RMagick/rmutil.c in rmagick-1.15.10

- old
+ new

@@ -1,6 +1,6 @@ -/* $Id: rmutil.c,v 1.90.2.3 2007/06/09 16:45:52 rmagick Exp $ */ +/* $Id: rmutil.c,v 1.90.2.3.2.1 2007/09/16 21:38:42 rmagick Exp $ */ /*============================================================================\ | Copyright (C) 2007 by Timothy P. Hunter | Name: rmutil.c | Author: Tim Hunter | Purpose: Utility functions for RMagick @@ -602,11 +602,16 @@ Pixel *pixel; double hue, saturation, luminosity; volatile VALUE hsl; Data_Get_Struct(self, Pixel, pixel); + +#if defined(HAVE_CONVERTRGBTOHSL) + ConvertRGBToHSL(pixel->red, pixel->green, pixel->blue, &hue, &saturation, &luminosity); +#else TransformHSL(pixel->red, pixel->green, pixel->blue, &hue, &saturation, &luminosity); +#endif hsl = rb_ary_new3(3, rb_float_new(hue), rb_float_new(saturation), rb_float_new(luminosity)); return hsl; @@ -633,11 +638,17 @@ hue = NUM2DBL(rb_ary_entry(hsl, 0)); saturation = NUM2DBL(rb_ary_entry(hsl, 1)); luminosity = NUM2DBL(rb_ary_entry(hsl, 2)); +#if defined(HAVE_CONVERTHSLTORGB) + ConvertHSLToRGB(hue, saturation, luminosity, + &rgb.red, &rgb.green, &rgb.blue); +#else HSLTransform(hue, saturation, luminosity, &rgb.red, &rgb.green, &rgb.blue); +#endif + return Pixel_from_PixelPacket(&rgb); } /* Method: Pixel#eql?