Loads the pixel data of the current Py5Graphics drawing surface into the Py5Graphics.pixels array.
def setup(): g = py5.create_graphics(60, 60) g.begin_draw() g.background(255, 0, 0) g.rect(10, 10, 40, 40) g.load_pixels() yellow = "#FF0" for i in range(len(g.pixels) // 2): g.pixels[i] = yellow g.update_pixels() g.end_draw() py5.background(240) py5.image(g, 20, 20)
Loads the pixel data of the current Py5Graphics drawing surface into the Py5Graphics.pixels array. This function must always be called before reading from or writing to Py5Graphics.pixels. Subsequent changes to the Py5Graphics drawing surface will not be reflected in Py5Graphics.pixels until
load_pixels() is called again.
This method is the same as load_pixels() but linked to a
Underlying Processing method: PGraphics.loadPixels
load_pixels() -> None
Updated on September 01, 2022 16:36:02pm UTC