nacular / doodle

A pure Kotlin UI framework for the Web and Desktop.
https://nacular.github.io/doodle
MIT License
657 stars 27 forks source link

Export image of the view #46

Open Kadmas opened 1 year ago

Kadmas commented 1 year ago

Hello,

Is it possible to export an image of the view as a png? Also Is it also possible to use doodle in conjunction with other libraries e.g. compose with a doodle view? If so can we get examples of these?

Thanks

pusolito commented 1 year ago

Are you working on web, desktop or both? And can you say more about your use case for integrating Doodle and Compose?

You can use a Doodle app in conjunction with any web framework by embedding it in an HTML element. You would need to do this at the app level, so not a single view. Unless you create an app to just host that view. To do this you'd call the application method with the element you want to host the Doodle app in.

On desktop Doodle currently doesn't integrate with Compose. It does share the same underlying library: Skiko. So it could theoretically interoperate, but that would require exposing some internal details.

As for screenshots; this functionality does not exist yet. Are you looking to don this for a web or desktop app?

Kadmas commented 1 year ago

I'm interested in both web and desktop. I wouldn't say it's a use case so much as I'd rather not have to replace existing code. This is coming up because I'm not seeing drawing capabilities in Jetbrains compose (maybe I'm wrong, but I only saw a canvas element).

For screen shots I'd like to run this in a headless manner so either one would work.