Merge pull request #20063 from calixteman/issue20062
Fix the default appearance of a Polygon annotation when a fill color is provided
This commit is contained in:
commit
481b74a1c2
@ -4337,6 +4337,24 @@ class PolylineAnnotation extends MarkupAnnotation {
|
|||||||
const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
|
const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
|
||||||
const strokeAlpha = dict.get("CA");
|
const strokeAlpha = dict.get("CA");
|
||||||
|
|
||||||
|
let fillColor = getRgbColor(dict.getArray("IC"), null);
|
||||||
|
if (fillColor) {
|
||||||
|
fillColor = getPdfColorArray(fillColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
let operator;
|
||||||
|
if (fillColor) {
|
||||||
|
if (this.color) {
|
||||||
|
operator = fillColor.every((c, i) => c === strokeColor[i])
|
||||||
|
? "f"
|
||||||
|
: "B";
|
||||||
|
} else {
|
||||||
|
operator = "f";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
operator = "S";
|
||||||
|
}
|
||||||
|
|
||||||
const borderWidth = this.borderStyle.width || 1,
|
const borderWidth = this.borderStyle.width || 1,
|
||||||
borderAdjust = 2 * borderWidth;
|
borderAdjust = 2 * borderWidth;
|
||||||
|
|
||||||
@ -4361,13 +4379,15 @@ class PolylineAnnotation extends MarkupAnnotation {
|
|||||||
extra: `${borderWidth} w`,
|
extra: `${borderWidth} w`,
|
||||||
strokeColor,
|
strokeColor,
|
||||||
strokeAlpha,
|
strokeAlpha,
|
||||||
|
fillColor,
|
||||||
|
fillAlpha: fillColor ? strokeAlpha : null,
|
||||||
pointsCallback: (buffer, points) => {
|
pointsCallback: (buffer, points) => {
|
||||||
for (let i = 0, ii = vertices.length; i < ii; i += 2) {
|
for (let i = 0, ii = vertices.length; i < ii; i += 2) {
|
||||||
buffer.push(
|
buffer.push(
|
||||||
`${vertices[i]} ${vertices[i + 1]} ${i === 0 ? "m" : "l"}`
|
`${vertices[i]} ${vertices[i + 1]} ${i === 0 ? "m" : "l"}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
buffer.push("S");
|
buffer.push(operator);
|
||||||
return [points[0], points[7], points[2], points[3]];
|
return [points[0], points[7], points[2], points[3]];
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -731,3 +731,4 @@
|
|||||||
!bug1885505.pdf
|
!bug1885505.pdf
|
||||||
!bug1974436.pdf
|
!bug1974436.pdf
|
||||||
!firefox_logo.pdf
|
!firefox_logo.pdf
|
||||||
|
!issue20062.pdf
|
||||||
|
|||||||
BIN
test/pdfs/issue20062.pdf
Executable file
BIN
test/pdfs/issue20062.pdf
Executable file
Binary file not shown.
@ -12164,5 +12164,12 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq",
|
"type": "eq",
|
||||||
"annotations": true
|
"annotations": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "issue20062",
|
||||||
|
"file": "pdfs/issue20062.pdf",
|
||||||
|
"md5": "9fa985242476c642464d94893528e40f",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user