Commit 12bc889a authored by Cristy's avatar Cristy

Decorate GetLocalTime() to avoid namespace collision

parent b54c9a63
......@@ -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 <quetzlzacatenango@image...>
* Release ImageMagick version 7.0.8-39, GIT revision 15489:6120f8bc1:20190406
......
......@@ -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:
%
......
......@@ -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);
......
......@@ -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,
......
......@@ -833,6 +833,45 @@ WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
return(MagickTrue);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% 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));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
......@@ -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));
}
/*
......@@ -1086,6 +1121,60 @@ WandExport MagickBooleanType MagickBrightnessContrastImage(
return(status);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% 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);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
......@@ -1876,6 +1965,52 @@ WandExport MagickWand *MagickCompareImages(MagickWand *wand,
return(CloneMagickWandFromImages(wand,compare_image));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% 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));
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
......
......@@ -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 *),
......
......@@ -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));
......
......@@ -1607,7 +1607,7 @@ static MagickBooleanType WriteMATImage(const ImageInfo *image_info,Image *image,
image->depth=8;
current_time=GetMagickTime();
GetUTCTime(&current_time,&local_time);
GetMagickUTCtime(&current_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",
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment