+2009-09-21 6.5.6-3 Cristy <quetzlzacatenango@image...>
+ * Deprecate LevelImageColors(), replace with LevelColorsImage().
+
+2009-09-17 6.5.6-2 Cristy <quetzlzacatenango@image...>
+ * Optimize copy composite operator.
+
+2009-09-15 6.5.6-2 Cristy <quetzlzacatenango@image...>
+ * Use -define jpeg:size to scale a JPEG image to the specified size.
+
2009-09-13 6.5.6-0 Cristy <quetzlzacatenango@image...>
* Fix ICON alpha mask scanline pad.
- * Use -define jpeg:size to scale a JPEG image to the specified size.
2009-09-11 6.5.5-10 Cristy <quetzlzacatenango@image...>
* Return the global maximum threads to avoid the rare cache view assertions.
&white_point,exception);
if (attribute_flag[3] != 0)
channel=(ChannelType) argument_list[3].long_reference;
- (void) LevelImageColors(image,channel,&black_point,&white_point,
+ (void) LevelColorsImageChannel(image,channel,&black_point,&white_point,
argument_list[0].long_reference != 0 ? MagickTrue : MagickFalse);
break;
}
modify_outside_overlay=MagickTrue;
break;
}
+ case OverCompositeOp:
+ {
+ if (image->matte != MagickFalse)
+ break;
+ }
+ case CopyCompositeOp:
+ {
+ if ((x_offset+(long) composite_image->columns) < 0)
+ break;
+ if ((x_offset+(long) composite_image->columns) >= (long) image->columns)
+ break;
+ if ((y_offset+(long) composite_image->rows) < 0)
+ break;
+ if ((y_offset+(long) composite_image->rows) >= (long) image->rows)
+ break;
+ status=MagickTrue;
+ exception=(&image->exception);
+ image_view=AcquireCacheView(image);
+ composite_view=AcquireCacheView(composite_image);
+#if defined(_OPENMP) && (_OPENMP >= 200203)
+#pragma omp parallel for schedule(static,1) shared(status)
+#endif
+ for (y=0; y < (long) composite_image->rows; y++)
+ {
+ MagickBooleanType
+ sync;
+
+ register const IndexPacket
+ *composite_indexes;
+
+ register const PixelPacket
+ *p;
+
+ register IndexPacket
+ *indexes;
+
+ register PixelPacket
+ *q;
+
+ if (status == MagickFalse)
+ continue;
+ p=GetCacheViewVirtualPixels(composite_view,0,y,composite_image->columns,
+ 1,exception);
+ q=QueueCacheViewAuthenticPixels(image_view,x_offset,y+y_offset,
+ composite_image->columns,1,exception);
+ if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
+ {
+ status=MagickFalse;
+ continue;
+ }
+ composite_indexes=GetCacheViewVirtualIndexQueue(composite_view);
+ indexes=GetCacheViewAuthenticIndexQueue(image_view);
+ (void) CopyMagickMemory(q,p,composite_image->columns*sizeof(*p));
+ if ((indexes != (IndexPacket *) NULL) &&
+ (composite_indexes != (const IndexPacket *) NULL))
+ (void) CopyMagickMemory(indexes,composite_indexes,
+ composite_image->columns*sizeof(*indexes));
+ sync=SyncCacheViewAuthenticPixels(image_view,exception);
+ if (sync == MagickFalse)
+ status=MagickFalse;
+ if (image->progress_monitor != (MagickProgressMonitor) NULL)
+ {
+ MagickBooleanType
+ proceed;
+
+#if defined(_OPENMP) && (_OPENMP >= 200203)
+#pragma omp critical (MagickCore_TextureImage)
+#endif
+ proceed=SetImageProgress(image,CompositeImageTag,y,image->rows);
+ if (proceed == MagickFalse)
+ status=MagickFalse;
+ }
+ }
+ composite_view=DestroyCacheView(composite_view);
+ image_view=DestroyCacheView(image_view);
+ return(status);
+ }
case CopyOpacityCompositeOp:
case ChangeMaskCompositeOp:
{
for (x=0; x < (long) image->columns; x+=texture->columns)
{
width=texture->columns;
- if ((x+width) > (long) image->columns)
+ if ((x+(long) width) > (long) image->columns)
width=image->columns-x;
(void) CopyMagickMemory(q,p,width*sizeof(*p));
if ((indexes != (IndexPacket *) NULL) &&
alpha[16],
gamma;
- p=GetCacheViewVirtualPixels(image_view,(long) floor(x)-1,(long) floor(y)-1,
- 4,4,exception);
+ p=GetCacheViewVirtualPixels(image_view,(long) floor(x)-1,(long) floor(y)-
+ 1,4,4,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
PointInfo
delta;
- p=GetCacheViewVirtualPixels(image_view,(long) floor(x)-1,(long) floor(y)-1,
- 4,4,exception);
+ p=GetCacheViewVirtualPixels(image_view,(long) floor(x)-1,(long) floor(y)-
+ 1,4,4,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
PointInfo
delta;
- p=GetCacheViewVirtualPixels(image_view,(long) floor(x),(long) floor(y),2,2,
- exception);
+ p=GetCacheViewVirtualPixels(image_view,(long) floor(x),(long) floor(y),2,
+ 2,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
MagickPixelPacket
pixels[1];
- p=GetCacheViewVirtualPixels(image_view,(long) floor(x),(long) floor(y),1,1,
- exception);
+ p=GetCacheViewVirtualPixels(image_view,(long) floor(x),(long) floor(y),1,
+ 1,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
MagickPixelPacket
pixels[1];
- p=GetCacheViewVirtualPixels(image_view,NearestNeighbor(x),NearestNeighbor(y),
- 1,1,exception);
+ p=GetCacheViewVirtualPixels(image_view,NearestNeighbor(x),
+ NearestNeighbor(y),1,1,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
PointInfo
delta;
- p=GetCacheViewVirtualPixels(image_view,(long) floor(x)-1,(long) floor(y)-1,
- 4,4,exception);
+ p=GetCacheViewVirtualPixels(image_view,(long) floor(x)-1,(long) floor(y)-
+ 1,4,4,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
% %
% %
% %
+% L e v e l I m a g e C o l o r s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% LevelImageColor() will map the given color to "black" and "white"
+% values, limearly spreading out the colors, and level values on a channel by
+% channel bases, as per LevelImage(). The given colors allows you to specify
+% different level ranges for each of the color channels seperatally.
+%
+% If the boolean 'invert' is set true the image values will modifyed in the
+% reverse direction. That is any existing "black" and "white" colors in the
+% image will become the color values given, with all other values compressed
+% appropriatally. This effectivally maps a greyscale gradient into the given
+% color gradient.
+%
+% The format of the LevelImageColors method is:
+%
+% MagickBooleanType LevelImageColors(Image *image,const ChannelType channel,
+% const MagickPixelPacket *black_color,const MagickPixelPacket *white_color,
+% const MagickBooleanType invert)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o channel: the channel.
+%
+% o black_color: The color to map black to/from
+%
+% o white_point: The color to map white to/from
+%
+% o invert: if true map the colors (levelize), rather than from (level)
+%
+*/
+MagickBooleanType LevelImageColors(Image *image,const ChannelType channel,
+ const MagickPixelPacket *black_color,const MagickPixelPacket *white_color,
+ const MagickBooleanType invert)
+{
+ return(LevelColorsImageChannel(image,channel,black_color,white_color,invert));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% L i b e r a t e M e m o r y %
% %
% %
magick_attribute((format (printf,3,0))),
FuzzyColorCompare(const Image *,const PixelPacket *,const PixelPacket *),
FuzzyOpacityCompare(const Image *,const PixelPacket *,const PixelPacket *),
+ LevelImageColors(Image *,const ChannelType,const MagickPixelPacket *,
+ const MagickPixelPacket *, const MagickBooleanType),
MagickMonitor(const char *,const MagickOffsetType,const MagickSizeType,
void *),
MapImage(Image *,const Image *,const MagickBooleanType),
% AutoGammaImage() extract the 'mean' from the image and adjust the image
% to try make set its gamma appropriatally.
%
-% The format of the LevelImage method is:
+% The format of the AutoGammaImage method is:
%
% MagickBooleanType AutoGammaImage(Image *image)
% MagickBooleanType AutoGammaImageChannel(Image *image,
status=LevelImageChannel(image,DefaultChannels,black_point,white_point,
gamma);
else
- status=LevelizeImageChannel(image,DefaultChannels,black_point,white_point,
- gamma);
+ status=LevelizeImage(image,black_point,white_point,gamma);
return(status);
}
\f
% %
% %
% %
-% L e v e l I m a g e C h a n n e l %
+% L e v e l i z e I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% LevelImageChannel() applies the normal LevelImage() operation to just the
-% Specific channels specified, spreading out the values between the black and
-% white points over the entire range of values. Gamma correction is also
-% applied after the values has been mapped.
+% LevelizeImage() applies the normal level operation to the image, spreading
+% out the values between the black and white points over the entire range of
+% values. Gamma correction is also applied after the values has been mapped.
%
% It is typically used to improve image contrast, or to provide a controlled
% linear threshold for the image. If the black and white points are set to
% the minimum and maximum values found in the image, the image can be
% normalized. or by swapping black and white values, negate the image.
%
-% The format of the LevelizeImageChannel method is:
+% The format of the LevelizeImage method is:
%
-% MagickBooleanType LevelImageChannel(Image *image,
-% const ChannelType channel,black_point,white_point,gamma)
+% MagickBooleanType LevelizeImage(Image *image,const double black_point,
+% const double white_point,const double gamma)
+% MagickBooleanType LevelizeImageChannel(Image *image,
+% const ChannelType channel,const double black_point,
+% const double white_point,const double gamma)
%
% A description of each parameter follows:
%
% use 1.0 for purely linear stretching of image color values
%
*/
+
+MagickExport MagickBooleanType LevelizeImage(Image *image,
+ const double black_point,const double white_point,const double gamma)
+{
+ MagickBooleanType
+ status;
+
+ status=LevelizeImageChannel(image,DefaultChannels,black_point,white_point,
+ gamma);
+ return(status);
+}
+
MagickExport MagickBooleanType LevelImageChannel(Image *image,
const ChannelType channel,const double black_point,const double white_point,
const double gamma)
% appropriatally. This effectivally maps a greyscale gradient into the given
% color gradient.
%
-% The format of the LevelImageColors method is:
+% The format of the LevelColorsImageChannel method is:
%
-% MagickBooleanType LevelImageColors(Image *image,const ChannelType channel,
+% MagickBooleanType LevelColorsImage(Image *image,
% const MagickPixelPacket *black_color,
% const MagickPixelPacket *white_color,const MagickBooleanType invert)
+% MagickBooleanType LevelColorsImageChannel(Image *image,
+% const ChannelType channel,const MagickPixelPacket *black_color,
+% const MagickPixelPacket *white_color,const MagickBooleanType invert)
%
% A description of each parameter follows:
%
% o invert: if true map the colors (levelize), rather than from (level)
%
*/
-MagickBooleanType LevelImageColors(Image *image,const ChannelType channel,
+
+MagickExport MagickBooleanType LevelColorsImage(Image *image,
const MagickPixelPacket *black_color,const MagickPixelPacket *white_color,
const MagickBooleanType invert)
{
-#define LevelColorImageTag "LevelColor/Image"
+ MagickBooleanType
+ status;
+ status=LevelColorsImageChannel(image,DefaultChannels,black_color,white_color,
+ invert);
+ return(status);
+}
+
+MagickExport MagickBooleanType LevelColorsImageChannel(Image *image,
+ const ChannelType channel,const MagickPixelPacket *black_color,
+ const MagickPixelPacket *white_color,const MagickBooleanType invert)
+{
MagickStatusType
status;
LevelImage(Image *,const char *),
LevelImageChannel(Image *,const ChannelType,const double,const double,
const double),
+ LevelizeImage(Image *,const double,const double,const double),
LevelizeImageChannel(Image *,const ChannelType,const double,const double,
const double),
- LevelImageColors(Image *,const ChannelType,const MagickPixelPacket *,
+ LevelColorsImage(Image *,const MagickPixelPacket *,const MagickPixelPacket *,
+ const MagickBooleanType),
+ LevelColorsImageChannel(Image *,const ChannelType,const MagickPixelPacket *,
const MagickPixelPacket *,const MagickBooleanType),
LinearStretchImage(Image *,const double,const double),
ModulateImage(Image *,const char *),
GetMagickPixelPacket(image,&background);
SetMagickPixelPacket(image,&(image->background_color),(IndexPacket *)
NULL,&background);
- (void) LevelImageColors(image,DefaultChannels,&background,&background,
- MagickTrue);
+ (void) LevelColorsImage(image,&background,&background,MagickTrue);
}
break;
}
#define IsTaintImage PrependMagickMethod(IsTaintImage)
#define LeastSquaresAddTerms PrependMagickMethod(LeastSquaresAddTerms)
#define LevelImageChannel PrependMagickMethod(LevelImageChannel)
-#define LevelImageColors PrependMagickMethod(LevelImageColors)
+#define LevelColorsImageChannel PrependMagickMethod(LevelColorsImageChannel)
#define LevelImage PrependMagickMethod(LevelImage)
#define LevelizeImageChannel PrependMagickMethod(LevelizeImageChannel)
#define LiberateMemory PrependMagickMethod(LiberateMemory)
else
(void) QueryMagickColor("#ffffff",&white_point,exception);
}
- (void) LevelImageColors(*image,channel,&black_point,&white_point,
+ (void) LevelColorsImageChannel(*image,channel,&black_point,&white_point,
*option == '+' ? MagickTrue : MagickFalse);
break;
}