Turn off anti-alias on draw Slider's handle?

I’m making this custom Slider (with Handle) for control some plugins param:

001

But when I move the handle “a bit”, the draw start “smoothing” the border (anti aliasing filter I think), creating a sort of shadow around it:

002

Any way to disable anti aliasing? Or best practice for doing this kind of stuff?

Thanks

Rack uses a vector graphics renderer, not bitmap. There is no concept of pixels, just paths.

Which paths will “fills” some pixels, in the end…

I try to reformulate: wow would you “snap” (round) only to the nearest interger draw measure? Even better: how would you fix this?

When the OpenGL context is created, shaders that anti-alias are used and can not be swapped for other ones, even in separate framebuffers.

So the only solution is to “increase” the slider size? With zoom 150% this doesn’t happens…

Before talking about the solution, I’m not convinced this is a problem. If a 1px-wide path (with no local transformations) happens to land in the middle of a pixel grid cell, it will appear 1px wide. If it’s exactly between two cells, it will appear 2px wide. This is normal and expected for antialiased vector graphics, and nobody will complain.

Its simple crap to see. When I move the handle, I can clearly see the border being added on top/bottom of the handle. Only if I increase the zoom its ok. But I suppose the plug shouldnt look ugly at 100%…

I’d suggest moving on, this issue is too minor for anyone to worry about.

Uhm, I think I’ve done it:

void MySlider::step() {
    SVGSlider::step();

    if (dirty) {
        // simply round y
        handle->box.pos = Vec(handle->box.pos.x, round(handle->box.pos.y));
    }
}
1 Like

That assumes no local transformations.

What do you mean with Local transformations? Example?