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

Add ability to change opacity for compose view #1022

Merged
merged 7 commits into from
Jan 31, 2024

Conversation

ASalavei
Copy link
Collaborator

@ASalavei ASalavei commented Jan 29, 2024

Usage example:

val viewController = ComposeUIViewController(
    configure = { opaque = false }, // Make compose scene background transparent
    content = ::SomeComposeNode
)

Related issue: JetBrains/compose-multiplatform#4108

Copy link
Member

@MatkovIvan MatkovIvan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code LGTM in general, but

  1. We need to agree about public API (transparency vs opaque) to keep it harmonized between platforms. cc @igordmn
  2. I'd like to wait a review from @elijah-semyonov since it affects render pipeline/performance

@ASalavei
Copy link
Collaborator Author

  1. We need to agree about public API (transparency vs opaque) to keep it harmonized between platforms. cc @igordmn

I named it opaque because it is most commonly used term in iOS (compared to transparency)

Copy link

@elijah-semyonov elijah-semyonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed it in a call, LGTM

@MatkovIvan MatkovIvan merged commit 8fc2b11 into jb-main Jan 31, 2024
6 checks passed
@MatkovIvan MatkovIvan deleted the andrei.salavei/compose-view-opacity branch January 31, 2024 12:57
@chrisbanes
Copy link

QQ: is there a performance impact from using opaque = false? It doesn't look like it from the PR

@elijah-semyonov
Copy link

elijah-semyonov commented Feb 1, 2024

@chrisbanes
Yes, it's marked in the documentation to the added configuration property.
There is an impact, since iOS can't draw perform direct-to-screen drawing when opaque is set to false.

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

Successfully merging this pull request may close these issues.

5 participants