% Methods to Paint on an Image %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1998 %
% %
% %
-% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2014 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 %
Include declarations.
*/
#include "MagickCore/studio.h"
+#include "MagickCore/channel.h"
#include "MagickCore/color.h"
#include "MagickCore/color-private.h"
#include "MagickCore/colorspace-private.h"
const ssize_t y_offset,const MagickBooleanType invert,
ExceptionInfo *exception)
{
-#define MaxStacksize (1UL << 15)
+#define MaxStacksize 131072UL
#define PushSegmentStack(up,left,right,delta) \
{ \
if (s >= (segment_stack+MaxStacksize)) \
skip,
status;
+ MemoryInfo
+ *segment_info;
+
PixelInfo
fill_color,
pixel;
if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
if (IsGrayColorspace(image->colorspace) != MagickFalse)
- (void) TransformImageColorspace(image,RGBColorspace,exception);
- if ((image->alpha_trait != BlendPixelTrait) && (draw_info->fill.alpha_trait == BlendPixelTrait))
+ (void) SetImageColorspace(image,sRGBColorspace,exception);
+ if ((image->alpha_trait != BlendPixelTrait) &&
+ (draw_info->fill.alpha_trait == BlendPixelTrait))
(void) SetImageAlpha(image,OpaqueAlpha,exception);
/*
Set floodfill state.
(void) QueryColorCompliance("#000",AllCompliance,
&floodplane_image->background_color,exception);
(void) SetImageBackgroundColor(floodplane_image,exception);
- segment_stack=(SegmentInfo *) AcquireQuantumMemory(MaxStacksize,
- sizeof(*segment_stack));
- if (segment_stack == (SegmentInfo *) NULL)
+ segment_info=AcquireVirtualMemory(MaxStacksize,sizeof(*segment_stack));
+ if (segment_info == (MemoryInfo *) NULL)
{
floodplane_image=DestroyImage(floodplane_image);
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
}
+ segment_stack=(SegmentInfo *) GetVirtualMemoryBlob(segment_info);
/*
Push initial segment on stack.
*/
}
floodplane_view=DestroyCacheView(floodplane_view);
image_view=DestroyCacheView(image_view);
- segment_stack=(SegmentInfo *) RelinquishMagickMemory(segment_stack);
+ segment_info=RelinquishVirtualMemory(segment_info);
floodplane_image=DestroyImage(floodplane_image);
return(y == (ssize_t) image->rows ? MagickTrue : MagickFalse);
}
linear_image=DestroyImage(paint_image);
return((Image *) NULL);
}
- if (image->colorspace == sRGBColorspace)
- (void) TransformImageColorspace(linear_image,sRGBColorspace,exception);
if (SetImageStorageClass(paint_image,DirectClass,exception) == MagickFalse)
{
linear_image=DestroyImage(linear_image);
}
for (i=0; i < (ssize_t) GetPixelChannels(linear_image); i++)
{
- PixelChannel
- channel;
-
- PixelTrait
- paint_traits,
- traits;
-
- channel=GetPixelChannelChannel(linear_image,i);
- traits=GetPixelChannelTraits(linear_image,channel);
- paint_traits=GetPixelChannelTraits(paint_image,channel);
+ PixelChannel channel=GetPixelChannelChannel(linear_image,i);
+ PixelTrait traits=GetPixelChannelTraits(linear_image,channel);
+ PixelTrait paint_traits=GetPixelChannelTraits(paint_image,channel);
if ((traits == UndefinedPixelTrait) ||
(paint_traits == UndefinedPixelTrait))
continue;
if (((paint_traits & CopyPixelTrait) != 0) ||
- (GetPixelMask(linear_image,p) != 0))
+ (GetPixelReadMask(linear_image,p) == 0))
{
SetPixelChannel(paint_image,channel,p[center+i],q);
continue;
image_view=DestroyCacheView(image_view);
histograms=DestroyHistogramThreadSet(histograms);
linear_image=DestroyImage(linear_image);
- if (image->colorspace == sRGBColorspace)
- (void) TransformImageColorspace(paint_image,sRGBColorspace,exception);
if (status == MagickFalse)
paint_image=DestroyImage(paint_image);
return(paint_image);
return(MagickFalse);
if ((IsGrayColorspace(image->colorspace) != MagickFalse) &&
(IsPixelInfoGray(fill) == MagickFalse))
- (void) TransformImageColorspace(image,RGBColorspace,exception);
- if ((fill->alpha_trait == BlendPixelTrait) && (image->alpha_trait != BlendPixelTrait))
+ (void) SetImageColorspace(image,sRGBColorspace,exception);
+ if ((fill->alpha_trait == BlendPixelTrait) &&
+ (image->alpha_trait != BlendPixelTrait))
(void) SetImageAlpha(image,OpaqueAlpha,exception);
/*
Make image color opaque.