From: Cristy Date: Wed, 17 Apr 2019 21:48:08 +0000 (-0400) Subject: Decorate GetLocalTime() to avoid namespace collision X-Git-Tag: 7.0.8-41~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12bc889a684ef7a54df7dfecee3cd7d1da4971bf;p=imagemagick Decorate GetLocalTime() to avoid namespace collision --- diff --git a/ChangeLog b/ChangeLog index cc8e01acb..1c66fc41d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,12 @@ * Honor SOURCE_DATE_EPOCH environment variable (reference https://github.com/ImageMagick/ImageMagick/pull/1496/). * Standardize on UTC time for any image format timestamp. + * Add MagickAutoThresholdImage(), MagickCannyEdgeImage(), + MagickComplexImages(), MagickConnectedComponentsImage(), + MagickHoughLineImage(), MagickKuwaharaImage(), MagickLevelizeImageColors(), + MagickLevelImageColors(), MagickMeanShiftImage(), MagickPolynomialImage(), + MagickRangeThresholdImage(), MagickSetSeed(), MagickWaveletDenoiseImage() + to MagickWand API. 2019-04-07 7.0.8-39 Cristy * Release ImageMagick version 7.0.8-39, GIT revision 15489:6120f8bc1:20190406 diff --git a/MagickCore/threshold.c b/MagickCore/threshold.c index 00b875ad1..4323cf0ab 100644 --- a/MagickCore/threshold.c +++ b/MagickCore/threshold.c @@ -366,9 +366,8 @@ MagickExport Image *AdaptiveThresholdImage(const Image *image, % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% AutoThresholdImage() automatically selects a threshold and replaces each -% pixel in the image with a black pixel if the image intentsity is less than -% the selected threshold otherwise white. +% AutoThresholdImage() automatically performs image thresholding +% dependent on which method you specify. % % The format of the AutoThresholdImage method is: % diff --git a/MagickCore/timer-private.h b/MagickCore/timer-private.h index 56b0fe88d..b1e8fbd93 100644 --- a/MagickCore/timer-private.h +++ b/MagickCore/timer-private.h @@ -22,7 +22,7 @@ extern "C" { #endif -static inline void GetUTCTime(const time_t *timep,struct tm *result) +static inline void GetMagickUTCtime(const time_t *timep,struct tm *result) { #if defined(MAGICKCORE_HAVE_GMTIME_R) (void) gmtime_r(timep,result); @@ -38,7 +38,7 @@ static inline void GetUTCTime(const time_t *timep,struct tm *result) #endif } -static inline void GetLocalTime(const time_t *timep,struct tm *result) +static inline void GetMagickLocaltime(const time_t *timep,struct tm *result) { #if defined(MAGICKCORE_HAVE_GMTIME_R) (void) localtime_r(timep,result); diff --git a/MagickCore/timer.c b/MagickCore/timer.c index fe5ca2729..8e7957061 100644 --- a/MagickCore/timer.c +++ b/MagickCore/timer.c @@ -262,7 +262,7 @@ MagickExport ssize_t FormatMagickTime(const time_t time,const size_t length, gm_time; assert(timestamp != (char *) NULL); - GetUTCTime(&time,&gm_time); + GetMagickUTCtime(&time,&gm_time); count=FormatLocaleString(timestamp,length, "%04d-%02d-%02dT%02d:%02d:%02d%+03d:00",gm_time.tm_year+1900, gm_time.tm_mon+1,gm_time.tm_mday,gm_time.tm_hour,gm_time.tm_min, diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index a8b9db28a..fb73d9f22 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -838,6 +838,45 @@ WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand) % % % % % % +% M a g i c k A u t o T h r e s h o l d I m a g e % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% MagickAutoThresholdImage() automatically performs image thresholding +% dependent on which method you specify. +% +% The format of the AutoThresholdImage method is: +% +% MagickBooleanType MagickAutoThresholdImage(MagickWand *wand, +% const AutoThresholdMethod method) +% +% A description of each parameter follows: +% +% o wand: the magick wand. +% +% o method: choose from KapurThresholdMethod, OTSUThresholdMethod, or +% TriangleThresholdMethod. +% +*/ +WandExport MagickBooleanType MagickAutoThresholdImage(MagickWand *wand, + const AutoThresholdMethod method) +{ + assert(wand != (MagickWand *) NULL); + assert(wand->signature == MagickWandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + if (wand->images == (Image *) NULL) + ThrowWandException(WandError,"ContainsNoImages",wand->name); + return(AutoThresholdImage(wand->images,method,wand->exception)); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % M a g i c k B l a c k T h r e s h o l d I m a g e % % % % % @@ -866,9 +905,6 @@ WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand, char thresholds[MagickPathExtent]; - MagickBooleanType - status; - assert(wand != (MagickWand *) NULL); assert(wand->signature == MagickWandSignature); if (wand->debug != MagickFalse) @@ -879,8 +915,7 @@ WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand, QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat, PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold), PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold)); - status=BlackThresholdImage(wand->images,thresholds,wand->exception); - return(status); + return(BlackThresholdImage(wand->images,thresholds,wand->exception)); } /* @@ -1091,6 +1126,60 @@ WandExport MagickBooleanType MagickBrightnessContrastImage( % % % % % % +% M a g i c k C a n n y E d g e I m a g e % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% MagickCannyEdgeImage() uses a multi-stage algorithm to detect a wide range of +% edges in images. +% +% The format of the MagickCannyEdgeImage method is: +% +% MagickBooleanType MagickCannyEdgeImage(MagickWand *wand, +% const double radius,const double sigma,const double lower_percent, +% const double upper_percent) +% +% A description of each parameter follows: +% +% o wand: the magick wand. +% +% o radius: the radius of the gaussian smoothing filter. +% +% o sigma: the sigma of the gaussian smoothing filter. +% +% o lower_percent: percentage of edge pixels in the lower threshold. +% +% o upper_percent: percentage of edge pixels in the upper threshold. +% +*/ +WandExport MagickBooleanType MagickCannyEdgeImage(MagickWand *wand, + const double radius,const double sigma,const double lower_percent, + const double upper_percent) +{ + Image + *edge_image; + + assert(wand != (MagickWand *) NULL); + assert(wand->signature == MagickWandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + if (wand->images == (Image *) NULL) + ThrowWandException(WandError,"ContainsNoImages",wand->name); + edge_image=CannyEdgeImage(wand->images,radius,sigma,lower_percent, + upper_percent,wand->exception); + if (edge_image == (Image *) NULL) + return(MagickFalse); + ReplaceImageInList(&wand->images,edge_image); + return(MagickTrue); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % M a g i c k C h a n n e l F x I m a g e % % % % % @@ -1881,6 +1970,52 @@ WandExport MagickWand *MagickCompareImages(MagickWand *wand, % % % % % % +% M a g i c k C o m p l e x I m a g e s % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% MagickComplexImages() performs complex mathematics on an image sequence. +% +% The format of the MagickComplexImages method is: +% +% MagickWand *MagickComplexImages(MagickWand *wand, +% const ComplexOperator op) +% +% A description of each parameter follows: +% +% o wand: the magick wand. +% +% o op: A complex operator. Choose from AddComplexOperator, +% ConjugateComplexOperator,DivideComplexOperator, +% MagnitudePhaseComplexOperator,MultiplyComplexOperator, +% RealImaginaryComplexOperator, SubtractComplexOperator. +% +*/ +WandExport MagickWand *MagickComplexImages(MagickWand *wand, + const ComplexOperator op) +{ + Image + *complex_image; + + assert(wand != (MagickWand *) NULL); + assert(wand->signature == MagickWandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + if (wand->images == (Image *) NULL) + return((MagickWand *) NULL); + complex_image=ComplexImages(wand->images,op,wand->exception); + if (complex_image == (Image *) NULL) + return((MagickWand *) NULL); + return(CloneMagickWandFromImages(wand,complex_image)); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % M a g i c k C o m p o s i t e I m a g e % % % % % diff --git a/MagickWand/magick-image.h b/MagickWand/magick-image.h index e10d5efcf..f00ca8ae2 100644 --- a/MagickWand/magick-image.h +++ b/MagickWand/magick-image.h @@ -92,12 +92,15 @@ extern WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *), MagickAutoLevelImage(MagickWand *), MagickAutoOrientImage(MagickWand *), + MagickAutoThresholdImage(MagickWand *,const AutoThresholdMethod), MagickBlackThresholdImage(MagickWand *,const PixelWand *), MagickBlueShiftImage(MagickWand *,const double), MagickBlurImage(MagickWand *,const double,const double), MagickBorderImage(MagickWand *,const PixelWand *,const size_t,const size_t, const CompositeOperator compose), MagickBrightnessContrastImage(MagickWand *,const double,const double), + MagickCannyEdgeImage(MagickWand *,const double,const double,const double, + const double), MagickCharcoalImage(MagickWand *,const double,const double), MagickChopImage(MagickWand *,const size_t,const size_t,const ssize_t, const ssize_t), @@ -342,6 +345,7 @@ extern WandExport MagickWand *MagickCompareImages(MagickWand *,const MagickWand *,const MetricType, double *), *MagickCompareImagesLayers(MagickWand *,const LayerMethod), + *MagickComplexImages(MagickWand *,const ComplexOperator), *MagickDeconstructImages(MagickWand *), *MagickEvaluateImages(MagickWand *,const MagickEvaluateOperator), *MagickFxImage(MagickWand *,const char *), diff --git a/coders/cin.c b/coders/cin.c index 202f89730..cee28577d 100644 --- a/coders/cin.c +++ b/coders/cin.c @@ -992,7 +992,7 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image, offset+=WriteBlob(image,sizeof(cin.file.filename),(unsigned char *) cin.file.filename); seconds=GetMagickTime(); - GetUTCTime(&seconds,&local_time); + GetMagickUTCtime(&seconds,&local_time); (void) memset(timestamp,0,sizeof(timestamp)); (void) strftime(timestamp,MaxTextExtent,"%Y:%m:%d:%H:%M:%SUTC",&local_time); (void) memset(cin.file.create_date,0,sizeof(cin.file.create_date)); diff --git a/coders/mat.c b/coders/mat.c index 7c71fa643..4a4f85d51 100644 --- a/coders/mat.c +++ b/coders/mat.c @@ -1607,7 +1607,7 @@ static MagickBooleanType WriteMATImage(const ImageInfo *image_info,Image *image, image->depth=8; current_time=GetMagickTime(); - GetUTCTime(¤t_time,&local_time); + GetMagickUTCtime(¤t_time,&local_time); (void) memset(MATLAB_HDR,' ',MagickMin(sizeof(MATLAB_HDR),124)); FormatLocaleString(MATLAB_HDR,sizeof(MATLAB_HDR), "MATLAB 5.0 MAT-file, Platform: %s, Created on: %s %s %2d %2d:%2d:%2d %d", diff --git a/coders/pdf.c b/coders/pdf.c index 5a5750f94..bb83cb7be 100644 --- a/coders/pdf.c +++ b/coders/pdf.c @@ -3009,7 +3009,7 @@ RestoreMSCWarning } (void) WriteBlobString(image,buffer); seconds=GetMagickTime(); - GetUTCTime(&seconds,&local_time); + GetMagickUTCtime(&seconds,&local_time); (void) FormatLocaleString(date,MagickPathExtent,"D:%04d%02d%02d%02d%02d%02d", local_time.tm_year+1900,local_time.tm_mon+1,local_time.tm_mday, local_time.tm_hour,local_time.tm_min,local_time.tm_sec);