ku-fpg / blank-canvas

A Haskell API into HTML5 Canvas
BSD 3-Clause "New" or "Revised" License
72 stars 14 forks source link

Support creating a data URL from a bytestring #91

Open tomjaguarpaw opened 5 years ago

tomjaguarpaw commented 5 years ago

Currently creating a data URL seems to require loading from a file. Could you also support reading from a bytestring?

https://github.com/ku-fpg/blank-canvas/blob/master/Graphics/Blank/Utils.hs#L47

RyanGlScott commented 5 years ago

That sounds reasonable to me! The only reason that readDataURL exists, I believe, is to mimic JavaScript's readAsDataURL function, but there's no reason why we couldn't also have a variant of this function that accepts a raw ByteString.

Would you mind making a pull request for this change? Thanks!