% August 2003 %
% %
% %
-% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2011 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 %
%
% The format of the MagickGetCompressionQuality method is:
%
-% unsigned long MagickGetCompressionQuality(MagickWand *wand)
+% size_t MagickGetCompressionQuality(MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
*/
-WandExport unsigned long MagickGetCompressionQuality(MagickWand *wand)
+WandExport size_t MagickGetCompressionQuality(MagickWand *wand)
{
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
% The format of the MagickGetImageArtifacts method is:
%
% char *MagickGetImageArtifacts(MagickWand *wand,
-% const char *pattern,unsigned long *number_artifacts)
+% const char *pattern,size_t *number_artifacts)
%
% A description of each parameter follows:
%
%
*/
WandExport char **MagickGetImageArtifacts(MagickWand *wand,
- const char *pattern,unsigned long *number_artifacts)
+ const char *pattern,size_t *number_artifacts)
{
char
**artifacts;
const char
*artifact;
- register long
+ register ssize_t
i;
size_t
if ((*artifact != '[') &&
(GlobExpression(artifact,pattern,MagickFalse) != MagickFalse))
{
- if ((i+1) >= (long) length)
+ if ((i+1) >= (ssize_t) length)
{
length<<=1;
artifacts=(char **) ResizeQuantumMemory(artifacts,length,
artifact=GetNextImageProperty(wand->images);
}
artifacts[i]=(char *) NULL;
- *number_artifacts=(unsigned long) i;
+ *number_artifacts=(size_t) i;
return(artifacts);
}
\f
return((unsigned char *) NULL);
(void) CopyMagickMemory(datum,GetStringInfoDatum(profile),
GetStringInfoLength(profile));
- *length=(unsigned long) GetStringInfoLength(profile);
+ *length=(size_t) GetStringInfoLength(profile);
return(datum);
}
\f
% The format of the MagickGetImageProfiles method is:
%
% char *MagickGetImageProfiles(MagickWand *wand,
-% unsigned long *number_profiles)
+% size_t *number_profiles)
%
% A description of each parameter follows:
%
%
*/
WandExport char **MagickGetImageProfiles(MagickWand *wand,const char *pattern,
- unsigned long *number_profiles)
+ size_t *number_profiles)
{
char
**profiles;
const char
*property;
- register long
+ register ssize_t
i;
size_t
if ((*property != '[') &&
(GlobExpression(property,pattern,MagickFalse) != MagickFalse))
{
- if ((i+1) >= (long) length)
+ if ((i+1) >= (ssize_t) length)
{
length<<=1;
profiles=(char **) ResizeQuantumMemory(profiles,length,
property=GetNextImageProfile(wand->images);
}
profiles[i]=(char *) NULL;
- *number_profiles=(unsigned long) i;
+ *number_profiles=(size_t) i;
return(profiles);
}
\f
% The format of the MagickGetImageProperties method is:
%
% char *MagickGetImageProperties(MagickWand *wand,
-% const char *pattern,unsigned long *number_properties)
+% const char *pattern,size_t *number_properties)
%
% A description of each parameter follows:
%
%
*/
WandExport char **MagickGetImageProperties(MagickWand *wand,
- const char *pattern,unsigned long *number_properties)
+ const char *pattern,size_t *number_properties)
{
char
**properties;
const char
*property;
- register long
+ register ssize_t
i;
size_t
if ((*property != '[') &&
(GlobExpression(property,pattern,MagickFalse) != MagickFalse))
{
- if ((i+1) >= (long) length)
+ if ((i+1) >= (ssize_t) length)
{
length<<=1;
properties=(char **) ResizeQuantumMemory(properties,length,
property=GetNextImageProperty(wand->images);
}
properties[i]=(char *) NULL;
- *number_properties=(unsigned long) i;
+ *number_properties=(size_t) i;
return(properties);
}
\f
%
% The format of the MagickGetOptions method is:
%
-% char *MagickGetOptions(MagickWand *wand,unsigned long *number_options)
+% char *MagickGetOptions(MagickWand *wand,size_t *number_options)
%
% A description of each parameter follows:
%
%
*/
WandExport char **MagickGetOptions(MagickWand *wand,const char *pattern,
- unsigned long *number_options)
+ size_t *number_options)
{
char
**options;
const char
*option;
- register long
+ register ssize_t
i;
size_t
if ((*option != '[') &&
(GlobExpression(option,pattern,MagickFalse) != MagickFalse))
{
- if ((i+1) >= (long) length)
+ if ((i+1) >= (ssize_t) length)
{
length<<=1;
options=(char **) ResizeQuantumMemory(options,length,
option=GetNextImageOption(wand->image_info);
}
options[i]=(char *) NULL;
- *number_options=(unsigned long) i;
+ *number_options=(size_t) i;
return(options);
}
\f
% The format of the MagickGetPage method is:
%
% MagickBooleanType MagickGetPage(const MagickWand *wand,
-% unsigned long *width,unsigned long *height,long *x,long *y)
+% size_t *width,size_t *height,ssize_t *x,ssize_t *y)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType MagickGetPage(const MagickWand *wand,
- unsigned long *width,unsigned long *height,long *x,long *y)
+ size_t *width,size_t *height,ssize_t *x,ssize_t *y)
{
RectangleInfo
geometry;
%
% The format of the MagickGetQuantumDepth method is:
%
-% const char *MagickGetQuantumDepth(unsigned long *depth)
+% const char *MagickGetQuantumDepth(size_t *depth)
%
% A description of each parameter follows:
%
% o depth: the quantum depth is returned as a number.
%
*/
-WandExport const char *MagickGetQuantumDepth(unsigned long *depth)
+WandExport const char *MagickGetQuantumDepth(size_t *depth)
{
return(GetMagickQuantumDepth(depth));
}
%
% The format of the MagickGetQuantumRange method is:
%
-% const char *MagickGetQuantumRange(unsigned long *range)
+% const char *MagickGetQuantumRange(size_t *range)
%
% A description of each parameter follows:
%
% o range: the quantum range is returned as a number.
%
*/
-WandExport const char *MagickGetQuantumRange(unsigned long *range)
+WandExport const char *MagickGetQuantumRange(size_t *range)
{
return(GetMagickQuantumRange(range));
}
% %
% %
% %
+% M a g i c k G e t R e s o l u t i o n %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MagickGetResolution() gets the image X and Y resolution.
+%
+% The format of the MagickGetResolution method is:
+%
+% MagickBooleanType MagickGetResolution(const MagickWand *wand,double *x,
+% double *y)
+%
+% A description of each parameter follows:
+%
+% o wand: the magick wand.
+%
+% o x: the x-resolution.
+%
+% o y: the y-resolution.
+%
+*/
+WandExport MagickBooleanType MagickGetResolution(const MagickWand *wand,
+ double *x,double *y)
+{
+ assert(wand != (MagickWand *) NULL);
+ assert(wand->signature == WandSignature);
+ if (wand->debug != MagickFalse)
+ (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+ *x=72.0;
+ *y=72.0;
+ if (wand->image_info->density != (char *) NULL)
+ {
+ GeometryInfo
+ geometry_info;
+
+ MagickStatusType
+ flags;
+
+ flags=ParseGeometry(wand->image_info->density,&geometry_info);
+ *x=geometry_info.rho;
+ *y=geometry_info.sigma;
+ if ((flags & SigmaValue) == MagickFalse)
+ *y=(*x);
+ }
+ return(MagickTrue);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% M a g i c k G e t R e s o u r c e %
% %
% %
% The format of the MagickGetSamplingFactors method is:
%
% double *MagickGetSamplingFactor(MagickWand *wand,
-% unsigned long *number_factors)
+% size_t *number_factors)
%
% A description of each parameter follows:
%
%
*/
WandExport double *MagickGetSamplingFactors(MagickWand *wand,
- unsigned long *number_factors)
+ size_t *number_factors)
{
double
*sampling_factors;
register const char
*p;
- register long
+ register ssize_t
i;
assert(wand != (MagickWand *) NULL);
sampling_factors[i]=StringToDouble(p);
i++;
}
- *number_factors=(unsigned long) i;
+ *number_factors=(size_t) i;
return(sampling_factors);
}
\f
% The format of the MagickGetSize method is:
%
% MagickBooleanType MagickGetSize(const MagickWand *wand,
-% unsigned long *columns,unsigned long *rows)
+% size_t *columns,size_t *rows)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType MagickGetSize(const MagickWand *wand,
- unsigned long *columns,unsigned long *rows)
+ size_t *columns,size_t *rows)
{
RectangleInfo
geometry;
% The format of the MagickGetSizeOffset method is:
%
% MagickBooleanType MagickGetSizeOffset(const MagickWand *wand,
-% long *offset)
+% ssize_t *offset)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType MagickGetSizeOffset(const MagickWand *wand,
- long *offset)
+ ssize_t *offset)
{
RectangleInfo
geometry;
%
% The format of the MagickGetVersion method is:
%
-% const char *MagickGetVersion(unsigned long *version)
+% const char *MagickGetVersion(size_t *version)
%
% A description of each parameter follows:
%
% o version: the ImageMagick version is returned as a number.
%
*/
-WandExport const char *MagickGetVersion(unsigned long *version)
+WandExport const char *MagickGetVersion(size_t *version)
{
return(GetMagickVersion(version));
}
% The format of the MagickSetCompressionQuality method is:
%
% MagickBooleanType MagickSetCompressionQuality(MagickWand *wand,
-% const unsigned long quality)
+% const size_t quality)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType MagickSetCompressionQuality(MagickWand *wand,
- const unsigned long quality)
+ const size_t quality)
{
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
% The format of the MagickSetDepth method is:
%
% MagickBooleanType MagickSetDepth(MagickWand *wand,
-% const unsigned long depth)
+% const size_t depth)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType MagickSetDepth(MagickWand *wand,
- const unsigned long depth)
+ const size_t depth)
{
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
status=SetImageOption(wand->image_info,"gravity",MagickOptionToMnemonic(
- MagickGravityOptions,(long) type));
+ MagickGravityOptions,(ssize_t) type));
return(status);
}
\f
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
status=SetImageOption(wand->image_info,"interpolate",
- MagickOptionToMnemonic(MagickInterpolateOptions,(long) method));
+ MagickOptionToMnemonic(MagickInterpolateOptions,(ssize_t) method));
return(status);
}
\f
% The format of the MagickSetPage method is:
%
% MagickBooleanType MagickSetPage(MagickWand *wand,
-% const unsigned long width,const unsigned long height,const long x,
-% const long y)
+% const size_t width,const size_t height,const ssize_t x,
+% const ssize_t y)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType MagickSetPage(MagickWand *wand,
- const unsigned long width,const unsigned long height,const long x,
- const long y)
+ const size_t width,const size_t height,const ssize_t x,
+ const ssize_t y)
{
char
geometry[MaxTextExtent];
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- (void) FormatMagickString(geometry,MaxTextExtent,"%lux%lu%+ld%+ld",
- width,height,x,y);
+ (void) FormatMagickString(geometry,MaxTextExtent,"%.20gx%.20g%+.20g%+.20g",
+ (double) width,(double) height,(double) x,(double) y);
(void) CloneString(&wand->image_info->page,geometry);
return(MagickTrue);
}
% The format of the MagickSetSamplingFactors method is:
%
% MagickBooleanType MagickSetSamplingFactors(MagickWand *wand,
-% const unsigned long number_factors,const double *sampling_factors)
+% const size_t number_factors,const double *sampling_factors)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType MagickSetSamplingFactors(MagickWand *wand,
- const unsigned long number_factors,const double *sampling_factors)
+ const size_t number_factors,const double *sampling_factors)
{
char
sampling_factor[MaxTextExtent];
- register long
+ register ssize_t
i;
assert(wand != (MagickWand *) NULL);
RelinquishMagickMemory(wand->image_info->sampling_factor);
if (number_factors == 0)
return(MagickTrue);
- for (i=0; i < (long) (number_factors-1); i++)
+ for (i=0; i < (ssize_t) (number_factors-1); i++)
{
(void) FormatMagickString(sampling_factor,MaxTextExtent,"%g,",
sampling_factors[i]);
% The format of the MagickSetSize method is:
%
% MagickBooleanType MagickSetSize(MagickWand *wand,
-% const unsigned long columns,const unsigned long rows)
+% const size_t columns,const size_t rows)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType MagickSetSize(MagickWand *wand,
- const unsigned long columns,const unsigned long rows)
+ const size_t columns,const size_t rows)
{
char
geometry[MaxTextExtent];
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- (void) FormatMagickString(geometry,MaxTextExtent,"%lux%lu",columns,rows);
+ (void) FormatMagickString(geometry,MaxTextExtent,"%.20gx%.20g",(double)
+ columns,(double) rows);
(void) CloneString(&wand->image_info->size,geometry);
return(MagickTrue);
}
% The format of the MagickSetSizeOffset method is:
%
% MagickBooleanType MagickSetSizeOffset(MagickWand *wand,
-% const unsigned long columns,const unsigned long rows,
-% const long offset)
+% const size_t columns,const size_t rows,
+% const ssize_t offset)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType MagickSetSizeOffset(MagickWand *wand,
- const unsigned long columns,const unsigned long rows,const long offset)
+ const size_t columns,const size_t rows,const ssize_t offset)
{
char
geometry[MaxTextExtent];
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- (void) FormatMagickString(geometry,MaxTextExtent,"%lux%lu%+ld",columns,rows,
- offset);
+ (void) FormatMagickString(geometry,MaxTextExtent,"%.20gx%.20g%+.20g",
+ (double) columns,(double) rows,(double) offset);
(void) CloneString(&wand->image_info->size,geometry);
return(MagickTrue);
}