return((Image *) NULL);
if (expression == (const char *) NULL)
return(destination_image);
- if (image->colorspace == UndefinedColorspace)
+ status=SetImageStorageClass(destination_image,DirectClass,exception);
+ if (status == MagickFalse)
{
- status=SetImageStorageClass(destination_image,DirectClass,exception);
- if (status == MagickFalse)
- {
- destination_image=DestroyImageList(destination_image);
- return(destination_image);
- }
+ destination_image=GetLastImageInList(destination_image);
+ return((Image *) NULL);
}
destination_channel=RedPixelChannel;
channel_mask=UndefinedChannel;
(void) SetPixelChannelMask(destination_image,channel_mask);
if ((channel_op == ExtractChannelOp) && (channels == 1))
(void) SetImageColorspace(destination_image,GRAYColorspace,exception);
- status=SetImageStorageClass(destination_image,DirectClass,exception);
- if (status == MagickFalse)
- {
- destination_image=DestroyImageList(destination_image);
- return(destination_image);
- }
canvas=CloneImage(source_image,0,0,MagickTrue,exception);
if (canvas == (Image *) NULL)
{
}
}
destination_channel=(PixelChannel) i;
- if (image->colorspace == UndefinedColorspace)
+ if (i >= GetPixelChannels(destination_image))
(void) SetPixelMetaChannels(destination_image,(size_t) (
destination_channel-GetPixelChannels(destination_image)+1),
exception);
destination_image->write_mask=MagickTrue;
break;
}
- case MetaPixelChannel:
default:
- {
- (void) SetPixelMetaChannels(destination_image,(size_t) (
- destination_channel-GetPixelChannels(destination_image)+1),
- exception);
break;
- }
}
channel_mask=(ChannelType) (channel_mask | ParseChannelOption(token));
if (((channels >= 1) || (destination_channel >= 1)) &&
(void) SetPixelChannelMask(destination_image,channel_mask);
if ((channel_op == ExtractChannelOp) && (channels == 1))
(void) SetImageColorspace(destination_image,GRAYColorspace,exception);
- status=SetImageStorageClass(destination_image,DirectClass,exception);
- if (status == MagickFalse)
- {
- destination_image=GetLastImageInList(destination_image);
- return((Image *) NULL);
- }
return(GetFirstImageInList(destination_image));
}
switch (colorspace)
{
case RGBColorspace:
- default:
{
(void) PrintChannelLocations(file,image,RedPixelChannel,"Red",
statistic_type,max_locations,channel_statistics);
statistic_type,max_locations,channel_statistics);
break;
}
+ default:
+ {
+ for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+ (void) PrintChannelLocations(file,image,(PixelChannel) i,"Gray",
+ statistic_type,max_locations,channel_statistics);
+ break;
+ }
}
if (image->alpha_trait != UndefinedPixelTrait)
(void) PrintChannelLocations(file,image,AlphaPixelChannel,"Alpha",
}
default:
{
- ssize_t
- number_channels;
-
- number_channels=image->number_channels+image->number_meta_channels;
- for (i=0; i < (ssize_t) number_channels; i++)
+ for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
(void) FormatLocaleFile(file," Channel %.20g: %.20g-bit\n",
(double) i,(double) channel_statistics[i].depth);
break;
}
default:
{
- ssize_t
- number_channels;
-
- number_channels=image->number_channels+image->number_meta_channels;
- for (i=0; i < (ssize_t) number_channels; i++)
+ for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
char
channel[MagickPathExtent];
}
default:
{
- ssize_t
- number_channels;
-
- number_channels=image->number_channels+image->number_meta_channels;
- for (i=0; i < (ssize_t) number_channels; i++)
+ for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
char
channel[MagickPathExtent];
}
default:
{
- ssize_t
- number_channels;
-
- number_channels=image->number_channels+image->number_meta_channels;
- for (i=0; i < (ssize_t) number_channels; i++)
+ for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
char
channel[MagickPathExtent];
assert(image->signature == MagickCoreSignature);
(void) ResetMagickMemory(image->channel_map,0,MaxPixelChannels*
sizeof(*image->channel_map));
- n=0;
- if (image->colorspace == UndefinedColorspace)
- {
- /*
- Multispectral image.
- */
- for (i=0; i < (ssize_t) image->number_channels; i++)
- SetPixelChannelAttributes(image,(PixelChannel) i,UpdatePixelTrait,n++);
- for (i=0; i < (ssize_t) image->number_meta_channels; i++)
- SetPixelChannelAttributes(image,(PixelChannel) (image->number_channels+
- i),UpdatePixelTrait,n++);
- if (image->debug != MagickFalse)
- LogPixelChannels(image);
- SetImageChannelMask(image,image->channel_mask);
- return;
- }
trait=UpdatePixelTrait;
if (image->alpha_trait != UndefinedPixelTrait)
trait=(PixelTrait) (trait | BlendPixelTrait);
+ n=0;
if (image->colorspace == GRAYColorspace)
{
SetPixelChannelAttributes(image,BluePixelChannel,trait,n);
if (image->write_mask != MagickFalse)
SetPixelChannelAttributes(image,WriteMaskPixelChannel,CopyPixelTrait,n++);
assert((n+image->number_meta_channels) < MaxPixelChannels);
- image->number_channels=(size_t) n;
for (i=0; i < (ssize_t) image->number_meta_channels; i++)
SetPixelChannelAttributes(image,(PixelChannel) (MetaPixelChannel+i),
- CopyPixelTrait,n++);
+ UpdatePixelTrait,n++);
+ image->number_channels=(size_t) n;
if (image->debug != MagickFalse)
LogPixelChannels(image);
SetImageChannelMask(image,image->channel_mask);
const size_t number_meta_channels,ExceptionInfo *exception)
{
image->number_meta_channels=number_meta_channels;
+ InitializePixelChannelMap(image);
return(SyncImagePixelCache(image,exception));
}