Jasper Phillips wrote:
You'll never want to use the Surface.set_at/get_at functions when doing image effects. You'll want to avoid loops like over the whole image, like for x in range(width): for y in range(height): it is never going to be fast enough.I'm trying to blur both RGB and alpha using surfarray. I can get it to work with surfarray.array3d() and .array_alpha(), but it's very slow as I end up using Surface.set_at() to combine the results of both methods together.
The "3d" arrays are always Int8 type arrays. Numeric always tries to upcast your numbers into regular Int, it is very annoying. With a little care or conversion you can get the right types out.exceptions.TypeError: Array can not be safely cast to required type