Last active
August 1, 2021 20:41
-
-
Save DevSrSouza/e6d0d540b37ac0b84ae2d0cbf509bba4 to your computer and use it in GitHub Desktop.
Compose Desktop render to png test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val window = TestComposeWindow(width = 1024, height = 300) | |
window.setContent { | |
MainUi() | |
} | |
File(Paths.get("").toAbsolutePath().toString()).writeBytes(window.surface.makeImageSnapshot().encodeToData()!!.bytes) | |
} | |
@Composable | |
fun MainUi() { | |
MaterialTheme { | |
Surface( | |
modifier = Modifier.fillMaxSize(), | |
color = Color.Transparent | |
) { | |
Column { | |
Button({}) { Text("Test 1") } | |
Button({}) { Text("Test 2") } | |
Button({}) { Text("Test 3") } | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment