2010-03-17 6.6.0-7 Cristy <quetzlzacatenango@image...>
* Detect CMYKProcessColor AI tag.
+ * Delete image from command line cache for -write option.
2010-03-13 6.6.0-6 Cristy <quetzlzacatenango@image...>
* Add support for the Adobe Large Document format.
geometry_info;
(void) ParseGeometry(image_info->density,&geometry_info);
- density=(unsigned long) (geometry_info.rho+0.5);
+ density=(unsigned long) floor(geometry_info.rho+0.5);
}
(void) FormatMagickString(header,MaxTextExtent,"rdensty: %04lu",density);
count=WriteCALSRecord(image,header);
if (draw_info->gravity == UndefinedGravity)
(void) CloneString(&draw_info->geometry,geometry);
status=GetMultilineTypeMetrics(image,draw_info,&metrics);
- width=(unsigned long) (metrics.width+draw_info->stroke_width+0.5);
- height=(unsigned long) (metrics.height+draw_info->stroke_width+0.5);
+ width=(unsigned long) floor(metrics.width+draw_info->stroke_width+0.5);
+ height=(unsigned long) floor(metrics.height+draw_info->stroke_width+
+ 0.5);
if ((width > (image->columns+1)) || (height > (image->rows+1)))
break;
draw_info->pointsize*=2.0;
if (draw_info->gravity == UndefinedGravity)
(void) CloneString(&draw_info->geometry,geometry);
status=GetMultilineTypeMetrics(image,draw_info,&metrics);
- width=(unsigned long) (metrics.width+draw_info->stroke_width+0.5);
- height=(unsigned long) (metrics.height+draw_info->stroke_width+0.5);
+ width=(unsigned long) floor(metrics.width+draw_info->stroke_width+0.5);
+ height=(unsigned long) floor(metrics.height+draw_info->stroke_width+
+ 0.5);
if ((width > (image->columns+1)) || (height > (image->rows+1)))
break;
draw_info->pointsize++;
window_max,
window_min;
- window_min=(long) (window_center-(window_width-1)/2.0-0.5);
- window_max=(long) (window_center+(window_width-1)/2.0-0.5);
+ window_min=(long) ceil(window_center-(window_width-1)/2.0-
+ 0.5);
+ window_max=(long) floor(window_center+(window_width-1)/2.0+
+ 0.5);
if ((long) pixel_value <= window_min)
index=0;
else
flags=ParseMetaGeometry(geometry,&sans,&sans,&image->columns,
&image->rows);
if (image->x_resolution != 0.0)
- image->columns=(unsigned long) ((image->columns*
+ image->columns=(unsigned long) floor((image->columns*
image->x_resolution)+0.5);
if (image->y_resolution != 0.0)
- image->rows=(unsigned long) ((image->rows*image->y_resolution)+0.5);
+ image->rows=(unsigned long) floor((image->rows*image->y_resolution)+
+ 0.5);
}
else
{
flags=ParseMetaGeometry(geometry,&sans,&sans,&image->columns,
&image->rows);
if (image->x_resolution != 0.0)
- image->columns=(unsigned long) (((image->columns*
+ image->columns=(unsigned long) floor(((image->columns*
image->x_resolution)/DefaultResolution)+0.5);
if (image->y_resolution != 0.0)
- image->rows=(unsigned long) (((image->rows*image->y_resolution)/
- DefaultResolution)+0.5);
+ image->rows=(unsigned long) floor(((image->rows*
+ image->y_resolution)/DefaultResolution)+0.5);
}
geometry=DestroyString(geometry);
}
fpx_status=FPX_GetImageResultAspectRatio(flashpix,&aspect_ratio);
if (fpx_status != FPX_OK)
ThrowReaderException(DelegateError,"UnableToReadAspectRatio");
- if (width != (unsigned long) ((aspect_ratio*height)+0.5))
+ if (width != (unsigned long) floor((aspect_ratio*height)+0.5))
Swap(width,height);
}
fpx_status=FPX_GetSummaryInformation(flashpix,&summary_info);
break;
if ((channel & RedChannel) != 0)
{
- y=(long) (histogram_image->rows-scale*histogram[x].red+0.5);
+ y=(long) ceil(histogram_image->rows-scale*histogram[x].red-0.5);
r=q+y;
for ( ; y < (long) histogram_image->rows; y++)
{
}
if ((channel & GreenChannel) != 0)
{
- y=(long) (histogram_image->rows-scale*histogram[x].green+0.5);
+ y=(long) ceil(histogram_image->rows-scale*histogram[x].green-0.5);
r=q+y;
for ( ; y < (long) histogram_image->rows; y++)
{
}
if ((channel & BlueChannel) != 0)
{
- y=(long) (histogram_image->rows-scale*histogram[x].blue+0.5);
+ y=(long) ceil(histogram_image->rows-scale*histogram[x].blue-0.5);
r=q+y;
for ( ; y < (long) histogram_image->rows; y++)
{
jpeg_info.density_unit=(UINT8) 1;
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- "Image resolution: %ld,%ld",(long) (image->x_resolution+0.5),
- (long) (image->y_resolution+0.5));
+ "Image resolution: %ld,%ld",(long) ceil(image->x_resolution-0.5),
+ (long) ceil(image->y_resolution-0.5));
if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0))
{
/*
status=GetMultilineTypeMetrics(image,draw_info,&metrics);
for ( ; status != MagickFalse; draw_info->pointsize*=2.0)
{
- width=(unsigned long) (metrics.width+draw_info->stroke_width+0.5);
- height=(unsigned long) (metrics.height+draw_info->stroke_width+0.5);
+ width=(unsigned long) floor(metrics.width+draw_info->stroke_width+0.5);
+ height=(unsigned long) floor(metrics.height+draw_info->stroke_width+
+ 0.5);
if (((image->columns != 0) && (width > (image->columns+1))) ||
((image->rows != 0) && (height > (image->rows+1))))
break;
}
for ( ; status != MagickFalse; draw_info->pointsize--)
{
- width=(unsigned long) (metrics.width+draw_info->stroke_width+0.5);
- height=(unsigned long) (metrics.height+draw_info->stroke_width+0.5);
+ width=(unsigned long) floor(metrics.width+draw_info->stroke_width+0.5);
+ height=(unsigned long) floor(metrics.height+draw_info->stroke_width+
+ 0.5);
if ((image->columns != 0) && (width <= (image->columns+1)) &&
((image->rows == 0) || (height <= (image->rows+1))))
break;
draw_info->geometry=AcquireString(geometry);
}
if (image->rows == 0)
- image->rows=(unsigned long) (metrics.height+draw_info->stroke_width+0.5);
- if (image->rows == 0)
- image->rows=(unsigned long) (draw_info->pointsize+draw_info->stroke_width+
+ image->rows=(unsigned long) floor(metrics.height+draw_info->stroke_width+
0.5);
+ if (image->rows == 0)
+ image->rows=(unsigned long) floor(draw_info->pointsize+
+ draw_info->stroke_width+0.5);
if (SetImageBackgroundColor(image) == MagickFalse)
{
InheritException(exception,&image->exception);
}
}
shadow_image=ShadowImage(msl_info->image[n],geometry_info.rho,
- geometry_info.sigma,(long) (geometry_info.xi+0.5),(long)
- (geometry_info.psi+0.5),&msl_info->image[n]->exception);
+ geometry_info.sigma,(long) floor(geometry_info.xi+0.5),(long)
+ floor(geometry_info.psi+0.5),&msl_info->image[n]->exception);
if (shadow_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
continue;
(void) sscanf(p,"viewbox %lf %lf %lf %lf",&bounds.x1,&bounds.y1,
&bounds.x2,&bounds.y2);
- image->columns=(unsigned long) ((bounds.x2-bounds.x1)+0.5);
- image->rows=(unsigned long) ((bounds.y2-bounds.y1)+0.5);
+ image->columns=(unsigned long) floor((bounds.x2-bounds.x1)+0.5);
+ image->rows=(unsigned long) floor((bounds.y2-bounds.y1)+0.5);
break;
}
}
/*
Set PCL render geometry.
*/
- width=(unsigned long) (bounds.x2-bounds.x1+0.5);
- height=(unsigned long) (bounds.y2-bounds.y1+0.5);
+ width=(unsigned long) floor(bounds.x2-bounds.x1+0.5);
+ height=(unsigned long) floor(bounds.y2-bounds.y1+0.5);
if (width > page.width)
page.width=width;
if (height > page.height)
(void) ParseAbsoluteGeometry(image_info->page,&page);
(void) FormatMagickString(density,MaxTextExtent,"%gx%g",
image->x_resolution,image->y_resolution);
- page.width=(unsigned long) (page.width*image->x_resolution/delta.x+0.5);
- page.height=(unsigned long) (page.height*image->y_resolution/delta.y+0.5);
+ page.width=(unsigned long) floor(page.width*image->x_resolution/delta.x+0.5);
+ page.height=(unsigned long) floor(page.height*image->y_resolution/delta.y+
+ 0.5);
(void) FormatMagickString(options,MaxTextExtent,"-g%lux%lu ",
page.width,page.height);
image=DestroyImage(image);
"%gx%g%+.15g%+.15g",bounds.x2-bounds.x1,bounds.y2-bounds.y1,
bounds.x1,bounds.y1);
(void) SetImageProperty(image,"pdf:HiResBoundingBox",geometry);
- page.width=(unsigned long) (bounds.x2-bounds.x1+0.5);
- page.height=(unsigned long) (bounds.y2-bounds.y1+0.5);
+ page.width=(unsigned long) floor(bounds.x2-bounds.x1+0.5);
+ page.height=(unsigned long) floor(bounds.y2-bounds.y1+0.5);
hires_bounds=bounds;
}
}
if (image_info->page != (char *) NULL)
{
(void) ParseAbsoluteGeometry(image_info->page,&page);
- page.width=(unsigned long) (page.width*image->x_resolution/delta.x+0.5);
- page.height=(unsigned long) (page.height*image->y_resolution/delta.y+0.5);
+ page.width=(unsigned long) floor(page.width*image->x_resolution/delta.x+
+ 0.5);
+ page.height=(unsigned long) floor(page.height*image->y_resolution/delta.y+
+ 0.5);
(void) FormatMagickString(options,MaxTextExtent,"-g%lux%lu ",page.width,
page.height);
}
(void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y,
&geometry.width,&geometry.height);
scale.x=(double) (geometry.width*delta.x)/resolution.x;
- geometry.width=(unsigned long) (scale.x+0.5);
+ geometry.width=(unsigned long) floor(scale.x+0.5);
scale.y=(double) (geometry.height*delta.y)/resolution.y;
- geometry.height=(unsigned long) (scale.y+0.5);
+ geometry.height=(unsigned long) floor(scale.y+0.5);
(void) ParseAbsoluteGeometry(page_geometry,&media_info);
(void) ParseGravityGeometry(image,page_geometry,&page_info,
&image->exception);
"%gx%g%+.15g%+.15g",bounds.x2-bounds.x1,bounds.y2-bounds.y1,
bounds.x1,bounds.y1);
(void) SetImageProperty(image,"ps:HiResBoundingBox",geometry);
- page.width=(unsigned long) (bounds.x2-bounds.x1+0.5);
- page.height=(unsigned long) (bounds.y2-bounds.y1+0.5);
+ page.width=(unsigned long) floor(bounds.x2-bounds.x1+0.5);
+ page.height=(unsigned long) floor(bounds.y2-bounds.y1+0.5);
hires_bounds=bounds;
}
}
(void) ParseAbsoluteGeometry(image_info->page,&page);
(void) FormatMagickString(density,MaxTextExtent,"%gx%g",
image->x_resolution,image->y_resolution);
- page.width=(unsigned long) (page.width*image->x_resolution/delta.x+0.5);
- page.height=(unsigned long) (page.height*image->y_resolution/delta.y+0.5);
+ page.width=(unsigned long) floor(page.width*image->x_resolution/delta.x+0.5);
+ page.height=(unsigned long) floor(page.height*image->y_resolution/delta.y+
+ 0.5);
(void) FormatMagickString(options,MaxTextExtent,"-g%lux%lu ",
page.width,page.height);
read_info=CloneImageInfo(image_info);
(void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y,
&geometry.width,&geometry.height);
scale.x=(double) (geometry.width*delta.x)/resolution.x;
- geometry.width=(unsigned long) (scale.x+0.5);
+ geometry.width=(unsigned long) floor(scale.x+0.5);
scale.y=(double) (geometry.height*delta.y)/resolution.y;
- geometry.height=(unsigned long) (scale.y+0.5);
+ geometry.height=(unsigned long) floor(scale.y+0.5);
(void) ParseAbsoluteGeometry(page_geometry,&media_info);
(void) ParseGravityGeometry(image,page_geometry,&page_info,
&image->exception);
else
{
(void) FormatMagickString(buffer,MaxTextExtent,
- "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) (bounds.x1+0.5),
- (long) (bounds.y1+0.5),(long) (bounds.x2+0.5),
- (long) (bounds.y2+0.5));
+ "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) ceil(bounds.x1-0.5),
+ (long) ceil(bounds.y1-0.5),(long) floor(bounds.x2+0.5),
+ (long) floor(bounds.y2+0.5));
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,
"%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,
if (page > 2)
{
(void) FormatMagickString(buffer,MaxTextExtent,
- "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) (bounds.x1+0.5),
- (long) (bounds.y1+0.5),(long) (bounds.x2+0.5),(long) (bounds.y2+0.5));
+ "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) ceil(bounds.x1-0.5),
+ (long) ceil(bounds.y1-0.5),(long) floor(bounds.x2+0.5),(long)
+ floor(bounds.y2+0.5));
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,
"%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,
(void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y,
&geometry.width,&geometry.height);
scale.x=(double) (geometry.width*delta.x)/resolution.x;
- geometry.width=(unsigned long) (scale.x+0.5);
+ geometry.width=(unsigned long) floor(scale.x+0.5);
scale.y=(double) (geometry.height*delta.y)/resolution.y;
- geometry.height=(unsigned long) (scale.y+0.5);
+ geometry.height=(unsigned long) floor(scale.y+0.5);
(void) ParseAbsoluteGeometry(page_geometry,&media_info);
(void) ParseGravityGeometry(image,page_geometry,&page_info,
&image->exception);
else
{
(void) FormatMagickString(buffer,MaxTextExtent,
- "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) (bounds.x1+0.5),
- (long) (bounds.y1+0.5),
- (long) (bounds.x2+0.5),(long) (bounds.y2+0.5));
+ "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) ceil(bounds.x1-0.5),
+ (long) ceil(bounds.y1-0.5),(long) floor(bounds.x2+0.5),(long)
+ floor(bounds.y2+0.5));
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,
"%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,
if (page > 1)
{
(void) FormatMagickString(buffer,MaxTextExtent,
- "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) (bounds.x1+0.5),
- (long) (bounds.y1+0.5),(long) (bounds.x2+0.5),(long) (bounds.y2+0.5));
+ "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) ceil(bounds.x1-0.5),
+ (long) ceil(bounds.y1-0.5),(long) floor(bounds.x2+0.5),(long)
+ floor(bounds.y2+0.5));
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,
"%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,
(void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y,
&geometry.width,&geometry.height);
scale.x=(double) (geometry.width*delta.x)/resolution.x;
- geometry.width=(unsigned long) (scale.x+0.5);
+ geometry.width=(unsigned long) floor(scale.x+0.5);
scale.y=(double) (geometry.height*delta.y)/resolution.y;
- geometry.height=(unsigned long) (scale.y+0.5);
+ geometry.height=(unsigned long) floor(scale.y+0.5);
(void) ParseAbsoluteGeometry(page_geometry,&media_info);
(void) ParseGravityGeometry(image,page_geometry,&page_info,
&image->exception);
if ((svg_info->view_box.width == 0.0) ||
(svg_info->view_box.height == 0.0))
svg_info->view_box=svg_info->bounds;
- svg_info->width=(unsigned long) (svg_info->bounds.width+0.5);
- svg_info->height=(unsigned long) (svg_info->bounds.height+0.5);
+ svg_info->width=(unsigned long) floor(svg_info->bounds.width+0.5);
+ svg_info->height=(unsigned long) floor(svg_info->bounds.height+0.5);
MVGPrintf(svg_info->file,"viewbox 0 0 %lu %lu\n",svg_info->width,
svg_info->height);
sx=(double) svg_info->width/svg_info->view_box.width;
y_position=(float) image->page.y/y_resolution;
(void) TIFFGetFieldDefaulted(tiff,TIFFTAG_XPOSITION,&x_position);
(void) TIFFGetFieldDefaulted(tiff,TIFFTAG_YPOSITION,&y_position);
- image->page.x=(long) (x_position*x_resolution+0.5);
- image->page.y=(long) (y_position*y_resolution+0.5);
+ image->page.x=(long) ceil(x_position*x_resolution-0.5);
+ image->page.y=(long) ceil(y_position*y_resolution-0.5);
image->orientation=(OrientationType) orientation;
chromaticity=(float *) NULL;
(void) TIFFGetField(tiff,TIFFTAG_WHITEPOINT,&chromaticity);
/*
Initialize Image structure.
*/
- image->columns=(unsigned long) (((page.width*image->x_resolution)/
+ image->columns=(unsigned long) floor(((page.width*image->x_resolution)/
delta.x)+0.5);
- image->rows=(unsigned long) (((page.height*image->y_resolution)/delta.y)+0.5);
+ image->rows=(unsigned long) floor(((page.height*image->y_resolution)/
+ delta.y)+0.5);
image->page.x=0;
image->page.y=0;
texture=(Image *) NULL;
status=GetTypeMetrics(image,draw_info,&metrics);
if (status == MagickFalse)
ThrowReaderException(TypeError,"UnableToGetTypeMetrics");
- page.y=(long) (page.y+metrics.ascent+0.5);
+ page.y=(long) ceil(page.y+metrics.ascent-0.5);
(void) FormatMagickString(geometry,MaxTextExtent,"0x0%+ld%+ld",page.x,page.y);
(void) CloneString(&draw_info->geometry,geometry);
(void) CopyMagickString(filename,image_info->filename,MaxTextExtent);
/*
Set XPS render geometry.
*/
- width=(unsigned long) (bounds.x2-bounds.x1+0.5);
- height=(unsigned long) (bounds.y2-bounds.y1+0.5);
+ width=(unsigned long) floor(bounds.x2-bounds.x1+0.5);
+ height=(unsigned long) floor(bounds.y2-bounds.y1+0.5);
if (width > page.width)
page.width=width;
if (height > page.height)
(void) ParseAbsoluteGeometry(PSPageGeometry,&page);
if (image_info->page != (char *) NULL)
(void) ParseAbsoluteGeometry(image_info->page,&page);
- page.width=(unsigned long) (page.width*image->y_resolution/delta.x+0.5);
- page.height=(unsigned long) (page.height*image->y_resolution/delta.y+0.5);
+ page.width=(unsigned long) floor(page.width*image->y_resolution/delta.x+0.5);
+ page.height=(unsigned long) floor(page.height*image->y_resolution/delta.y+
+ 0.5);
(void) FormatMagickString(options,MaxTextExtent,"-g%lux%lu ",
page.width,page.height);
image=DestroyImage(image);
status=GetTypeMetrics(image,draw_info,metrics);
if (status == MagickFalse)
break;
- width=(unsigned long) (metrics->width+0.5);
+ width=(unsigned long) floor(metrics->width+0.5);
if (GetUTFCode(p) != '\n')
if (width <= image->columns)
continue;
TypeWarning,"UnableToReadFont","`%s'",draw_info->family);
}
if (type_info == (const TypeInfo *) NULL)
- type_info=GetTypeInfoByFamily("Utopia",draw_info->style,
+ type_info=GetTypeInfoByFamily("Century Schoolbook",draw_info->style,
draw_info->stretch,draw_info->weight,&image->exception);
if (type_info == (const TypeInfo *) NULL)
type_info=GetTypeInfoByFamily("Arial",draw_info->style,
if (status == MagickFalse)
continue;
- x_offset=(long) (point.x+0.5);
- y_offset=(long) (point.y+y+0.5);
+ x_offset=(long) ceil(point.x-0.5);
+ y_offset=(long) ceil(point.y+y-0.5);
if ((y_offset < 0) || (y_offset >= (long) image->rows))
continue;
q=(PixelPacket *) NULL;
if (status == MagickFalse)
continue;
- x_offset=(long) (point.x+0.5);
- y_offset=(long) (point.y+y+0.5);
+ x_offset=(long) ceil(point.x-0.5);
+ y_offset=(long) ceil(point.y+y-0.5);
if ((y_offset < 0) || (y_offset >= (long) image->rows))
continue;
q=(PixelPacket *) NULL;
(void) fprintf(file,"showpage\n");
(void) fclose(file);
(void) FormatMagickString(geometry,MaxTextExtent,"%ldx%ld+0+0!",(long)
- (extent.x+0.5),(long) (extent.y+0.5));
+ floor(extent.x+0.5),(long) floor(extent.y+0.5));
annotate_info=AcquireImageInfo();
(void) FormatMagickString(annotate_info->filename,MaxTextExtent,"ps:%s",
filename);
crop_info=GetImageBoundingBox(annotate_image,&annotate_image->exception);
crop_info.height=(unsigned long) ((resolution.y/DefaultResolution)*
ExpandAffine(&draw_info->affine)*draw_info->pointsize+0.5);
- crop_info.y=(long) ((resolution.y/DefaultResolution)*extent.y/8.0+0.5);
+ crop_info.y=(long) ceil((resolution.y/DefaultResolution)*extent.y/8.0-
+ 0.5);
(void) FormatMagickString(geometry,MaxTextExtent,"%lux%lu%+ld%+ld",
crop_info.width,crop_info.height,crop_info.x,crop_info.y);
(void) TransformImage(&annotate_image,geometry,(char *) NULL);
}
annotate_view=DestroyCacheView(annotate_view);
(void) CompositeImage(image,OverCompositeOp,annotate_image,
- (long) (offset->x+0.5),(long) (offset->y-(metrics->ascent+
- metrics->descent)+0.5));
+ (long) ceil(offset->x-0.5),(long) ceil(offset->y-(metrics->ascent+
+ metrics->descent)-0.5));
}
annotate_image=DestroyImage(annotate_image);
return(MagickTrue);
atan2(draw_info->affine.rx,draw_info->affine.sx);
}
(void) FormatMagickString(annotate_info.geometry,MaxTextExtent,
- "%lux%lu+%ld+%ld",width,height,(long) (offset->x+0.5),
- (long) (offset->y-metrics->ascent-metrics->descent+
- draw_info->interline_spacing+0.5));
+ "%lux%lu+%ld+%ld",width,height,(long) ceil(offset->x-0.5),
+ (long) ceil(offset->y-metrics->ascent-metrics->descent+
+ draw_info->interline_spacing-0.5));
pixel.pen_color.red=ScaleQuantumToShort(draw_info->fill.red);
pixel.pen_color.green=ScaleQuantumToShort(draw_info->fill.green);
pixel.pen_color.blue=ScaleQuantumToShort(draw_info->fill.blue);
if ((flags & PsiValue) == 0)
geometry_info.psi=0.1*(*image)->rows;
vignette_image=VignetteImage(*image,geometry_info.rho,geometry_info.sigma,
- (long) (geometry_info.xi+0.5),(long) (geometry_info.psi+0.5),
+ (long) floor(geometry_info.xi+0.5),(long) floor(geometry_info.psi+0.5),
&(*image)->exception);
if (vignette_image != (Image *) NULL)
{
static inline double MagickRound(double x)
{
- /* round the fraction to nearest integer */
+ /*
+ Round the fraction to nearest integer.
+ */
if (x >= 0.0)
return((double) ((long) (x+0.5)));
return((double) ((long) (x-0.5)));
Do not do this for DePolar which needs to be exact for tiling
*/
if ( bestfit && method != DePolarDistortion ) {
- geometry.x = (long) floor(min.x-0.5);
- geometry.y = (long) floor(min.y-0.5);
- geometry.width=(unsigned long) ceil(max.x-geometry.x+0.5);
- geometry.height=(unsigned long) ceil(max.y-geometry.y+0.5);
+ geometry.x = (long) ceil(min.x-0.5);
+ geometry.y = (long) ceil(min.y-0.5);
+ geometry.width=(unsigned long) floor(max.x-geometry.x+0.5);
+ geometry.height=(unsigned long) floor(max.y-geometry.y+0.5);
}
/* now that we have a new size lets fit distortion to it exactly */
if ( method == DePolarDistortion ) {
inverse_edge.x2=x;
}
else
- if ((z < 0.0) || ((unsigned long) (z+0.5) >= image->columns))
+ if ((z < 0.0) || ((unsigned long) floor(z+0.5) >= image->columns))
{
inverse_edge.x2=edge->x1;
return(inverse_edge);
inverse_edge.x2=x;
}
else
- if ((z < 0.0) || ((unsigned long) (z+0.5) >= image->rows))
+ if ((z < 0.0) || ((unsigned long) floor(z+0.5) >= image->rows))
{
inverse_edge.x2=edge->x2;
return(inverse_edge);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(status)
#endif
- for (y=(long) (edge.y1+0.5); y <= (long) (edge.y2+0.5); y++)
+ for (y=(long) ceil(edge.y1-0.5); y <= (long) floor(edge.y2+0.5); y++)
{
long
x_offset;
inverse_edge=AffineEdge(source,&inverse_affine,(double) y,&edge);
if (inverse_edge.x2 < inverse_edge.x1)
continue;
- q=GetCacheViewAuthenticPixels(image_view,(long) (inverse_edge.x1+0.5),y,
- (unsigned long) ((long) (inverse_edge.x2+0.5)-(long) (inverse_edge.x1+
- 0.5)+1),1,exception);
+ q=GetCacheViewAuthenticPixels(image_view,(long) ceil(inverse_edge.x1-0.5),y,
+ (unsigned long) ((long) floor(inverse_edge.x2+0.5)-(long) floor(
+ inverse_edge.x1+0.5)+1),1,exception);
if (q == (PixelPacket *) NULL)
continue;
id=GetOpenMPThreadId();
pixel=zero;
composite=zero;
x_offset=0;
- for (x=(long) (inverse_edge.x1+0.5); x <= (long) (inverse_edge.x2+0.5); x++)
+ for (x=(long) ceil(inverse_edge.x1-0.5); x <= (long) floor(inverse_edge.x2+0.5); x++)
{
point.x=(double) x*inverse_affine.sx+y*inverse_affine.ry+
inverse_affine.tx;
GetMagickToken(q,&q,token);
(void) CopyMagickString(name,token,MaxTextExtent);
GetMagickToken(q,&q,token);
- bounds.x=(long) (StringToDouble(token)+0.5);
+ bounds.x=(long) ceil(StringToDouble(token)-0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- bounds.y=(long) (StringToDouble(token)+0.5);
+ bounds.y=(long) ceil(StringToDouble(token)-0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- bounds.width=(unsigned long) (StringToDouble(token)+0.5);
+ bounds.width=(unsigned long) floor(StringToDouble(token)+0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- bounds.height=(unsigned long) (StringToDouble(token)+0.5);
+ bounds.height=(unsigned long) floor(StringToDouble(token)+0.5);
for (p=q; *q != '\0'; )
{
GetMagickToken(q,&q,token);
if (LocaleCompare("viewbox",keyword) == 0)
{
GetMagickToken(q,&q,token);
- graphic_context[n]->viewbox.x=(long) (StringToDouble(token)+0.5);
+ graphic_context[n]->viewbox.x=(long) ceil(StringToDouble(token)-
+ 0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- graphic_context[n]->viewbox.y=(long) (StringToDouble(token)+0.5);
+ graphic_context[n]->viewbox.y=(long) ceil(StringToDouble(token)-
+ 0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- graphic_context[n]->viewbox.width=(unsigned long) (StringToDouble(token)+0.5);
+ graphic_context[n]->viewbox.width=(unsigned long) floor(
+ StringToDouble(token)+0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- graphic_context[n]->viewbox.height=(unsigned long) (StringToDouble(token)+
- 0.5);
+ graphic_context[n]->viewbox.height=(unsigned long) floor(
+ StringToDouble(token)+0.5);
break;
}
status=MagickFalse;
case UndefinedSpread:
case PadSpread:
{
- if ((x != (long) (gradient_vector->x1+0.5)) ||
- (y != (long) (gradient_vector->y1+0.5)))
+ if ((x != (long) ceil(gradient_vector->x1-0.5)) ||
+ (y != (long) ceil(gradient_vector->y1-0.5)))
{
offset=GetStopColorOffset(gradient,x,y);
if (gradient->type != RadialGradient)
}
case ReflectSpread:
{
- if ((x != (long) (gradient_vector->x1+0.5)) ||
- (y != (long) (gradient_vector->y1+0.5)))
+ if ((x != (long) ceil(gradient_vector->x1-0.5)) ||
+ (y != (long) ceil(gradient_vector->y1-0.5)))
{
offset=GetStopColorOffset(gradient,x,y);
if (gradient->type != RadialGradient)
antialias=MagickFalse;
repeat=0.0;
- if ((x != (long) (gradient_vector->x1+0.5)) ||
- (y != (long) (gradient_vector->y1+0.5)))
+ if ((x != (long) ceil(gradient_vector->x1-0.5)) ||
+ (y != (long) ceil(gradient_vector->y1-0.5)))
{
offset=GetStopColorOffset(gradient,x,y);
if (gradient->type == LinearGradient)
bounds.y2=p->bounds.y2;
}
bounds.x1-=(mid+1.0);
- bounds.x1=bounds.x1 < 0.0 ? 0.0 : (unsigned long) (bounds.x1+0.5) >=
+ bounds.x1=bounds.x1 < 0.0 ? 0.0 : (unsigned long) ceil(bounds.x1-0.5) >=
image->columns ? (double) image->columns-1.0 : bounds.x1;
bounds.y1-=(mid+1.0);
- bounds.y1=bounds.y1 < 0.0 ? 0.0 : (unsigned long) (bounds.y1+0.5) >=
+ bounds.y1=bounds.y1 < 0.0 ? 0.0 : (unsigned long) ceil(bounds.y1-0.5) >=
image->rows ? (double) image->rows-1.0 : bounds.y1;
bounds.x2+=(mid+1.0);
- bounds.x2=bounds.x2 < 0.0 ? 0.0 : (unsigned long) (bounds.x2+0.5) >=
+ bounds.x2=bounds.x2 < 0.0 ? 0.0 : (unsigned long) floor(bounds.x2+0.5) >=
image->columns ? (double) image->columns-1.0 : bounds.x2;
bounds.y2+=(mid+1.0);
- bounds.y2=bounds.y2 < 0.0 ? 0.0 : (unsigned long) (bounds.y2+0.5) >=
+ bounds.y2=bounds.y2 < 0.0 ? 0.0 : (unsigned long) floor(bounds.y2+0.5) >=
image->rows ? (double) image->rows-1.0 : bounds.y2;
status=MagickTrue;
exception=(&image->exception);
- start=(long) (bounds.x1+0.5);
- stop=(long) (bounds.x2+0.5);
+ start=(long) ceil(bounds.x1-0.5);
+ stop=(long) floor(bounds.x2+0.5);
image_view=AcquireCacheView(image);
if (primitive_info->coordinates == 1)
{
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(status)
#endif
- for (y=(long) (bounds.y1+0.5); y <= (long) (bounds.y2+0.5); y++)
+ for (y=(long) ceil(bounds.y1-0.5); y <= (long) floor(bounds.y2+0.5); y++)
{
MagickBooleanType
sync;
}
for ( ; x <= stop; x++)
{
- if ((x == (long) (primitive_info->point.x+0.5)) &&
- (y == (long) (primitive_info->point.y+0.5)))
+ if ((x == (long) ceil(primitive_info->point.x-0.5)) &&
+ (y == (long) ceil(primitive_info->point.y-0.5)))
(void) GetStrokeColor(draw_info,x,y,q);
q++;
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(status)
#endif
- for (y=(long) (bounds.y1+0.5); y <= (long) (bounds.y2+0.5); y++)
+ for (y=(long) ceil(bounds.y1-0.5); y <= (long) floor(bounds.y2+0.5); y++)
{
MagickRealType
fill_opacity,
i,
x;
- x=(long) (primitive_info->point.x+0.5);
- y=(long) (primitive_info->point.y+0.5);
+ x=(long) ceil(primitive_info->point.x-0.5);
+ y=(long) ceil(primitive_info->point.y-0.5);
switch (primitive_info->primitive)
{
case PointPrimitive:
}
status=MagickTrue;
exception=(&image->exception);
- x=(long) (primitive_info->point.x+0.5);
- y=(long) (primitive_info->point.y+0.5);
+ x=(long) ceil(primitive_info->point.x-0.5);
+ y=(long) ceil(primitive_info->point.y-0.5);
image_view=AcquireCacheView(image);
switch (primitive_info->primitive)
{
break;
(void) SetImageProgressMonitor(composite_image,(MagickProgressMonitor)
NULL,(void *) NULL);
- x1=(long) (primitive_info[1].point.x+0.5);
- y1=(long) (primitive_info[1].point.y+0.5);
+ x1=(long) ceil(primitive_info[1].point.x-0.5);
+ y1=(long) ceil(primitive_info[1].point.y-0.5);
if (((x1 != 0L) && (x1 != (long) composite_image->columns)) ||
((y1 != 0L) && (y1 != (long) composite_image->rows)))
{
v;
gamma=0.0;
- i=(long) (width*QuantumScale*PixelIntensity(r)+0.5);
+ i=(long) ceil(width*QuantumScale*PixelIntensity(r)-0.5);
if (i < 0)
i=0;
else
v;
gamma=0.0;
- i=(long) (width*(QuantumRange-QuantumScale*PixelIntensity(r))+0.5);
+ i=(long) ceil(width*(QuantumRange-QuantumScale*PixelIntensity(r))-0.5);
if (i < 0)
i=0;
else
point.y=(double) width*cos(DegreesToRadians(angle));
for (i=0; i < (long) width; i++)
{
- offset[i].x=(long) ((i*point.y)/hypot(point.x,point.y)+0.5);
- offset[i].y=(long) ((i*point.x)/hypot(point.x,point.y)+0.5);
+ offset[i].x=(long) ceil((i*point.y)/hypot(point.x,point.y)-0.5);
+ offset[i].y=(long) ceil((i*point.x)/hypot(point.x,point.y)-0.5);
}
/*
Motion blur image.
*/
depth--;
attenuate++;
- x_mid=(long) (segment->x1+segment->x2+0.5)/2;
- y_mid=(long) (segment->y1+segment->y2+0.5)/2;
+ x_mid=(long) ceil(segment->x1+segment->x2-0.5)/2;
+ y_mid=(long) ceil(segment->y1+segment->y2-0.5)/2;
local_info=(*segment);
local_info.x2=(double) x_mid;
local_info.y2=(double) y_mid;
}
if (SetImageStorageClass(image,DirectClass) == MagickFalse)
return(MagickFalse);
- x_mid=(long) (segment->x1+segment->x2+0.5)/2;
- y_mid=(long) (segment->y1+segment->y2+0.5)/2;
+ x_mid=(long) ceil(segment->x1+segment->x2-0.5)/2;
+ y_mid=(long) ceil(segment->y1+segment->y2-0.5)/2;
if ((segment->x1 == (double) x_mid) && (segment->x2 == (double) x_mid) &&
(segment->y1 == (double) y_mid) && (segment->y2 == (double) y_mid))
return(MagickFalse);
/*
Left pixel.
*/
- x=(long) (segment->x1+0.5);
- (void) GetOneVirtualPixel(image,x,(long) (segment->y1+0.5),&u,exception);
- (void) GetOneVirtualPixel(image,x,(long) (segment->y2+0.5),&v,exception);
+ x=(long) ceil(segment->x1-0.5);
+ (void) GetOneVirtualPixel(image,x,(long) ceil(segment->y1-0.5),&u,
+ exception);
+ (void) GetOneVirtualPixel(image,x,(long) ceil(segment->y2-0.5),&v,
+ exception);
q=QueueAuthenticPixels(image,x,y_mid,1,1,exception);
if (q == (PixelPacket *) NULL)
return(MagickTrue);
/*
Right pixel.
*/
- x=(long) (segment->x2+0.5);
- (void) GetOneVirtualPixel(image,x,(long) (segment->y1+0.5),&u,
+ x=(long) ceil(segment->x2-0.5);
+ (void) GetOneVirtualPixel(image,x,(long) ceil(segment->y1-0.5),&u,
exception);
- (void) GetOneVirtualPixel(image,x,(long) (segment->y2+0.5),&v,
+ (void) GetOneVirtualPixel(image,x,(long) ceil(segment->y2-0.5),&v,
exception);
q=QueueAuthenticPixels(image,x,y_mid,1,1,exception);
if (q == (PixelPacket *) NULL)
/*
Bottom pixel.
*/
- y=(long) (segment->y2+0.5);
- (void) GetOneVirtualPixel(image,(long) (segment->x1+0.5),y,&u,
+ y=(long) ceil(segment->y2-0.5);
+ (void) GetOneVirtualPixel(image,(long) ceil(segment->x1-0.5),y,&u,
exception);
- (void) GetOneVirtualPixel(image,(long) (segment->x2+0.5),y,&v,
+ (void) GetOneVirtualPixel(image,(long) ceil(segment->x2-0.5),y,&v,
exception);
q=QueueAuthenticPixels(image,x_mid,y,1,1,exception);
if (q == (PixelPacket *) NULL)
/*
Top pixel.
*/
- y=(long) (segment->y1+0.5);
- (void) GetOneVirtualPixel(image,(long) (segment->x1+0.5),y,&u,
+ y=(long) ceil(segment->y1-0.5);
+ (void) GetOneVirtualPixel(image,(long) ceil(segment->x1-0.5),y,&u,
exception);
- (void) GetOneVirtualPixel(image,(long) (segment->x2+0.5),y,&v,
+ (void) GetOneVirtualPixel(image,(long) ceil(segment->x2-0.5),y,&v,
exception);
q=QueueAuthenticPixels(image,x_mid,y,1,1,exception);
if (q == (PixelPacket *) NULL)
/*
Middle pixel.
*/
- x=(long) (segment->x1+0.5);
- y=(long) (segment->y1+0.5);
+ x=(long) ceil(segment->x1-0.5);
+ y=(long) ceil(segment->y1-0.5);
(void) GetOneVirtualPixel(image,x,y,&u,exception);
- x=(long) (segment->x2+0.5);
- y=(long) (segment->y2+0.5);
+ x=(long) ceil(segment->x2-0.5);
+ y=(long) ceil(segment->y2-0.5);
(void) GetOneVirtualPixel(image,x,y,&v,exception);
q=QueueAuthenticPixels(image,x_mid,y_mid,1,1,exception);
if (q == (PixelPacket *) NULL)
return((Image *) NULL);
(void) SetImageVirtualPixelMethod(clone_image,EdgeVirtualPixelMethod);
clone_image->compose=OverCompositeOp;
- border_info.width=(unsigned long) (2.0*sigma+0.5);
- border_info.height=(unsigned long) (2.0*sigma+0.5);
+ border_info.width=(unsigned long) floor(2.0*sigma+0.5);
+ border_info.height=(unsigned long) floor(2.0*sigma+0.5);
border_info.x=0;
border_info.y=0;
(void) QueryColorDatabase("none",&clone_image->border_color,exception);
scale.y=geometry_info.sigma;
if ((status & SigmaValue) == 0)
scale.y=scale.x;
- region_info->width=(unsigned long) ((scale.x*image->columns/100.0)+0.5);
- region_info->height=(unsigned long) ((scale.y*image->rows/100.0)+0.5);
+ region_info->width=(unsigned long) floor((scale.x*image->columns/100.0)+
+ 0.5);
+ region_info->height=(unsigned long) floor((scale.y*image->rows/100.0)+
+ 0.5);
}
/*
Adjust offset according to gravity setting.
scale.y=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
scale.y=scale.x;
- *width=(unsigned long) (scale.x*former_width/100.0+0.5);
+ *width=(unsigned long) floor(scale.x*former_width/100.0-0.5);
if (*width == 0)
*width=1;
- *height=(unsigned long) (scale.y*former_height/100.0+0.5);
+ *height=(unsigned long) floor(scale.y*former_height/100.0-0.5);
if (*height == 0)
*height=1;
former_width=(*width);
scale_factor=(MagickRealType) *height/(MagickRealType)
former_width;
}
- *width=MagickMax((unsigned long) (scale_factor*former_width+0.5),1UL);
- *height=MagickMax((unsigned long) (scale_factor*former_height+0.5),1UL);
+ *width=MagickMax((unsigned long) floor(scale_factor*former_width+0.5),
+ 1UL);
+ *height=MagickMax((unsigned long) floor(scale_factor*former_height+0.5),
+ 1UL);
}
if ((flags & GreaterValue) != 0)
{
return(clone_image);
}
scale=(MagickRealType) columns/(MagickRealType) image->columns;
- clone_image->page.width=(unsigned long) (scale*image->page.width+0.5);
- clone_image->page.x=(long) (scale*image->page.x+0.5);
- clone_image->tile_offset.x=(long) (scale*image->tile_offset.x+0.5);
+ clone_image->page.width=(unsigned long) floor(scale*image->page.width+0.5);
+ clone_image->page.x=(long) ceil(scale*image->page.x-0.5);
+ clone_image->tile_offset.x=(long) ceil(scale*image->tile_offset.x-0.5);
scale=(MagickRealType) rows/(MagickRealType) image->rows;
- clone_image->page.height=(unsigned long) (scale*image->page.height+0.5);
- clone_image->page.y=(long) (image->page.y*scale+0.5);
- clone_image->tile_offset.y=(long) (scale*image->tile_offset.y+0.5);
+ clone_image->page.height=(unsigned long) floor(scale*image->page.height+0.5);
+ clone_image->page.y=(long) ceil(image->page.y*scale-0.5);
+ clone_image->tile_offset.y=(long) ceil(scale*image->tile_offset.y-0.5);
clone_image->columns=columns;
clone_image->rows=rows;
clone_image->cache=ClonePixelCache(image->cache);
flags=ParseGeometry(option,&geometry_info);
if ((flags & GreaterValue) != 0)
{
- if (image->delay > (unsigned long) (geometry_info.rho+0.5))
- image->delay=(unsigned long) (geometry_info.rho+0.5);
+ if (image->delay > (unsigned long) floor(geometry_info.rho+0.5))
+ image->delay=(unsigned long) floor(geometry_info.rho+0.5);
}
else
if ((flags & LessValue) != 0)
{
- if (image->delay < (unsigned long) (geometry_info.rho+0.5))
- image->ticks_per_second=(long) (geometry_info.sigma+0.5);
+ if (image->delay < (unsigned long) floor(geometry_info.rho+0.5))
+ image->ticks_per_second=(long) floor(geometry_info.sigma+0.5);
}
else
- image->delay=(unsigned long) (geometry_info.rho+0.5);
+ image->delay=(unsigned long) floor(geometry_info.rho+0.5);
if ((flags & SigmaValue) != 0)
- image->ticks_per_second=(long) (geometry_info.sigma+0.5);
+ image->ticks_per_second=(long) floor(geometry_info.sigma+0.5);
}
option=GetImageOption(image_info,"density");
if (option != (const char *) NULL)
flags=ParseGeometry(value,&geometry_info);
if ((flags & GreaterValue) != 0)
{
- if (image->delay > (unsigned long) (geometry_info.rho+0.5))
- image->delay=(unsigned long) (geometry_info.rho+0.5);
+ if (image->delay > (unsigned long) floor(geometry_info.rho+0.5))
+ image->delay=(unsigned long) floor(geometry_info.rho+0.5);
}
else
if ((flags & LessValue) != 0)
{
- if (image->delay < (unsigned long) (geometry_info.rho+0.5))
- image->ticks_per_second=(long) (geometry_info.sigma+0.5);
+ if (image->delay < (unsigned long) floor(geometry_info.rho+0.5))
+ image->ticks_per_second=(long) floor(geometry_info.sigma+0.5);
}
else
- image->delay=(unsigned long) (geometry_info.rho+0.5);
+ image->delay=(unsigned long) floor(geometry_info.rho+0.5);
if ((flags & SigmaValue) != 0)
- image->ticks_per_second=(long) (geometry_info.sigma+0.5);
+ image->ticks_per_second=(long) floor(geometry_info.sigma+0.5);
break;
}
if (LocaleCompare(property,"depth") == 0)
if (status == MagickFalse)
continue;
center=(MagickRealType) (x+0.5)/x_factor;
- start=(long) (MagickMax(center-support-MagickEpsilon,0.0)+0.5);
- stop=(long) (MagickMin(center+support,(double) image->columns)+0.5);
+ start=(long) ceil(MagickMax(center-support-MagickEpsilon,0.0)-0.5);
+ stop=(long) floor(MagickMin(center+support,(double) image->columns)+0.5);
density=0.0;
contribution=contributions[GetOpenMPThreadId()];
for (n=0; n < (stop-start); n++)
if (status == MagickFalse)
continue;
- center=(MagickRealType) (y+0.5)/y_factor;
- start=(long) (MagickMax(center-support-MagickEpsilon,0.0)+0.5);
- stop=(long) (MagickMin(center+support,(double) image->rows)+0.5);
+ center=(MagickRealType) (y-0.5)/y_factor;
+ start=(long) ceil(MagickMax(center-support-MagickEpsilon,0.0)-0.5);
+ stop=(long) floor(MagickMin(center+support,(double) image->rows)+0.5);
density=0.0;
contribution=contributions[GetOpenMPThreadId()];
for (n=0; n < (stop-start); n++)
if (status == MagickFalse)
continue;
- y_offset=(long) (((MagickRealType) y+0.5)*image->rows/sample_image->rows);
+ y_offset=(long) ceil(((MagickRealType) y-0.5)*image->rows/
+ sample_image->rows);
p=GetCacheViewVirtualPixels(image_view,0,y_offset,image->columns,1,
exception);
q=QueueCacheViewAuthenticPixels(sample_view,0,y,sample_image->columns,1,
if (max.y < extent[i].y)
max.y=extent[i].y;
}
- geometry.x=(long) (min.x+0.5);
- geometry.y=(long) (min.y+0.5);
- geometry.width=(unsigned long) ((long) (max.x+0.5)-(long) (min.x+0.5));
- geometry.height=(unsigned long) ((long) (max.y+0.5)-(long) (min.y+0.5));
+ geometry.x=(long) ceil(min.x-0.5);
+ geometry.y=(long) ceil(min.y-0.5);
+ geometry.width=(unsigned long) floor(max.x-min.x+0.5);
+ geometry.height=(unsigned long) floor(max.y-min.y+0.5);
page=(*image)->page;
(void) ParseAbsoluteGeometry("0x0+0+0",&(*image)->page);
crop_image=CropImage(*image,&geometry,exception);
width=image->rows;
height=image->columns;
}
- y_width=width+(long) (fabs(shear.x)*height+0.5);
- x_offset=(long) (width+((fabs(shear.y)*height)-width)/2.0+0.5);
- y_offset=(long) (height+((fabs(shear.y)*y_width)-height)/2.0+0.5);
+ y_width=width+(long) floor(fabs(shear.x)*height+0.5);
+ x_offset=(long) ceil(width+((fabs(shear.y)*height)-width)/2.0-0.5);
+ y_offset=(long) ceil(height+((fabs(shear.y)*y_width)-height)/2.0-0.5);
/*
Surround image with a border.
*/
/*
Compute image size.
*/
- y_width=image->columns+(long) (fabs(shear.x)*image->rows+0.5);
- x_offset=(long) (image->columns+((fabs(shear.x)*image->rows)-image->columns)/
- 2.0+0.5);
- y_offset=(long) (image->rows+((fabs(shear.y)*y_width)-image->rows)/2.0+0.5);
+ y_width=image->columns+(long) floor(fabs(shear.x)*image->rows+0.5);
+ x_offset=(long) ceil(image->columns+((fabs(shear.x)*image->rows)-
+ image->columns)/2.0-0.5);
+ y_offset=(long) ceil(image->rows+((fabs(shear.y)*y_width)-image->rows)/2.0-
+ 0.5);
/*
Surround image with border.
*/
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
status=GetImageChannelRange(image,channel,&min,&max,exception);
- *minima=(unsigned long) (min+0.5);
- *maxima=(unsigned long) (max+0.5);
+ *minima=(unsigned long) ceil(min-0.5);
+ *maxima=(unsigned long) floor(max+0.5);
return(status);
}
\f
wand->pattern_id=AcquireString(pattern_id);
wand->pattern_bounds.x=(long) ceil(x-0.5);
wand->pattern_bounds.y=(long) ceil(y-0.5);
- wand->pattern_bounds.width=(unsigned long) (width+0.5);
- wand->pattern_bounds.height=(unsigned long) (height+0.5);
+ wand->pattern_bounds.width=(unsigned long) floor(width+0.5);
+ wand->pattern_bounds.height=(unsigned long) floor(height+0.5);
wand->pattern_offset=wand->mvg_length;
return(MagickTrue);
}
if ((flags & PsiValue) == 0)
geometry_info.psi=4.0;
shadow_image=ShadowImage(*image,geometry_info.rho,
- geometry_info.sigma,(long) (geometry_info.xi+0.5),(long)
- (geometry_info.psi+0.5),exception);
+ geometry_info.sigma,(long) floor(geometry_info.xi+0.5),(long)
+ floor(geometry_info.psi+0.5),exception);
if (shadow_image == (Image *) NULL)
break;
*image=DestroyImage(*image);
if ((flags & PsiValue) == 0)
geometry_info.psi=0.1*(*image)->rows;
vignette_image=VignetteImage(*image,geometry_info.rho,
- geometry_info.sigma,(long) (geometry_info.xi+0.5),(long)
- (geometry_info.psi+0.5),exception);
+ geometry_info.sigma,(long) floor(geometry_info.xi+0.5),(long)
+ floor(geometry_info.psi+0.5),exception);
if (vignette_image == (Image *) NULL)
break;
*image=DestroyImage(*image);
{
if (LocaleCompare("write",option+1) == 0)
{
+ char
+ key[MaxTextExtent];
+
Image
*write_images;
*write_info;
(void) SyncImagesSettings(image_info,*images);
+ (void) FormatMagickString(key,MaxTextExtent,"cache:%s",argv[i+1]);
+ (void) DeleteImageRegistry(key);
write_images=(*images);
if (*option == '+')
write_images=CloneImageList(*images,exception);