Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Disable canvas AA
-
I am trying to build a custom ray renderer in Pythonista, using canvas as a buffer to draw pixels on the screen. It’s probably not the best approach but anyway, when I disable AA with
canvas.set_aa_enabled(False)
pythonista still smooths everything out. Keep in mind I am drawing pixel by pixel as 1:1 rectangles. -
One tricky bit is that pixels in iOS are not really physical pixels. You draw in points, but you probably have a 2x or 4x device.
A better way to do pixel mashing is to use a numpy array, and use that as a backing to an IOSurface.
For a long thread about a few different topics about doing fast real time things in pythonista, see
https://forum.omz-software.com/topic/5155/real-time-audio-buffer-synth-real-time-image-smudge-toolIn particular, take a look at the IOSurfaceWrapper, included at the start of
https://gist.github.com/medericmotte/37e43e477782ce086880e18f5dbefcc8This exposes a numpy array that is m x n x 4, which allows you to set pixels as desired, inside the .Lock() context manager.
Since you are doing raycasting, you may be able to do efficient vectorized equations that lets you calculate the whole array at once.