-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sampling Canvas Data (getImageData) #27
Comments
Depending on what you are doing there may be different ways of going about it. If you just want to read the canvas pixels and calculate things, I recommend using ports and doing so on JS, because Elm doesn't support converting If you want to paint ImageData into the canvas, either
If you explain your use case and it is important to add first class support in the library, we can talk about adding other |
I'm hoping to implement a flood fill tool on top of your drawing example. I guess I could send the message through a port then implement it in javascript, but it would be nice if I could write it in elm. Do you think using a port to pass image data as array into Elm, doing the flood fill, then passing the image data back to JS to put onto the canvas would work? Do you think that would have poor performance? Thanks for your help! |
@tortis I usually monkey-patch elements to exhibit specific getters for the stuff I want in elm. Then I listen to events and use Example:
HTMLElement.prototype.__defineGetter__("boundingClientRect", function() {
return this.getBoundingClientRect();
}); Within the hander you can also call |
First off, awesome package! I'm having fun with it so far.
I was curious if you had any plans for an API to get/put raw image data? It seems like might be possible with Texture, but I'm not too sure.
Thanks!
The text was updated successfully, but these errors were encountered: