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

Unexpected visual behavior of clip #17016

Open
xlxdd opened this issue Sep 14, 2024 · 1 comment
Open

Unexpected visual behavior of clip #17016

xlxdd opened this issue Sep 14, 2024 · 1 comment
Labels

Comments

@xlxdd
Copy link

xlxdd commented Sep 14, 2024

Describe the bug

When using Clip to constrain the visible area of a control, the result does not match the expected behavior.
It seems the outer pixels expected to be cut come in.
It's hard for me to describe,but I think you can understand if you see the picture.

To Reproduce

Here is a simple way to Reproduce it.

<StackPanel Orientation="Horizontal" Spacing="10">
            <Border Width="100" Height="100" Background="Black">
                                <Border Width="100" Height="100" CornerRadius="50" Background="White"/>
            </Border>
            <Border Width="100" Height="100" Background="Black">
                <Border.Clip>
                    <EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50"/>
                </Border.Clip>
                <Border Width="100" Height="100" CornerRadius="50" Background="White"/>
            </Border>
            <Border Width="100" Height="100" Background="Black">
                <Border.Clip>
                    <EllipseGeometry Center="50,50" RadiusX="30" RadiusY="30"/>
                </Border.Clip>
                <Border Width="100" Height="100" CornerRadius="50" Background="White"/>
            </Border>
</StackPanel>

And what it looks like:
clip

Expected behavior

No response

Avalonia version

11.1.3

OS

Windows

Additional context

No response

@xlxdd xlxdd added the bug label Sep 14, 2024
@robloo
Copy link
Contributor

robloo commented Sep 14, 2024

Yea, this issue shows up all over the place in subtle ways. Usually with anti-aliasing and corner radius, etc. It's an issue with Skia itself as far as I know and there isn't a generalized solution for all cases yet.

You will probably have to find something that works for your case (usually making the clip 1 pixel larger or something).

Also see:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants