ImageRenderer rounds points coordinates to integer values

I try to convert view to vector graphic (PDF) using ImageRenderer. But output image has ALL coordinates rounded to integer values, which is not OK - some very small circles become elipses, squares are no longer squares, very detailed or small shapes are distorted by rounding coordinates. Is a some option to switch off rounding?

Answered by ludzik in 813373022

Instead of using GeometryReader and SwiftUI structs for dot shape, I used Canvas and draw paths into its context

Those circles are defined in brown noise random positions and sizes, but generated PDF has visible grid, many circles are became elipses. Smallest circle in picture has size 1pt x 1pt.

Accepted Answer

Instead of using GeometryReader and SwiftUI structs for dot shape, I used Canvas and draw paths into its context

I know you've answered this, but it would help others in future who might come across this post, for you to post your original non-working code, and the fixed code that works.

ImageRenderer rounds points coordinates to integer values
 
 
Q