Skip to content

Commit bfc8a23

Browse files
committed
Stub (incomplete) implementations for quadraticCurveTo and bezierCurveTo
1 parent 81720bd commit bfc8a23

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

jspdf.plugin.context2d.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,30 @@
329329
this.path.push(obj);
330330
},
331331

332+
bezierCurveTo : function(x1, y1, x2, y2, x, y) {
333+
console.log('bezierCurveTo not implemented');
334+
x = this._wrapX(x);
335+
y = this._wrapY(y);
336+
var obj = {
337+
type : 'lt',
338+
x : x,
339+
y : y
340+
};
341+
this.path.push(obj);
342+
},
343+
344+
quadradicCurveTo : function(x1, y1, x, y) {
345+
console.log('quadradicCurveTo not implemented');
346+
x = this._wrapX(x);
347+
y = this._wrapY(y);
348+
var obj = {
349+
type : 'lt',
350+
x : x,
351+
y : y
352+
};
353+
this.path.push(obj);
354+
},
355+
332356
arc : function(x,y,radius,startAngle,endAngle,anticlockwise) {
333357
x = this._wrapX(x);
334358
y = this._wrapY(y);

test/test_context2d.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,20 @@
341341

342342
ctx.restore();
343343

344+
//
345+
346+
ctx.fillText("Testing bezierCurveTo", 20, y + textHeight);
347+
y += textHeight + pad;
348+
349+
ctx.save();
350+
ctx.lineWidth = 6;
351+
ctx.strokeStyle = "#333";
352+
ctx.beginPath();
353+
ctx.moveTo(100, y);
354+
ctx.bezierCurveTo(150, 100, 350, 100, 400, y);
355+
ctx.stroke();
356+
ctx.restore();
357+
344358

345359
pdf.addPage();
346360
y=0;

0 commit comments

Comments
 (0)