% July 1992 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2012 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 %
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- chop_view=AcquireCacheView(chop_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ chop_view=AcquireAuthenticCacheView(chop_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
+ #pragma omp parallel for schedule(static) shared(progress,status)
#endif
for (y=0; y < (ssize_t) extent.y; y++)
{
chop_traits,
traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
chop_traits=GetPixelChannelMapTraits(chop_image,channel);
if ((traits == UndefinedPixelTrait) ||
(chop_traits == UndefinedPixelTrait))
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_ChopImage)
+ #pragma omp critical (MagickCore_ChopImage)
#endif
proceed=SetImageProgress(image,ChopImageTag,progress++,image->rows);
if (proceed == MagickFalse)
Extract chop image.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
+ #pragma omp parallel for schedule(static) shared(progress,status)
#endif
for (y=0; y < (ssize_t) (image->rows-(extent.y+extent.height)); y++)
{
chop_traits,
traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
chop_traits=GetPixelChannelMapTraits(chop_image,channel);
if ((traits == UndefinedPixelTrait) ||
(chop_traits == UndefinedPixelTrait))
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_ChopImage)
+ #pragma omp critical (MagickCore_ChopImage)
#endif
proceed=SetImageProgress(image,ChopImageTag,progress++,image->rows);
if (proceed == MagickFalse)
(void) SetImageColorspace(cmyk_image,CMYKColorspace,exception);
for (i=0; i < 4; i++)
{
- image_view=AcquireCacheView(images);
- cmyk_view=AcquireCacheView(cmyk_image);
+ image_view=AcquireVirtualCacheView(images,exception);
+ cmyk_view=AcquireAuthenticCacheView(cmyk_image,exception);
for (y=0; y < (ssize_t) images->rows; y++)
{
register const Quantum
Crop is not within virtual canvas, return 1 pixel transparent image.
*/
(void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
- "GeometryDoesNotContainImage","`%s'",image->filename);
+ "GeometryDoesNotContainImage","'%s'",image->filename);
crop_image=CloneImage(image,1,1,MagickTrue,exception);
if (crop_image == (Image *) NULL)
return((Image *) NULL);
if ((page.width == 0) || (page.height == 0))
{
(void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
- "GeometryDoesNotContainImage","`%s'",image->filename);
+ "GeometryDoesNotContainImage","'%s'",image->filename);
return((Image *) NULL);
}
/*
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- crop_view=AcquireCacheView(crop_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ crop_view=AcquireAuthenticCacheView(crop_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
+ #pragma omp parallel for schedule(static) shared(progress,status)
#endif
for (y=0; y < (ssize_t) crop_image->rows; y++)
{
register ssize_t
i;
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(crop_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
crop_traits,
traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
crop_traits=GetPixelChannelMapTraits(crop_image,channel);
if ((traits == UndefinedPixelTrait) ||
(crop_traits == UndefinedPixelTrait))
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_CropImage)
+ #pragma omp critical (MagickCore_CropImage)
#endif
proceed=SetImageProgress(image,CropImageTag,progress++,image->rows);
if (proceed == MagickFalse)
}
MagickExport Image *CropImageToTiles(const Image *image,
- const char *crop_geometry, ExceptionInfo *exception)
+ const char *crop_geometry,ExceptionInfo *exception)
{
Image
*next,
width+=(geometry.x < 0 ? -1 : 1)*geometry.x;
height+=(geometry.y < 0 ? -1 : 1)*geometry.y;
}
- delta.x=((double)width)/((double)geometry.width);
- delta.y=((double)height)/((double)geometry.height);
+ delta.x=(double) width/geometry.width;
+ delta.y=(double) height/geometry.height;
+ if (delta.x < 1.0)
+ delta.x=1.0;
+ if (delta.y < 1.0)
+ delta.y=1.0;
for (offset.y=0; offset.y < (double) height; )
{
if ((flags & AspectValue) == 0)
ClearMagickException(exception);
return(crop_image);
}
-
if (((geometry.width == 0) && (geometry.height == 0)) ||
((flags & XValue) != 0) || ((flags & YValue) != 0))
{
crop_image->page.y-=geometry.y;
}
return(crop_image);
- }
+ }
if ((image->columns > geometry.width) || (image->rows > geometry.height))
{
RectangleInfo
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- excerpt_view=AcquireCacheView(excerpt_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ excerpt_view=AcquireAuthenticCacheView(excerpt_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
for (y=0; y < (ssize_t) excerpt_image->rows; y++)
{
register ssize_t
i;
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(excerpt_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
excerpt_traits,
traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
excerpt_traits=GetPixelChannelMapTraits(excerpt_image,channel);
if ((traits == UndefinedPixelTrait) ||
(excerpt_traits == UndefinedPixelTrait))
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_ExcerptImage)
+ #pragma omp critical (MagickCore_ExcerptImage)
#endif
proceed=SetImageProgress(image,ExcerptImageTag,progress++,image->rows);
if (proceed == MagickFalse)
if (extent_image->background_color.alpha != OpaqueAlpha)
extent_image->matte=MagickTrue;
(void) SetImageBackgroundColor(extent_image,exception);
- (void) CompositeImage(extent_image,image->compose,image,-geometry->x,
- -geometry->y,exception);
+ (void) CompositeImage(extent_image,image,image->compose,MagickTrue,
+ -geometry->x,-geometry->y,exception);
return(extent_image);
}
\f
status=MagickTrue;
progress=0;
page=image->page;
- image_view=AcquireCacheView(image);
- flip_view=AcquireCacheView(flip_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ flip_view=AcquireAuthenticCacheView(flip_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
+ #pragma omp parallel for schedule(static) shared(progress,status)
#endif
for (y=0; y < (ssize_t) flip_image->rows; y++)
{
register ssize_t
i;
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(flip_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
flip_traits,
traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
flip_traits=GetPixelChannelMapTraits(flip_image,channel);
if ((traits == UndefinedPixelTrait) ||
(flip_traits == UndefinedPixelTrait))
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_FlipImage)
+ #pragma omp critical (MagickCore_FlipImage)
#endif
proceed=SetImageProgress(image,FlipImageTag,progress++,image->rows);
if (proceed == MagickFalse)
status=MagickTrue;
progress=0;
page=image->page;
- image_view=AcquireCacheView(image);
- flop_view=AcquireCacheView(flop_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ flop_view=AcquireAuthenticCacheView(flop_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
+ #pragma omp parallel for schedule(static) shared(progress,status)
#endif
for (y=0; y < (ssize_t) flop_image->rows; y++)
{
i;
q-=GetPixelChannels(flop_image);
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
flop_traits,
traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
flop_traits=GetPixelChannelMapTraits(flop_image,channel);
if ((traits == UndefinedPixelTrait) ||
(flop_traits == UndefinedPixelTrait))
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_FlopImage)
+ #pragma omp critical (MagickCore_FlopImage)
#endif
proceed=SetImageProgress(image,FlopImageTag,progress++,image->rows);
if (proceed == MagickFalse)
y;
status=MagickTrue;
- source_view=AcquireCacheView(source);
- destination_view=AcquireCacheView(destination);
+ source_view=AcquireVirtualCacheView(source,exception);
+ destination_view=AcquireAuthenticCacheView(destination,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(status)
+ #pragma omp parallel for schedule(static) shared(status)
#endif
for (y=0; y < (ssize_t) rows; y++)
{
register ssize_t
i;
+ if (GetPixelMask(source,p) != 0)
+ {
+ p+=GetPixelChannels(source);
+ q+=GetPixelChannels(destination);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
{
PixelChannel
destination_traits,
source_traits;
- source_traits=GetPixelChannelMapTraits(source,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(source,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(source,i);
+ source_traits=GetPixelChannelMapTraits(source,channel);
destination_traits=GetPixelChannelMapTraits(destination,channel);
if ((source_traits == UndefinedPixelTrait) ||
(destination_traits == UndefinedPixelTrait))
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- splice_view=AcquireCacheView(splice_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ splice_view=AcquireAuthenticCacheView(splice_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
for (y=0; y < (ssize_t) splice_geometry.y; y++)
{
register ssize_t
i;
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(splice_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
splice_traits,
traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
splice_traits=GetPixelChannelMapTraits(splice_image,channel);
if ((traits == UndefinedPixelTrait) ||
(splice_traits == UndefinedPixelTrait))
register ssize_t
i;
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(splice_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
traits,
splice_traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
splice_traits=GetPixelChannelMapTraits(splice_image,channel);
if ((traits == UndefinedPixelTrait) ||
(splice_traits == UndefinedPixelTrait))
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_TransposeImage)
+ #pragma omp critical (MagickCore_TransposeImage)
#endif
proceed=SetImageProgress(image,SpliceImageTag,progress++,
splice_image->rows);
}
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
for (y=(ssize_t) (splice_geometry.y+splice_geometry.height);
y < (ssize_t) splice_image->rows; y++)
register ssize_t
i;
+ if (GetPixelMask(image,q) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(splice_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
traits,
splice_traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
splice_traits=GetPixelChannelMapTraits(splice_image,channel);
if ((traits == UndefinedPixelTrait) ||
(splice_traits == UndefinedPixelTrait))
register ssize_t
i;
+ if (GetPixelMask(image,q) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(splice_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
traits,
splice_traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
splice_traits=GetPixelChannelMapTraits(splice_image,channel);
if ((traits == UndefinedPixelTrait) ||
(splice_traits == UndefinedPixelTrait))
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_TransposeImage)
+ #pragma omp critical (MagickCore_TransposeImage)
#endif
proceed=SetImageProgress(image,SpliceImageTag,progress++,
splice_image->rows);
(transform_image->rows == geometry.height))
return(MagickTrue);
resize_image=ResizeImage(transform_image,geometry.width,geometry.height,
- transform_image->filter,transform_image->blur,exception);
+ transform_image->filter,exception);
if (resize_image == (Image *) NULL)
return(MagickFalse);
transform_image=DestroyImage(transform_image);
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- transpose_view=AcquireCacheView(transpose_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ transpose_view=AcquireAuthenticCacheView(transpose_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register ssize_t
i;
+ if (GetPixelMask(image,q) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(transpose_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
traits,
transpose_traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
transpose_traits=GetPixelChannelMapTraits(transpose_image,channel);
if ((traits == UndefinedPixelTrait) ||
(transpose_traits == UndefinedPixelTrait))
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_TransposeImage)
+ #pragma omp critical (MagickCore_TransposeImage)
#endif
proceed=SetImageProgress(image,TransposeImageTag,progress++,
image->rows);
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- transverse_view=AcquireCacheView(transverse_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ transverse_view=AcquireAuthenticCacheView(transverse_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
i;
q-=GetPixelChannels(transverse_image);
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
traits,
transverse_traits;
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,i);
+ traits=GetPixelChannelMapTraits(image,channel);
transverse_traits=GetPixelChannelMapTraits(transverse_image,channel);
if ((traits == UndefinedPixelTrait) ||
(transverse_traits == UndefinedPixelTrait))
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_TransverseImage)
+ #pragma omp critical (MagickCore_TransverseImage)
#endif
proceed=SetImageProgress(image,TransverseImageTag,progress++,
image->rows);