GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / AddCurveToPath2 Method
The horizontal (X) coordinate of the second Bézier control point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
The vertical (Y) coordinate of the second Bézier control point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
The horizontal (X) coordinate of the curve's end point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
The vertical (Y) coordinate of the curve's end point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
Example





In This Topic
AddCurveToPath2 Method (GdPicturePDF)
In This Topic
Appends a cubic Bézier curve, using two control points, to the current path, defined within a currently selected page of the loaded PDF document. More precisely, this method sets the path construction operator "v". The curve expands the current path from the current point to the end-point (X3, Y3), using the current point and (X2, Y2) as the Bézier control points. Be aware of your currently defined graphics state parameters, that subsequent filling and stroking operations applied onto the constructed path put into effect.

All specified coordinates need to be set in the current units defined in the PDF document with respect to the currently located origin, related to the actual page. You can use the GdPicturePDF.GetMeasurementUnit method to determine the currently defined units and you can use the GdPicturePDF.SetMeasurementUnit method to reset the units according to your preference.

Syntax
'Declaration
 
Public Function AddCurveToPath2( _
   ByVal X2 As Single, _
   ByVal Y2 As Single, _
   ByVal X3 As Single, _
   ByVal Y3 As Single _
) As GdPictureStatus
public GdPictureStatus AddCurveToPath2( 
   float X2,
   float Y2,
   float X3,
   float Y3
)
public function AddCurveToPath2( 
    X2: Single;
    Y2: Single;
    X3: Single;
    Y3: Single
): GdPictureStatus; 
public function AddCurveToPath2( 
   X2 : float,
   Y2 : float,
   X3 : float,
   Y3 : float
) : GdPictureStatus;
public: GdPictureStatus AddCurveToPath2( 
   float X2,
   float Y2,
   float X3,
   float Y3
) 
public:
GdPictureStatus AddCurveToPath2( 
   float X2,
   float Y2,
   float X3,
   float Y3
) 

Parameters

X2
The horizontal (X) coordinate of the second Bézier control point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
Y2
The vertical (Y) coordinate of the second Bézier control point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
X3
The horizontal (X) coordinate of the curve's end point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
Y3
The vertical (Y) coordinate of the curve's end point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.

Just to remind you that the new current point in the constructed subpath is (X3, Y3).

For further assistance, please see the Path Construction and Painting section of the GdPicturePDF class in the Reference Guide, as well as the Cubic Bézier Curves section in the PDF Reference.

Example
How to add a cubic Bézier curve to the current path.
Dim caption As String = "Example: AddCurveToPath2"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.NewPDF()
If status = GdPictureStatus.OK Then
    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
    If (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.SetFillColor(128, 128, 0) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.BeginPath(50, 20) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.AddCurveToPath1(10, 500, 200, 400) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.FillPath() = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.BeginPath(550, 20) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.AddCurveToPath2(510, 500, 300, 400) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.FillPath() = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.BeginPath(50, 750) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.AddCurveToPath3(10, 550, 300, 480, 500, 600) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.FillPath() = GdPictureStatus.OK) Then
        status = gdpicturePDF.SaveToFile("test_AddCurveToPath2.pdf")
        If status = GdPictureStatus.OK Then
            MessageBox.Show("The example has been followed successfully and the file has been saved.", caption)
        Else
            MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption)
        End If
    Else
        MessageBox.Show("The example has not been followed successfully." + vbCrLf + "The last known status is " + gdpicturePDF.GetStat().ToString(), caption)
    End If
Else
    MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: AddCurveToPath2";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.NewPDF();
if (status == GdPictureStatus.OK)
{
    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
    if ((gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK) &&
        (gdpicturePDF.SetFillColor(128, 128, 0) == GdPictureStatus.OK) &&
        (gdpicturePDF.BeginPath(50, 20) == GdPictureStatus.OK) &&
        (gdpicturePDF.AddCurveToPath1(10, 500, 200, 400) == GdPictureStatus.OK) &&
        (gdpicturePDF.FillPath() == GdPictureStatus.OK) &&
        (gdpicturePDF.BeginPath(550, 20) == GdPictureStatus.OK) &&
        (gdpicturePDF.AddCurveToPath2(510, 500, 300, 400) == GdPictureStatus.OK) &&
        (gdpicturePDF.FillPath() == GdPictureStatus.OK) &&
        (gdpicturePDF.BeginPath(50, 750) == GdPictureStatus.OK) &&
        (gdpicturePDF.AddCurveToPath3(10, 550, 300, 480, 500, 600) == GdPictureStatus.OK) &&
        (gdpicturePDF.FillPath() == GdPictureStatus.OK))
    {
        status = gdpicturePDF.SaveToFile("test_AddCurveToPath2.pdf");
        if (status == GdPictureStatus.OK)
            MessageBox.Show("The example has been followed successfully and the file has been saved.", caption);
        else
            MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption);
    }
    else
        MessageBox.Show("The example has not been followed successfully.\nThe last known status is " + gdpicturePDF.GetStat().ToString(), caption);
}
else
    MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption);
gdpicturePDF.Dispose();
See Also