ext/RMagick/rminfo.c in rmagick-1.15.2 vs ext/RMagick/rminfo.c in rmagick-1.15.3

- old
+ new

@@ -1,6 +1,6 @@ -/* $Id: rminfo.c,v 1.45 2007/01/12 00:11:19 rmagick Exp $ */ +/* $Id: rminfo.c,v 1.45.2.1 2007/02/17 14:18:13 rmagick Exp $ */ /*============================================================================\ | Copyright (C) 2007 by Timothy P. Hunter | Name: rminfo.c | Author: Tim Hunter | Purpose: Info class method definitions for RMagick. @@ -884,14 +884,23 @@ Note: Compare with Image#fill! */ VALUE Info_fill(VALUE self) { +#if defined(HAVE_SETIMAGEOPTION) Info *info; + const char *fill; Data_Get_Struct(self, Info, info); + fill = GetImageOption(info, "fill"); + return fill ? rb_str_new2(fill) : Qnil; +#else + Info *info; + + Data_Get_Struct(self, Info, info); return PixelPacket_to_Color_Name_Info(info, &info->pen); +#endif } /* Method: Info#fill=<aString> Purpose: set the fill (a.k.a. pen) color @@ -902,9 +911,16 @@ { Info *info; Data_Get_Struct(self, Info, info); Color_to_PixelPacket(&info->pen, color); + +#if defined(HAVE_SETIMAGEOPTION) + // Color_to_PixelPacket will raise an exception if `color' isn't a real color. + (void) RemoveImageOption(info, "fill"); + (void) SetImageOption(info, "fill", STRING_PTR(color)); +#endif + return self; } /*