Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Add Option to Disable Antialiasing

Open phailhaus opened this issue 6 months ago • 2 comments

An option to disable anti-aliasing would expand usefulness for specialized situations.

Example of usecase that is broken by AA: I've been working on a project that involves stroking paths with a series of circles that change color based on distance from the start of the path. I can then use a specialized shader in a raster pipeline to threshold the image, giving a hand-drawn line that can be 'drawn' in real time with extremely light loads on both CPU and GPU. To do this, I need every pixel of a circle to be either 100% the desired color or entirely transparent. Anything inbetween results in artifacts.

My current workflow involves copying paths out of an SVG into a python script to generate these stroked textures, but Graphite provides a very enticing alternative.

phailhaus avatar Jun 28 '25 00:06 phailhaus

I believe this could be added to the AlphaBlending struct and set by a node. Clipping masks and even just the simple case of opacity work in a similar way and could be referenced. I'll add this to the backlog and open it up for contribution.

For SVG rendering, this becomes the shape-rendering attribute. For Vello rendering, I haven't checked the documentation yet.

Keavon avatar Jun 28 '25 01:06 Keavon

Unfortunately vello only allows for setting the anti aliasing for the entire render.

https://github.com/linebender/vello_svg/blob/43fe2d2d823890a7def1f81c9350b656d95588ae/src/lib.rs#L23

0HyperCube avatar Jun 28 '25 10:06 0HyperCube