|
|
Hello, You should use Bezier curve to achieve this Code:foreach (var point in AnnotDrawing.GetCirclePoints(rect, lineWidth))
path.Path.Add(point);
Code:/// <summary>
/// Get points for a circle
/// </summary>
/// <param name="rect">Rectangle in which the figure should be inscribed.</param>
/// <param name="lineWidth">The line width.</param>
/// <returns>A Collection of points of this figure.</returns>
public static List<FS_PATHPOINTF> GetCirclePoints(FS_RECTF rect, float lineWidth)
{
rect = InflateRect(rect, -lineWidth / 2);
var ret = new List<FS_PATHPOINTF>();
float x = rect.left + rect.Width / 2;
float y = rect.bottom + rect.Height / 2;
float w = rect.Width;
float h = rect.Height;
var width_over_2 = w / 2;
var width_two_thirds = w * 2 / 3;
var height_over_2 = h / 2;
ret.Add(new FS_PATHPOINTF(x, y + height_over_2, PathPointFlags.MoveTo));
ret.Add(new FS_PATHPOINTF(x + width_two_thirds, y + height_over_2, PathPointFlags.BezierTo));
ret.Add(new FS_PATHPOINTF(x + width_two_thirds, y - height_over_2, PathPointFlags.BezierTo));
ret.Add(new FS_PATHPOINTF(x, y - height_over_2, PathPointFlags.BezierTo));
ret.Add(new FS_PATHPOINTF(x - width_two_thirds, y - height_over_2, PathPointFlags.BezierTo));
ret.Add(new FS_PATHPOINTF(x - width_two_thirds, y + height_over_2, PathPointFlags.BezierTo));
ret.Add(new FS_PATHPOINTF(x, y + height_over_2, PathPointFlags.BezierTo | PathPointFlags.CloseFigure));
return ret;
}
|
|
|
Hello, i have seen how i can add lines and rectangles to the pageobjects. But how can i add rounded shapes like elypse etc. my way to add a line : Code:
/// <summary>erzeugt ein PathObjekt mit einer Linie</summary>
/// ''' <param name="x1">X-Koordinate im PDF (von links)</param>
/// ''' <param name="y1">Y-Koordinate im PDF (von unten)</param>
/// ''' <param name="x2">y-Koordinate im PDF (von links)</param>
/// ''' <param name="y2">Y-Koordinate im PDF (von unten)</param>
/// ''' <param name="fillFS_COLOR">Patagames.Pdf.FS_COLOR (Farbe)</param>
/// ''' <returns>Patagames.Pdf.Net.PdfPathObject</returns>
public Patagames.Pdf.Net.PdfPathObject InsertLine(float x1, float y1, float x2, float y2, Patagames.Pdf.FS_COLOR fillFS_COLOR)
{
Patagames.Pdf.Net.PdfPathObject pathObject = Patagames.Pdf.Net.PdfPathObject.Create(Patagames.Pdf.Enums.FillModes.Alternate, false);
pathObject.FillColor = fillFS_COLOR;
pathObject.Path.Add(new Patagames.Pdf.FS_PATHPOINTF(x1, y1, Patagames.Pdf.Enums.PathPointFlags.MoveTo));
pathObject.Path.Add(new Patagames.Pdf.FS_PATHPOINTF(x2, y2, Patagames.Pdf.Enums.PathPointFlags.LineTo));
pathObject.Path.Add(new Patagames.Pdf.FS_PATHPOINTF(x1, y1, Patagames.Pdf.Enums.PathPointFlags.CloseFigure | Patagames.Pdf.Enums.PathPointFlags.LineTo));
return pathObject;
}
Christian
|
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close