Merge pull request #12591 from Snuffleupagus/strokeColor-Pattern
Improve the Pattern-detection in `CanvasGraphics.stroke`
This commit is contained in:
commit
e3851a6765
@ -1350,11 +1350,7 @@ const CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
// stroking alpha.
|
// stroking alpha.
|
||||||
ctx.globalAlpha = this.current.strokeAlpha;
|
ctx.globalAlpha = this.current.strokeAlpha;
|
||||||
if (this.contentVisible) {
|
if (this.contentVisible) {
|
||||||
if (
|
if (typeof strokeColor === "object" && strokeColor?.getPattern) {
|
||||||
strokeColor &&
|
|
||||||
strokeColor.hasOwnProperty("type") &&
|
|
||||||
strokeColor.type === "Pattern"
|
|
||||||
) {
|
|
||||||
// for patterns, we transform to pattern space, calculate
|
// for patterns, we transform to pattern space, calculate
|
||||||
// the pattern, call stroke, and restore to user space
|
// the pattern, call stroke, and restore to user space
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
@ -38,7 +38,6 @@ ShadingIRs.RadialAxial = {
|
|||||||
const r0 = raw[6];
|
const r0 = raw[6];
|
||||||
const r1 = raw[7];
|
const r1 = raw[7];
|
||||||
return {
|
return {
|
||||||
type: "Pattern",
|
|
||||||
getPattern: function RadialAxial_getPattern(ctx) {
|
getPattern: function RadialAxial_getPattern(ctx) {
|
||||||
applyBoundingBox(ctx, bbox);
|
applyBoundingBox(ctx, bbox);
|
||||||
let grad;
|
let grad;
|
||||||
@ -340,7 +339,6 @@ ShadingIRs.Mesh = {
|
|||||||
const bbox = raw[7];
|
const bbox = raw[7];
|
||||||
const background = raw[8];
|
const background = raw[8];
|
||||||
return {
|
return {
|
||||||
type: "Pattern",
|
|
||||||
getPattern: function Mesh_getPattern(ctx, owner, shadingFill) {
|
getPattern: function Mesh_getPattern(ctx, owner, shadingFill) {
|
||||||
applyBoundingBox(ctx, bbox);
|
applyBoundingBox(ctx, bbox);
|
||||||
let scale;
|
let scale;
|
||||||
@ -390,7 +388,6 @@ ShadingIRs.Mesh = {
|
|||||||
ShadingIRs.Dummy = {
|
ShadingIRs.Dummy = {
|
||||||
fromIR: function Dummy_fromIR() {
|
fromIR: function Dummy_fromIR() {
|
||||||
return {
|
return {
|
||||||
type: "Pattern",
|
|
||||||
getPattern: function Dummy_fromIR_getPattern() {
|
getPattern: function Dummy_fromIR_getPattern() {
|
||||||
return "hotpink";
|
return "hotpink";
|
||||||
},
|
},
|
||||||
@ -429,7 +426,6 @@ const TilingPattern = (function TilingPatternClosure() {
|
|||||||
this.color = color;
|
this.color = color;
|
||||||
this.canvasGraphicsFactory = canvasGraphicsFactory;
|
this.canvasGraphicsFactory = canvasGraphicsFactory;
|
||||||
this.baseTransform = baseTransform;
|
this.baseTransform = baseTransform;
|
||||||
this.type = "Pattern";
|
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user