- GetPixelInfoPixel(image,p,&pixel);
- pixel.red=(pixel.red*(100.0-fill_color.red)+colorize->red*
- fill_color.red)/100.0;
- pixel.green=(pixel.green*(100.0-fill_color.green)+colorize->green*
- fill_color.green)/100.0;
- pixel.blue=(pixel.blue*(100.0-fill_color.blue)+colorize->blue*
- fill_color.blue)/100.0;
- pixel.black=(pixel.black*(100.0-fill_color.black)+colorize->black*
- fill_color.black)/100.0;
- pixel.alpha=(pixel.alpha*(100.0-fill_color.alpha)+colorize->alpha*
- fill_color.alpha)/100.0;
- SetPixelInfoPixel(colorize_image,&pixel,q);
+ register ssize_t
+ i;
+
+ for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+ {
+ PixelChannel
+ channel;
+
+ PixelTrait
+ colorize_traits,
+ traits;
+
+ channel=GetPixelChannelChannel(image,i);
+ traits=GetPixelChannelTraits(image,channel);
+ colorize_traits=GetPixelChannelTraits(colorize_image,channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (colorize_traits == UndefinedPixelTrait))
+ continue;
+ if (((colorize_traits & CopyPixelTrait) != 0) ||
+ (GetPixelMask(image,p) != 0))
+ {
+ SetPixelChannel(colorize_image,channel,p[i],q);
+ continue;
+ }
+ SetPixelChannel(colorize_image,channel,
+ ClampToQuantum(Colorize(p[i],GetPixelInfoChannel(&blend_percentage,
+ channel),GetPixelInfoChannel(colorize,channel))),q);
+ }