Twinside / Rasterific

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

Compositing #29

Open SwiftsNamesake opened 7 years ago

SwiftsNamesake commented 7 years ago

Forgive me if this has already been covered, but is there a way of compositing Images efficiently?

I'm using this library (thank you again!) to render UI and the frame rate is suffering a bit from having to re-create an Image on every update. I'd like to reduce the workload by reusing the elements that don't change.

I noticed Path and the hidden Compositor module, but I'm not sure how they address this problem (if at all).

Twinside commented 7 years ago

Could you describe your use case a little more (how you build your draw call)?

If you want to follow the performance path, you will:

With a bit of hack, you should be able to reuse an image from one frame to the next by creating yourself a DrawContext

And you won't gain anything from the Compositor module, it's a low level module to help plot pixels in the pipeline.

SwiftsNamesake commented 7 years ago

Alright, thanks for the quick reply. I'll take your advice and see what comes of it. I'd rather stay away from Immediate if I can get away with it.