AddCurveToPath2 Method (GdPicturePDF)
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.
public function AddCurveToPath2(
: Single;
: Single;
: Single;
: Single
): GdPictureStatus;
public function AddCurveToPath2(
: float,
: float,
: float,
: float
) : GdPictureStatus;
'Declaration
Public Function AddCurveToPath2( _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single _
) As GdPictureStatus
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.
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();