return(status);
}
case CopyAlphaChannel:
- case ShapeAlphaChannel:
{
/*
Copy pixel intensity to the alpha channel.
*/
- image->alpha_trait=UpdatePixelTrait;
+ image->alpha_trait=BlendPixelTrait;
status=CompositeImage(image,image,IntensityCompositeOp,MagickTrue,0,0,
exception);
- if (alpha_type == ShapeAlphaChannel)
- {
- PixelInfo
- background;
-
- if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
- return(MagickFalse);
- ConformPixelInfo(image,&image->background_color,&background,
- exception);
- /*
- Set image background color.
- */
- status=MagickTrue;
- image_view=AcquireAuthenticCacheView(image,exception);
- for (y=0; y < (ssize_t) image->rows; y++)
- {
- register Quantum
- *magick_restrict q;
-
- register ssize_t
- x;
-
- if (status == MagickFalse)
- continue;
- q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
- exception);
- if (q == (Quantum *) NULL)
- {
- status=MagickFalse;
- continue;
- }
- for (x=0; x < (ssize_t) image->columns; x++)
- {
- if (GetPixelAlpha(image,q) != TransparentAlpha)
- SetPixelViaPixelInfo(image,&background,q);
- q+=GetPixelChannels(image);
- }
- if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
- status=MagickFalse;
- }
- image_view=DestroyCacheView(image_view);
- }
break;
}
case DeactivateAlphaChannel:
status=SetImageAlpha(image,OpaqueAlpha,exception);
break;
}
+ case ShapeAlphaChannel:
+ {
+ PixelInfo
+ background;
+
+ /*
+ Shape alpha channel.
+ */
+ image->alpha_trait=BlendPixelTrait;
+ status=CompositeImage(image,image,IntensityCompositeOp,MagickTrue,0,0,
+ exception);
+ if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
+ return(MagickFalse);
+ ConformPixelInfo(image,&image->background_color,&background,exception);
+ /*
+ Set image background color.
+ */
+ status=MagickTrue;
+ image_view=AcquireAuthenticCacheView(image,exception);
+ for (y=0; y < (ssize_t) image->rows; y++)
+ {
+ register Quantum
+ *magick_restrict q;
+
+ register ssize_t
+ x;
+
+ if (status == MagickFalse)
+ continue;
+ q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
+ exception);
+ if (q == (Quantum *) NULL)
+ {
+ status=MagickFalse;
+ continue;
+ }
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
+ if (GetPixelAlpha(image,q) != TransparentAlpha)
+ SetPixelViaPixelInfo(image,&background,q);
+ q+=GetPixelChannels(image);
+ }
+ if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ status=MagickFalse;
+ }
+ image_view=DestroyCacheView(image_view);
+ break;
+ }
case TransparentAlphaChannel:
{
status=SetImageAlpha(image,TransparentAlpha,exception);