Closed tuzhong007 closed 1 year ago
The following code draws a cubic Bezier curve from (0, 100) to (150, 100) whose control points are (50, 50) and (150, 100). In addition, the control points are connected by line strips.
skity::Paint paint; paint.setAntiAlias(true); paint.setStyle(skity::Paint::kStroke_Style); skity::Point cubicPts[] = { {0, 100, 0, 1}, {50, 50, 0, 1}, {100, 150, 0, 1}, {150, 100, 0, 1}}; skity::Color color = 0xff88ff00; paint.setColor(0x7fffffff & color); paint.setStrokeWidth(1); for (unsigned j = 0; j < 3; ++j) { // canvas->drawLine(cubicPts[j], cubicPts[j + 1], paint); //. canvas->drawLine(cubicPts[j].x, cubicPts[j].y, cubicPts[j + 1].x,cubicPts[j + 1].y, paint); } skity::Path path; path.moveTo(cubicPts[0]); path.cubicTo(cubicPts[1], cubicPts[2], cubicPts[3]); paint.setStrokeWidth(3); paint.setColor(color); canvas->drawPath(path, paint);
But the result of cubic curve is a horizontal line segment:
Thanks for reporting this. I checked this code in my local project, and is fixed. I will push this patch in this weekend.
The following code draws a cubic Bezier curve from (0, 100) to (150, 100) whose control points are (50, 50) and (150, 100). In addition, the control points are connected by line strips.
But the result of cubic curve is a horizontal line segment: