% 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 %
% %
% %
% %
+% 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 %
% %
% %
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);
}
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);
}
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);
}