bezierCurveTo incorrect path when performing stroke
See original GitHub issueExpected Behaviour
Draw an oval
1.
Actual Behaviour
draws a “flower”
1.
Steps To Reproduce
points = [
246, 338, 246, 382,
246, 414, 300, 414,
366, 414, 366, 371,
366, 338, 327, 338
];
ctx.strokeColor = '#000';
ctx.beginPath();
ctx.moveTo(points[i].p[14], points[i].p[15]); //each bezierCurve strangely centers back to the start point moveTo!
ctx.bezierCurveTo(points[i].p[14], points[i].p[15],points[i].p[0], points[i].p[1], points[i].p[2], points[i].p[3]);
ctx.bezierCurveTo(points[i].p[2], points[i].p[3],points[i].p[4], points[i].p[5], points[i].p[6], points[i].p[7]);
ctx.bezierCurveTo(points[i].p[6], points[i].p[7],points[i].p[8], points[i].p[9], points[i].p[10], points[i].p[11]);
ctx.bezierCurveTo(points[i].p[10], points[i].p[11],points[i].p[12], points[i].p[13], points[i].p[14], points[i].p[15]);
ctx.stroke();
// if one uses ctx.fill() instead this will be an oval though
Platform
OS: windows 11 Node Version: 17.0.1 NPM Version: latest PureImage Version: latest
Any Additional Info
similar behavior for ctx.quadraticCurveTo but this mostly not strokes at all.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
CanvasRenderingContext2D.bezierCurveTo() - Web APIs | MDN
The CanvasRenderingContext2D.bezierCurveTo() method of the Canvas 2D API adds a cubic Bézier curve to the current sub-path.
Read more >Bezier path stroking performance issues - Stack Overflow
Running the time profiling tool in Instruments it tells me my app is spending 93.5% of the time doing the last line [path...
Read more >Paths — SVG 2
A path is defined by including a 'path' element on which the d property specifies the path data. The path data contains the...
Read more >Parametrized stroke outlining / expanding / offsetting #371
I've been eagerly interested in the functionality to expand strokes into paths, particularly for bezier curves (where I know the problem is ...
Read more >Stroke width control points disappearing - Beyond the Basics
I add a power stroke path effect ... Does anyone know what I'm doing wrong? ... Draw a curve with Bèzier tool (no...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think I figured it out. The flatten_path is supposed to update the ‘curr’ variable in every segment of the path, but it wasn’t doing so for the Bezier curves. Can you test if the change above fixes it for you? Up can just add the one line above in the diff.
Oops. I forgot to npm build before publishing. Fixed. Look for 0.3.8