Hi
the Graphics path points array will return only the optimized/generalized points in the path.
Where as you can generate your own points using the ellipse drawing points as below.
startX and startY are the centre point of the ellipse
double minorAxisWidth = 50;
double majorAxisWidth = 100;
double endX;
double endY;
double endX1;
double endY1;
double startX = 100;
double startY = 100;
GraphicsPath path = new GraphicsPath();
for (int j = 0; j < 360; j++)
{
endX = startX + minorAxisWidth * Math.Cos(deg2rad(j-1));
endY = startY + majorAxisWidth * Math.Sin(deg2rad(j-1));
endX1 = startX + minorAxisWidth * Math.Cos(deg2rad(j ));
endY1 = startY + majorAxisWidth * Math.Sin(deg2rad(j));
path.AddLine((int)endX, (int)endY, (int)endX1, (int)endY1);
}
e.Graphics.DrawPath(Pens.Black, path);
In the above code I just used the graphics path to demonstrate how the ellipse in the display. But not necessary of a graphics path here. You will be getting 360 point pairs (endX,endY).
double minorAxisWidth = 50;
double majorAxisWidth = 100;
double endX;
double endY;
double endX1;
double endY1;
double startX = 100;
double startY = 100;
PointF[] points = new PointF[360];
for (int j = 0; j < 360; j++)
{
endX = startX + minorAxisWidth * Math.Cos(deg2rad(j));
endY = startY + majorAxisWidth * Math.Sin(deg2rad(j));
points[j] = new PointF((float)endX, (float)endY);
}
So you got 360 pixel coordinates. Using the
getPixel()
method on the Bitmap/ image you can get the pixels at the ellipse periphery.
The functions for converting Degree to Radian and vice versa
private double deg2rad(double deg)
{
return Math.PI * deg / 180;
}
private double rad2deg(double rad)
{
return rad * (180 / Math.PI);
}