qt: use signed distance field based anti aliasing for triangle
We have already started using distance field for images in !6389 (merged).
Currently, we don't have an item to draw a triangle. We could use custom geometry, or Qt Quick Shape, but that requires MSAA or having custom AA built in the geometry (Qt seems to call it "vertex AA" https://doc.qt.io/qt-6/qtquick-visualcanvas-scenegraph-renderer.html#antialiasing). It seems that the new Qt Curve Renderer provides AA without MSAA, and we can use it with Shape
, but I'm not sure how much it makes sense for a simple triangle as we currently do not use it. And the Curve Renderer is only available with recent Qt versions.
We also currently do not import Qt Quick Shapes, and we should not import it only for triangle. I'm not against importing it though.
I again referred to Inigo Quilez's distance function collection: https://iquilezles.org/articles/distfunctions2d.
If you are wondering how we are drawing a triangle now, it is done by drawing a rectangle rotating it by 45 degrees and clipping it. Clipping is not good, so this way we eliminate that. Since rectangle has AA when rotated, it has not been a problem visually.
The disadvantage of doing this is that we no longer have triangle with non-RHI scene graph adaptations, in other words, any renderer that does not support RHI shaders. I think it is fine to not show triangle if software or openvg renderer is used, so I did not use a loader there.
Request review @chub.
Close #28022.