logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Post a reply
From:
Message:

Maximum number of characters in each post is: 32767
Bold Italic Underline   Highlight Quote Choose Language for Syntax Highlighting Insert Image Insert an existing Attachment or upload a new File... Create Link   Unordered List Ordered List   Left Justify Center Justify Right Justify   Outdent Indent   More BBCode Tags
Font Color Font Size
Security Image:
Enter The Letters From The Security Image:
  Preview Post Cancel

Last 10 Posts (In reverse order)
Paul Rayman Posted: Wednesday, November 6, 2019 2:39:02 AM(UTC)
 
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;
}



Bazi Posted: Tuesday, November 5, 2019 10:31:49 AM(UTC)
 
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