Equivalent to PGraphics g in p5.js?

Unfortunately, createCanvas() instantiates a p5.Renderer object, while createGraphics() instantiates a p5.Graphics object, which is a wrapper for a p5.Renderer object, plus it acts as a p5 object too: :clown_face:

It’s very inconsistent & hard to study how the p5js API deals w/ those 2 classes across its source code! :dizzy_face:

There are other problematic patches to deal w/ p5.Image objects too.
For some reason, the class p5.Image doesn’t inherit from p5.Element!
And therefore, it’s not a parent class for neither p5.Renderer nor p5.Graphics! :scream:

BtW, I’ve always ranted & been against this hackish p5.Graphics class from the very beginning of the p5js project. :face_with_symbols_over_mouth:

2 Likes