/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % P i x e l S y n c I t e r a t o r % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % PixelSyncIterator() syncs the pixel iterator. % % The format of the PixelSyncIterator method is: % % MagickBooleanType PixelSyncIterator(PixelIterator *iterator) % % A description of each parameter follows: % % o iterator: the pixel iterator. % */ WandExport MagickBooleanType PixelSyncIterator(PixelIterator *iterator) { ExceptionInfo *exception; register IndexPacket *restrict indexes; register ssize_t x; register PixelPacket *restrict pixels; assert(iterator != (const PixelIterator *) NULL); assert(iterator->signature == WandSignature); if (iterator->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name); if (SetCacheViewStorageClass(iterator->view,DirectClass) == MagickFalse) return(MagickFalse); exception=iterator->exception; pixels=GetCacheViewAuthenticPixels(iterator->view,iterator->region.x, iterator->region.y+iterator->y,iterator->region.width,1,exception); if (pixels == (PixelPacket *) NULL) { InheritException(iterator->exception,GetCacheViewException( iterator->view)); return(MagickFalse); } indexes=GetCacheViewAuthenticIndexQueue(iterator->view); for (x=0; x < (ssize_t) iterator->region.width; x++) PixelGetQuantumColor(iterator->pixel_wands[x],pixels+x); if (GetCacheViewColorspace(iterator->view) == CMYKColorspace) for (x=0; x < (ssize_t) iterator->region.width; x++) SetPixelBlack(indexes+x,PixelGetBlackQuantum( iterator->pixel_wands[x])); if (SyncCacheViewAuthenticPixels(iterator->view,exception) == MagickFalse) { InheritException(iterator->exception,GetCacheViewException( iterator->view)); return(MagickFalse); } return(MagickTrue); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % P i x e l S y n c I t e r a t o r % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % PixelSyncIterator() syncs the pixel iterator. % % The format of the PixelSyncIterator method is: % % MagickBooleanType PixelSyncIterator(PixelIterator *iterator) % % A description of each parameter follows: % % o iterator: the pixel iterator. % */ WandExport MagickBooleanType PixelSyncIterator(PixelIterator *iterator) { IndexPacket *indexes; register long x; register PixelPacket *p; assert(iterator != (const PixelIterator *) NULL); assert(iterator->signature == WandSignature); if (iterator->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name); if (SetCacheViewStorageClass(iterator->view,DirectClass) == MagickFalse) return(MagickFalse); p=GetCacheViewPixels(iterator->view,iterator->region.x,iterator->region.y+ iterator->y,iterator->region.width,1); if (p == (PixelPacket *) NULL) { InheritException(iterator->exception,GetCacheViewException( iterator->view)); return(MagickFalse); } indexes=GetCacheViewIndexes(iterator->view); for (x=0; x < (long) iterator->region.width; x++) { PixelGetQuantumColor(iterator->pixel_wands[x],p); if (GetCacheViewColorspace(iterator->view) == CMYKColorspace) indexes[x]=PixelGetBlackQuantum(iterator->pixel_wands[x]); else if (GetCacheViewStorageClass(iterator->view) == PseudoClass) indexes[x]=PixelGetIndex(iterator->pixel_wands[x]); p++; } if (SyncCacheView(iterator->view) == MagickFalse) { InheritException(iterator->exception,GetCacheViewException( iterator->view)); return(MagickFalse); } return(MagickTrue); }