% July 1992 %
% %
% %
-% Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
unsigned char
quantum;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
p=PushCharPixel(p,&quantum);
pixel->alpha=ScaleCharToQuantum(quantum);
unsigned short
quantum;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
p=PushShortPixel(MSBEndian,p,&quantum);
pixel->alpha=(Quantum) (quantum >> (image->depth-
unsigned int
quantum;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
p=PushLongPixel(MSBEndian,p,&quantum);
pixel->alpha=(Quantum) (quantum >> (image->depth-
p=PushCharPixel(p,&quantum);
pixel->black=ScaleCharToQuantum(quantum);
}
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
p=PushCharPixel(p,&quantum);
pixel->alpha=ScaleCharToQuantum(quantum);
p=PushShortPixel(MSBEndian,p,&quantum);
pixel->black=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH);
}
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
p=PushShortPixel(MSBEndian,p,&quantum);
pixel->alpha=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH);
p=PushLongPixel(MSBEndian,p,&quantum);
pixel->black=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH);
}
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
p=PushLongPixel(MSBEndian,p,&quantum);
pixel->alpha=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH);
if (*options != '{')
if (isspace((int) ((unsigned char) c)) != 0)
break;
- }
- }
+ } }
*p='\0';
if (*options == '{')
- (void) strcpy(options,options+1);
+ (void) CopyMagickString(options,options+1,strlen(options));
/*
Assign a value to the specified keyword.
*/
switch (*keyword)
{
+ case 'a':
+ case 'A':
+ {
+ if (LocaleCompare(keyword,"alpha-trait") == 0)
+ {
+ ssize_t
+ alpha_trait;
+
+ alpha_trait=ParseCommandOption(MagickPixelTraitOptions,
+ MagickFalse,options);
+ if (alpha_trait < 0)
+ break;
+ image->alpha_trait=(PixelTrait) alpha_trait;
+ break;
+ }
+ (void) SetImageProperty(image,keyword,options,exception);
+ break;
+ }
case 'b':
case 'B':
{
options);
if (matte < 0)
break;
- image->matte=(MagickBooleanType) matte;
+ image->alpha_trait=matte == 0 ? UndefinedPixelTrait :
+ BlendPixelTrait;
break;
}
if (LocaleCompare(keyword,"matte-color") == 0)
case 'o':
case 'O':
{
- if (LocaleCompare(keyword,"opaque") == 0)
- {
- ssize_t
- matte;
-
- matte=ParseCommandOption(MagickBooleanOptions,MagickFalse,
- options);
- if (matte < 0)
- break;
- image->matte=(MagickBooleanType) matte;
- break;
- }
if (LocaleCompare(keyword,"orientation") == 0)
{
ssize_t
packet_size=(size_t) (3*quantum_info->depth/8);
if (IsGrayColorspace(image->colorspace) != MagickFalse)
packet_size=quantum_info->depth/8;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
packet_size+=quantum_info->depth/8;
if (image->colorspace == CMYKColorspace)
packet_size+=quantum_info->depth/8;
Read image pixels.
*/
quantum_type=RGBQuantum;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
quantum_type=RGBAQuantum;
if (image->colorspace == CMYKColorspace)
{
quantum_type=CMYKQuantum;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
quantum_type=CMYKAQuantum;
}
if (IsGrayColorspace(image->colorspace) != MagickFalse)
{
quantum_type=GrayQuantum;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
quantum_type=GrayAlphaQuantum;
}
if (image->storage_class == PseudoClass)
{
quantum_type=IndexQuantum;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
quantum_type=IndexAlphaQuantum;
}
status=MagickTrue;
if (image->colorspace == CMYKColorspace)
SetPixelBlack(image,ClampToQuantum(pixel.black),q);
}
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
SetPixelAlpha(image,ClampToQuantum(pixel.alpha),q);
q+=GetPixelChannels(image);
}
unsigned int
value;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
value=ScaleQuantumToLong(ClampToQuantum(pixel->alpha));
pixels=PopLongPixel(MSBEndian,value,pixels);
unsigned short
value;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
value=ScaleQuantumToShort(ClampToQuantum(pixel->alpha));
pixels=PopShortPixel(MSBEndian,value,pixels);
unsigned char
value;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
value=(unsigned char) ScaleQuantumToChar(ClampToQuantum(
pixel->alpha));
value=ScaleQuantumToLong(ClampToQuantum(pixel->black));
pixels=PopLongPixel(MSBEndian,value,pixels);
}
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
value=ScaleQuantumToLong(ClampToQuantum(pixel->alpha));
pixels=PopLongPixel(MSBEndian,value,pixels);
value=ScaleQuantumToShort(ClampToQuantum(pixel->black));
pixels=PopShortPixel(MSBEndian,value,pixels);
}
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
value=ScaleQuantumToShort(ClampToQuantum(pixel->alpha));
pixels=PopShortPixel(MSBEndian,value,pixels);
pixel->black));
pixels=PopCharPixel(value,pixels);
}
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
value=(unsigned char) ScaleQuantumToChar(ClampToQuantum(
pixel->alpha));
packet_size=(size_t) (3*quantum_info->depth/8);
if (IsGrayColorspace(image->colorspace) != MagickFalse)
packet_size=(size_t) (quantum_info->depth/8);
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
packet_size+=quantum_info->depth/8;
if (image->colorspace == CMYKColorspace)
packet_size+=quantum_info->depth/8;
*/
(void) WriteBlobString(image,"id=ImageMagick version=1.0\n");
(void) FormatLocaleString(buffer,MaxTextExtent,
- "class=%s colors=%.20g matte=%s\n",CommandOptionToMnemonic(
+ "class=%s colors=%.20g alpha-trait=%s\n",CommandOptionToMnemonic(
MagickClassOptions,image->storage_class),(double) image->colors,
- CommandOptionToMnemonic(MagickBooleanOptions,(ssize_t) image->matte));
+ CommandOptionToMnemonic(MagickPixelTraitOptions,(ssize_t)
+ image->alpha_trait));
(void) WriteBlobString(image,buffer);
(void) FormatLocaleString(buffer,MaxTextExtent,"columns=%.20g rows=%.20g "
"depth=%.20g\n",(double) image->columns,(double) image->rows,(double)