c=(int)*p;
switch (c)
{
+ case '~':
+ {
+ flags|=TildeValue;
+ (void) CopyMagickString(p,p+1,MagickPathExtent);
+ break;
+ }
case '%':
{
flags|=PercentValue;
}
switch (c)
{
+ case '~':
+ {
+ flags|=TildeValue;
+ (void) CopyMagickString(p,p+1,MagickPathExtent);
+ break;
+ }
case '%':
{
flags|=PercentValue;
region_info->width=(size_t) floor((scale.x*image->columns/100.0)+0.5);
region_info->height=(size_t) floor((scale.y*image->rows/100.0)+0.5);
}
+ if ((flags & TildeValue) != 0)
+ {
+ double
+ geometry_aspect,
+ image_aspect;
+
+ GeometryInfo
+ geometry_info;
+
+ MagickStatusType
+ status;
+
+ PointInfo
+ scale;
+
+ /*
+ Geometry is a relative to image size and aspect ratio.
+ */
+ if (image->gravity != UndefinedGravity)
+ flags|=XValue | YValue;
+ status=ParseGeometry(geometry,&geometry_info);
+ scale.x=geometry_info.rho;
+ scale.y=geometry_info.sigma;
+ if ((status & SigmaValue) == 0)
+ scale.y=scale.x;
+ geometry_aspect=scale.x/scale.y;
+ image_aspect=image->columns/(double) image->rows;
+ region_info->width=image->columns;
+ region_info->height=image->rows;
+ if (geometry_aspect >= image_aspect)
+ {
+ region_info->width=(size_t) floor((image->columns*geometry_aspect/
+ image_aspect)+0.5);
+ region_info->height=(size_t) floor((image->rows*image_aspect/
+ geometry_aspect)+0.5);
+ }
+ }
/*
Adjust offset according to gravity setting.
*/
former_width=(*width);
former_height=(*height);
}
+ if ((flags & TildeValue) != 0)
+ {
+ double
+ geometry_aspect,
+ image_aspect;
+
+ GeometryInfo
+ geometry_info;
+
+ MagickStatusType
+ status;
+
+ PointInfo
+ scale;
+
+ /*
+ Geometry is a relative to image size and aspect ratio.
+ */
+ status=ParseGeometry(geometry,&geometry_info);
+ scale.x=geometry_info.rho;
+ scale.y=geometry_info.sigma;
+ if ((status & SigmaValue) == 0)
+ scale.y=scale.x;
+ geometry_aspect=scale.x/scale.y;
+ image_aspect=former_width/(double) former_height;
+ *width=former_width;
+ *height=former_height;
+ if (geometry_aspect >= image_aspect)
+ {
+ *width=(size_t) floor((former_width*geometry_aspect/
+ image_aspect)+0.5);
+ *height=(size_t) floor((former_height*image_aspect/
+ geometry_aspect)+0.5);
+ }
+ former_width=(*width);
+ former_height=(*height);
+ }
if (((flags & AspectValue) != 0) || ((*width == former_width) &&
(*height == former_height)))
{
#undef YNegative
YNegative = 0x0040,
ChiNegative = 0x0080,
- PercentValue = 0x1000, /* '%' percentage of something */
- AspectValue = 0x2000, /* '!' resize no-aspect - special use flag */
- NormalizeValue = 0x2000, /* '!' ScaleKernelValue() in morphology.c */
- LessValue = 0x4000, /* '<' resize smaller - special use flag */
- GreaterValue = 0x8000, /* '>' resize larger - spacial use flag */
- MinimumValue = 0x10000, /* '^' special handling needed */
+ PercentValue = 0x1000, /* '%' percentage of something */
+ AspectValue = 0x2000, /* '!' resize no-aspect - special use flag */
+ NormalizeValue = 0x2000, /* '!' ScaleKernelValue() in morphology.c */
+ LessValue = 0x4000, /* '<' resize smaller - special use flag */
+ GreaterValue = 0x8000, /* '>' resize larger - spacial use flag */
+ MinimumValue = 0x10000, /* '^' special handling needed */
CorrelateNormalizeValue = 0x10000, /* '^' see ScaleKernelValue() */
- AreaValue = 0x20000, /* '@' resize to area - special use flag */
- DecimalValue = 0x40000, /* '.' floating point numbers found */
- SeparatorValue = 0x80000, /* 'x' separator found */
+ AreaValue = 0x20000, /* '@' resize to area - special use flag */
+ DecimalValue = 0x40000, /* '.' floating point numbers found */
+ SeparatorValue = 0x80000, /* 'x' separator found */
+ TildeValue = 0x100000, /* '~' special handling needed */
#undef AllValues
AllValues = 0x7fffffff
} GeometryFlags;