This issue only manifests itself with the Direct2D renderer in JUCE 8.
When resizing the window (and applying an affineTransform::scale to its components) I get visible borders around opaque components, showing the background their grandparent.
But Component size and position is still integer only i guess. Would be great if this could be solved. But I remember some discussions with Jules that this isn’t possible without image oversampling.
Opaque components can not have smooth anti aliasing transitions to the parent, because they are Opaque. They only fit, when they are aligned to pixels.
Take a look at the thread I posted above, and try the example code in both JUCE 7 and JUCE 8 on windows.
Now int rectangles (including component bounds) do act exactly like float ones with identical values.
We need anti aliasing when components are not aligned to a pixel. For example when scaled. And this does not work with opaque components because they don’t support alpha values.
I’d love to have some notes from the JUCE team about the design decisions that took place here, and what the limitations are.
This was not part of JUCE 7 D2D, so I suppose this is the work of @reuk ?
We’ve just pushed a couple more fixes for this issue on the JUCE8 branch:
This wasn’t entirely true, it also manifested in the CoreGraphics renderer on macOS. It was not present in the software renderer or OpenGL renderer.
This is sort of true. The borders arise when two components join at a fractional pixel position. In this case, the edges of both components will be anti-aliased. The expected behaviour is that the background component is drawn in its original colour, and only the foreground component is anti-aliased.
Opaque components work by excluding the child area from the clip region when drawing the parent component. In the software renderer, the excluded area is always snapped ‘inwards’ to the closest integer size, which means that the background is not anti-aliased. This doesn’t matter in practice because the non-anti-aliased edge is completely hidden by the opaque foreground component.
The changes I linked above make this behaviour consistent in the CoreGraphics and Direct2D renderers. Please try out this change and let us know if you run into any new problems.