跳到主要内容

QuadBezTo

Draws a quadratic Bezier curve from the current point to the specified end point using a control point.

Syntax

expression.QuadBezTo(x1, y1, x2, y2);

expression - A variable that represents a ApiPath class.

Parameters

NameRequired/OptionalData typeDefaultDescription
x1RequiredGeometryCoordinateThe X coordinate of the control point.
y1RequiredGeometryCoordinateThe Y coordinate of the control point.
x2RequiredGeometryCoordinateThe X coordinate of the end point.
y2RequiredGeometryCoordinateThe Y coordinate of the end point.

Returns

This method doesn't return any data.

Example

Creates a complex curve using cubic bezier, quadratic bezier and arc commands.

// Demonstrates different types of curve drawing methods.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let customGeometry = Api.CreateCustomGeometry();
let path = customGeometry.AddPath();
path.SetWidth(100 * 36000);
path.SetHeight(100 * 36000);
path.MoveTo(0, 50 * 36000);
path.CubicBezTo(0, 0, 50 * 36000, 0, 50 * 36000, 50 * 36000);
path.QuadBezTo(100 * 36000, 50 * 36000, 100 * 36000, 100 * 36000);
path.ArcTo(50 * 36000, 50 * 36000, 0, 10800000);
path.Close();
let fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 200, 100));
let stroke = Api.CreateStroke(36000, Api.CreateSolidFill(Api.CreateRGBColor(200, 100, 0)));
let shape = Api.CreateShape("rect", 100 * 36000, 100 * 36000, fill, stroke);
shape.SetGeometry(customGeometry);
paragraph.AddDrawing(shape);