Closed sumy7 closed 3 years ago
One way is to see how our screenshot tests are organized: https://github.com/JetBrains/androidx/blob/androidx-main/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/GraphicsLayerTest.kt
@sumy7 does is answer your question?
@akurasov Sorry forgot to reply. This is not an effective method, because some methods are not available in Canvas class.
@sumy7 I'm a bit lost. How methods absent in Canvas class relate to your original question? And what exactly is missing?
@akurasov
Hi, akurasov.
First of all, I want to get image bits from Canvas. It is good if there is some method like canvas.getBitmap()
to get all Pixels on Canvas. But there is no such method.
So I opened this issue, and olonho give me screenshot tests. I notice that GraphicsLayerTest.kt has it's own TestComposeWindow and take screenshot from it. But this method is too troublesome, and I could not find some method to simply it. So the issue has been put on hold.
In addition, I thought about some other methods, but did not verify whether it is feasible.
If I follow olonho tests method, how could I get picture from canvas? Is my method what i thought feasible? Is there anything else I haven’t noticed?
@sumy7 maybe Canvas.readPixels is what you need?
Closing as inactive
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
I want to save what I draw on the canvas. but didn't find any API to do it. Did I miss something?