image opacity is affected by the previous alpha
Closed this issue · 2 comments
yagshi commented
Placing images by content() function seems to be affected by the previous fill color's alpha.
Is this a bug?
Here's the example code.
#import "@preview/cetz:0.2.2"
#cetz.canvas({
import cetz.draw: *
content((0, 0), image("rect.svg"))
line((), (), fill: rgb("#00000020")) // <-- alpha is set to #20
content((0, -5), image("rect.svg")) // the same image as above
})
The "rect.svg" for the above code is something like this.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg">
<rect width="100" height="100" />
</svg>
fenjalien commented
This looks like a pdf export bug caused by Typst not CeTZ. It doesn't appear to happen when rendering as a png or svg, only with pdf export. Please open an issue in the Typst repository: https://github.com/typst/typst/
I can also reproduce it without CeTZ:
#image("rect.svg")
#path((0pt, 0pt), fill: rgb("#00000020"))
#image("rect.svg")
yagshi commented
Oh, I see. Thank you and apologize for my misunderstanding!