Twinside / Rasterific

A drawing engine in Haskell
BSD 3-Clause "New" or "Revised" License
140 stars 11 forks source link

Integration with a GUI library #35

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hi, thanks for the great library! I'm trying it out now.

Sorry for the noob question, but is it possible to integrate the drawn image directly into some other GUI framework, say WX without going through the file system? I'd like to use this library as the drawing engine for a small game I'm writing.

Thanks!

Twinside commented 6 years ago

I guess it should be possible by passing through the imageData of the generated Image, which is a Storable vector, and can be used as raw pointer (potentially usable by C callbacks). See Storable vector documentation on raw pointer for more hints. Hopefully wx provides primitives to import it, at worst, you may have to copy the Vector as an Array and use imageCreateFromPixelArray (I'm not that knoweledgeable about wx), it would still a magnitude faster than storing then loading a file again.

ghost commented 6 years ago

Thanks for the info! Will try it out when I'm done with another project.