Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipping a rectangle with border-radius results in color fringing from obscured items under the top most item #7980

Open
NigelBreslaw opened this issue Mar 28, 2025 · 0 comments
Labels
bug Something isn't working need triaging Issue that the owner of the area still need to triage

Comments

@NigelBreslaw
Copy link
Member

Bug Description

export component ExportedComponent {
    width: 300px;
    height: 300px;

    Rectangle {
        width: 33px;
        height: 33px;
        border-radius: self.width / 2;
        clip: true;
        Rectangle {
            background: green;
        }
        Rectangle {
            background: black;
        }
    }
}

In this example the expected behaviour is a pure black circle with smooth edges with black in various states of opacity. However the completely obscured green rectangle bleeds through and causes unexpected colour fringing.

Image

Reproducible Code (if applicable)

export component ExportedComponent {
    width: 300px;
    height: 300px;

    Rectangle {
        width: 33px;
        height: 33px;
        border-radius: self.width / 2;
        clip: true;
        Rectangle {
            background: green;
        }
        Rectangle {
            background: black;
        }
    }
}

Environment Details

  • Slint Version: 1.10
  • Platform/OS: MacOS
  • Programming Language:
  • Backend/Renderer: Skia

Product Impact

It's only when working on the custom controls with a screen magnifier that I finally worked out what was going on. Putting multiple items inside a single clipped rectangle with a border-radius is widely used. I've been wondering for ages if there was something odd about how smooth a border-radius is. For example iOS and browsers do have differences in anti-aliasing here. Figma even has a slider so you increase and decrease this level on any rectangle to simulate different platforms. But it was never a consistent issue. Now I wonder if this was mostly the problem. In many situations you would never notice this unless you happen to overlap rectangles with specific colour combos.

It's also quite hard to work around this issue, without exporting correct images from a paint package.

@NigelBreslaw NigelBreslaw added bug Something isn't working need triaging Issue that the owner of the area still need to triage labels Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need triaging Issue that the owner of the area still need to triage
Projects
None yet
Development

No branches or pull requests

1 participant