% %
% %
% %
+% R e s e t I m a g e P i x e l s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% ResetImagePixels() reset the image pixels, that is, all the pixel components
+% are zereod.
+%
+% The format of the SetImage method is:
+%
+% MagickBooleanType ResetImagePixels(Image *image,
+% ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport MagickBooleanType ResetImagePixels(Image *image,
+ ExceptionInfo *exception)
+{
+ CacheView
+ *image_view;
+
+ MagickBooleanType
+ status;
+
+ ssize_t
+ y;
+
+ assert(image != (Image *) NULL);
+ if (image->debug != MagickFalse)
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
+ assert(image->signature == MagickCoreSignature);
+ /*
+ Reset image pixels.
+ */
+ 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=QueueCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
+ if (q == (Quantum *) NULL)
+ {
+ status=MagickFalse;
+ continue;
+ }
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
+ memset(q,0,GetPixelChannels(image)*sizeof(Quantum));
+ q+=GetPixelChannels(image);
+ }
+ if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ status=MagickFalse;
+ }
+ image_view=DestroyCacheView(image_view);
+ return(status);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% S e t I m a g e A l p h a %
% %
% %
ListMagickInfo(FILE *,ExceptionInfo *),
ModifyImage(Image **,ExceptionInfo *),
ResetImagePage(Image *,const char *),
+ ResetImagePixels(Image *,ExceptionInfo *),
SetImageAlpha(Image *,const Quantum,ExceptionInfo *),
SetImageBackgroundColor(Image *,ExceptionInfo *),
SetImageColor(Image *,const PixelInfo *,ExceptionInfo *),
image->rows=viff_info.columns;
image->depth=viff_info.x_bits_per_pixel <= 8 ? 8UL :
MAGICKCORE_QUANTUM_DEPTH;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
+ (void) SetImageBackgroundColor(image,exception);
/*
Verify that we can read this VIFF image.
*/
}
if ((bytes_per_pixel*max_packets) > GetBlobSize(image))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
- status=SetImageExtent(image,image->columns,image->rows,exception);
- if (status == MagickFalse)
- return(DestroyImageList(image));
- (void) SetImageBackgroundColor(image,exception);
pixels=(unsigned char *) AcquireQuantumMemory(MagickMax(number_pixels,
max_packets),bytes_per_pixel*sizeof(*pixels));
if (pixels == (unsigned char *) NULL)