Implement j (line join style)
This commit is contained in:
parent
5bf0818b2e
commit
f9839beda8
35
pdf.js
35
pdf.js
@ -1001,6 +1001,7 @@ var Interpreter = (function() {
|
|||||||
// Graphics state
|
// Graphics state
|
||||||
w: gfx.setLineWidth,
|
w: gfx.setLineWidth,
|
||||||
J: gfx.setLineCap,
|
J: gfx.setLineCap,
|
||||||
|
j: gfx.setLineJoin,
|
||||||
d: gfx.setDash,
|
d: gfx.setDash,
|
||||||
q: gfx.save,
|
q: gfx.save,
|
||||||
Q: gfx.restore,
|
Q: gfx.restore,
|
||||||
@ -1109,6 +1110,9 @@ var EchoGraphics = (function() {
|
|||||||
setLineCap: function(style) {
|
setLineCap: function(style) {
|
||||||
this.printdentln(style +" J");
|
this.printdentln(style +" J");
|
||||||
},
|
},
|
||||||
|
setLineJoin: function(style) {
|
||||||
|
this.printdentln(style +" j");
|
||||||
|
},
|
||||||
setDash: function(dashArray, dashPhase) {
|
setDash: function(dashArray, dashPhase) {
|
||||||
this.printdentln(""+ dashArray +" "+ dashPhase +" d");
|
this.printdentln(""+ dashArray +" "+ dashPhase +" d");
|
||||||
},
|
},
|
||||||
@ -1247,6 +1251,7 @@ var CanvasGraphics = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var LINE_CAP_STYLES = [ "butt", "round", "square" ];
|
var LINE_CAP_STYLES = [ "butt", "round", "square" ];
|
||||||
|
var LINE_JOIN_STYLES = [ "miter", "round", "bevel" ];
|
||||||
|
|
||||||
constructor.prototype = {
|
constructor.prototype = {
|
||||||
beginDrawing: function(mediaBox) {
|
beginDrawing: function(mediaBox) {
|
||||||
@ -1266,6 +1271,9 @@ var CanvasGraphics = (function() {
|
|||||||
setLineCap: function(style) {
|
setLineCap: function(style) {
|
||||||
this.ctx.lineCap = LINE_CAP_STYLES[style];
|
this.ctx.lineCap = LINE_CAP_STYLES[style];
|
||||||
},
|
},
|
||||||
|
setLineJoin: function(style) {
|
||||||
|
this.ctx.lineJoin = LINE_JOIN_STYLES[style];
|
||||||
|
},
|
||||||
setDash: function(dashArray, dashPhase) {
|
setDash: function(dashArray, dashPhase) {
|
||||||
// TODO
|
// TODO
|
||||||
},
|
},
|
||||||
@ -1541,6 +1549,33 @@ var tests = [
|
|||||||
int(200), int(680), cmd("l"),
|
int(200), int(680), cmd("l"),
|
||||||
cmd("S"),
|
cmd("S"),
|
||||||
|
|
||||||
|
eof()
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ name: "Line join",
|
||||||
|
res: { },
|
||||||
|
mediaBox: [ 0, 0, 612, 792 ],
|
||||||
|
objs: [
|
||||||
|
int(20), cmd("w"),
|
||||||
|
|
||||||
|
int(0), cmd("j"), // miter join
|
||||||
|
int(100), int(692), cmd("m"),
|
||||||
|
int(150), int(642), cmd("l"),
|
||||||
|
int(200), int(692), cmd("l"),
|
||||||
|
cmd("S"),
|
||||||
|
|
||||||
|
int(1), cmd("j"), // round join
|
||||||
|
int(250), int(692), cmd("m"),
|
||||||
|
int(300), int(642), cmd("l"),
|
||||||
|
int(350), int(692), cmd("l"),
|
||||||
|
cmd("S"),
|
||||||
|
|
||||||
|
int(2), cmd("j"), // bevel join
|
||||||
|
int(400), int(692), cmd("m"),
|
||||||
|
int(450), int(642), cmd("l"),
|
||||||
|
int(500), int(692), cmd("l"),
|
||||||
|
cmd("S"),
|
||||||
|
|
||||||
eof()
|
eof()
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user