Why do PDFs resized in SwiftUI getting sharp edges?

前端 未结 2 1147
夕颜
夕颜 2021-01-03 04:15

I try to include a pdf in my SwiftUI enabled app using Xcode 11.4 and iOS 13.4. However, when I resize the pdf, it gets crips edges. I have included two versions of the pdf:

2条回答
  •  隐瞒了意图╮
    2021-01-03 04:50

    There are essentially no differences between the two PDF files, other than the fact that in one case the co-ordinates of the content are scaled by a factor of ~14.2.

    I would guess th difference is not in the PDF files, but in the rendering engine you are using to draw the contents. Note that the PDF file uses transparency (it has a constant alpha of 0.4) so the blending calculations might lead to slightly different results at the edges.

    Looking at the two files in Adobe Acrobat, scaled to be the same size on screen, there is no visible difference between them.

    Zooming in to your PNG file I see that icon_small.pdf has anti-aliased edges, while icon.pdf does not. You don't say what you are using to render the PDF files to a PNG but I think you're going to have to discuss it with the authors of whatever tool that is.

提交回复
热议问题