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

Compose transparency and blend issues with RNG #8960

Open
yschimke opened this issue Apr 2, 2024 · 1 comment
Open

Compose transparency and blend issues with RNG #8960

yschimke opened this issue Apr 2, 2024 · 1 comment

Comments

@yschimke
Copy link

yschimke commented Apr 2, 2024

@Composable
@WearPreviewLargeRound
internal fun TestCaseBox() {
    Box(
        modifier = Modifier
            .fillMaxSize()
            .background(Brush.horizontalGradient(listOf(Color.Blue, Color.Green, Color.Blue)))
    ) {
        Box(modifier = Modifier
            .fillMaxSize(0.8f)
            .align(Alignment.Center)
            .graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen)
            .drawWithContent {
                drawContent()
                drawRect(
                    brush = Brush.verticalGradient(
                        listOf(
                            Color.Black,
                            Color.Transparent,
                            Color.Black
                        )
                    ),
                    blendMode = BlendMode.DstIn
                )
            }) {
            Box(
                modifier = Modifier
                    .fillMaxSize()
                    .background(Color.Red)
            )
        }
    }
}

With Compose Previews

image

With RNG Screenshots
image

Ignore the device clipping

@yschimke
Copy link
Author

yschimke commented Apr 2, 2024

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

1 participant