}
static size_t ReckonEllipseCoordinates(const PointInfo radii,
- const PointInfo degrees)
+ const PointInfo arc)
{
double
delta,
step=MagickPI/8.0;
if ((delta >= 0.0) && (delta < (MagickPI/8.0)))
step=MagickPI/(4.0*(MagickPI*PerceptibleReciprocal(delta)/2.0));
- angle.x=DegreesToRadians(degrees.x);
- y=degrees.y;
- while (y < degrees.x)
+ angle.x=DegreesToRadians(arc.x);
+ y=arc.y;
+ while (y < arc.x)
y+=360.0;
angle.y=DegreesToRadians(y);
return((size_t) floor((angle.y-angle.x)/step+0.5)+3);
status=MagickFalse;
break;
}
+ if ((primitive_info[j+1].point.x-primitive_info[j].point.x) < 0.0)
+ {
+ status=MagickFalse;
+ break;
+ }
+ if ((primitive_info[j+1].point.y-primitive_info[j].point.y) < 0.0)
+ {
+ status=MagickFalse;
+ break;
+ }
TraceRectangle(primitive_info+j,primitive_info[j].point,
primitive_info[j+1].point);
i=(ssize_t) (j+primitive_info[j].coordinates);
status=MagickFalse;
break;
}
+ if ((primitive_info[j+2].point.x < 0.0) ||
+ (primitive_info[j+2].point.y < 0.0))
+ {
+ status=MagickFalse;
+ break;
+ }
+ if ((primitive_info[j+1].point.x-primitive_info[j].point.x) < 0.0)
+ {
+ status=MagickFalse;
+ break;
+ }
+ if ((primitive_info[j+1].point.y-primitive_info[j].point.y) < 0.0)
+ {
+ status=MagickFalse;
+ break;
+ }
TraceRoundRectangle(primitive_info+j,primitive_info[j].point,
primitive_info[j+1].point,primitive_info[j+2].point);
i=(ssize_t) (j+primitive_info[j].coordinates);
status=MagickFalse;
break;
}
+ if ((primitive_info[j+1].point.x < 0.0) ||
+ (primitive_info[j+1].point.y < 0.0))
+ {
+ status=MagickFalse;
+ break;
+ }
TraceEllipse(primitive_info+j,primitive_info[j].point,
primitive_info[j+1].point,primitive_info[j+2].point);
i=(ssize_t) (j+primitive_info[j].coordinates);
break;
}
case PolylinePrimitive:
+ {
+ if (primitive_info[j].coordinates < 1)
+ {
+ status=MagickFalse;
+ break;
+ }
break;
+ }
case PolygonPrimitive:
{
+ if (primitive_info[j].coordinates < 3)
+ {
+ status=MagickFalse;
+ break;
+ }
primitive_info[i]=primitive_info[j];
primitive_info[i].coordinates=0;
primitive_info[j].coordinates++;
{
PointInfo
center,
- radii;
+ radius;
center.x=0.5*(end.x+start.x);
center.y=0.5*(end.y+start.y);
- radii.x=fabs(center.x-start.x);
- radii.y=fabs(center.y-start.y);
- TraceEllipse(primitive_info,center,radii,degrees);
+ radius.x=fabs(center.x-start.x);
+ radius.y=fabs(center.y-start.y);
+ TraceEllipse(primitive_info,center,radius,degrees);
}
static void TraceArcPath(PrimitiveInfo *primitive_info,const PointInfo start,
TraceEllipse(primitive_info,start,offset,degrees);
}
-static void TraceEllipse(PrimitiveInfo *primitive_info,const PointInfo start,
- const PointInfo radii,const PointInfo degrees)
+static void TraceEllipse(PrimitiveInfo *primitive_info,const PointInfo center,
+ const PointInfo radii,const PointInfo arc)
{
double
delta,
step=MagickPI/8.0;
if ((delta >= 0.0) && (delta < (MagickPI/8.0)))
step=MagickPI/(4.0*(MagickPI*PerceptibleReciprocal(delta)/2.0));
- angle.x=DegreesToRadians(degrees.x);
- y=degrees.y;
- while (y < degrees.x)
+ angle.x=DegreesToRadians(arc.x);
+ y=arc.y;
+ while (y < arc.x)
y+=360.0;
angle.y=DegreesToRadians(y);
for (p=primitive_info; angle.x < angle.y; angle.x+=step)
{
- point.x=cos(fmod(angle.x,DegreesToRadians(360.0)))*radii.x+start.x;
- point.y=sin(fmod(angle.x,DegreesToRadians(360.0)))*radii.y+start.y;
+ point.x=cos(fmod(angle.x,DegreesToRadians(360.0)))*radii.x+center.x;
+ point.y=sin(fmod(angle.x,DegreesToRadians(360.0)))*radii.y+center.y;
TracePoint(p,point);
p+=p->coordinates;
}
- point.x=cos(fmod(angle.y,DegreesToRadians(360.0)))*radii.x+start.x;
- point.y=sin(fmod(angle.y,DegreesToRadians(360.0)))*radii.y+start.y;
+ point.x=cos(fmod(angle.y,DegreesToRadians(360.0)))*radii.x+center.x;
+ point.y=sin(fmod(angle.y,DegreesToRadians(360.0)))*radii.y+center.y;
TracePoint(p,point);
p+=p->coordinates;
primitive_info->coordinates=(size_t) (p-primitive_info);