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

View clipping to outline doesn't work on screenshots #276

Open
N-Olifer opened this issue Jan 21, 2021 · 2 comments
Open

View clipping to outline doesn't work on screenshots #276

N-Olifer opened this issue Jan 21, 2021 · 2 comments

Comments

@N-Olifer
Copy link

When make a screenshot test for some layout, and some custom view inside contains outline clipping like that:

        view.outlineProvider = object : ViewOutlineProvider() {
            override fun getOutline(v: View, outline: Outline) {
                outline.setRoundRect(0, 0, v.width, v.height, 50)
            }
        }
        view.clipToOutline = true

It works correctly in real app, but doesn't work on screenshot (view appears without clipping).
Maybe, it's related to hardware acceleration somehow.

Is there some workaround to make clipping work on screenshots?

@xiphirx
Copy link
Contributor

xiphirx commented Apr 15, 2021

Clipping and elevation happen in a separate rendering pipeline that we dont participate in when we take a screenshot afaik, so no we can't capture that. We would need to investigate other methods of taking screenshots of views that do capture that rendering output, but I'm not aware of any outside of adb screencap, but then that would take a screenshot of the entire screen.

@donny-li-ck
Copy link

Hello, I'm experiencing the same issue when taking screenshots of my Jetpack Compose views using the Modifier.clip modifier. Is there a workaround of some sort?

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

No branches or pull requests

3 participants