Access stencil data
Posted: Sat Jul 22, 2017 6:28 pm
Hi,
I'd like to experiment with a code that needs to go pixel by pixel and do some additional calculations. Now the area could be (most of the time) greatly reduced by accessing only pixels of a newly drawn shape (before I actually draw it).
I thought it could be nice to use stencils for that, however I have no way to access the data to determine which pixels I really need to check.
I thought of drawing (not necessarily) stencils to a Canvas and then reading the data without displaying anything, howewer that would involve (to my best knowledge) Canvas:newImageData(), which the wiki says to be slow, and then reading the ImageData. And since Canvas:getPixel() is removed, there seems to be no other legit way to read Canvas data.
This, on the other hand, needs to be lightning fast (which seems hard when dealing with pixel to pixel, but I chose to ignore this fact for time being).
Of course I could use my own math for the shapes, but why not exploit the built-ins...
Thanks.
I'd like to experiment with a code that needs to go pixel by pixel and do some additional calculations. Now the area could be (most of the time) greatly reduced by accessing only pixels of a newly drawn shape (before I actually draw it).
I thought it could be nice to use stencils for that, however I have no way to access the data to determine which pixels I really need to check.
I thought of drawing (not necessarily) stencils to a Canvas and then reading the data without displaying anything, howewer that would involve (to my best knowledge) Canvas:newImageData(), which the wiki says to be slow, and then reading the ImageData. And since Canvas:getPixel() is removed, there seems to be no other legit way to read Canvas data.
This, on the other hand, needs to be lightning fast (which seems hard when dealing with pixel to pixel, but I chose to ignore this fact for time being).
Of course I could use my own math for the shapes, but why not exploit the built-ins...
Thanks.