Skip to content

Capturing bitmaps behind the composable. #242

@4gus71n

Description

@4gus71n

Hey there,

Thanks for putting together such an amazing library! I want to bring up an issue I have been going through. I'm in a situation where I have a screen that looks like this:

@Composable
fun SomeScreen() {
    Box {
        Box {
            // I have a camera surface here, but you could paint this box red and it would be the same
        }
        Box() {
            // I use this other box as an overlay for the first one
            Column {  
                SomeToolbar()
                Row { 
                    Spacer(Modifier.width(24.dp))
                    Box(Modifier.weight(1f)) { /* Keyhole!!!*/ }
                    Spacer(Modifier.width(24.dp))
                }
                // More stuff
            }
        }
    }
}

If I use your library to capture what the keyhole Box has I'd get a blank bitmap. It is not just your library, I have tried any other technique to capture bitmaps on compose and none of them is working, apparently because the composable I want to capture is behind the keyhole box, and not within.

Makes sense? I can provide some more examples if it helps. Have you run into this situation ever? Any tips?

I did workaround the problem with a very nasty hack – I basically took a capture of the camera surface bitmap and then cut the keyhole part using the bounds of the Box.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions