Declare variable for PGraphics which is given image as an input

Hi. I am loading an image in PGraphics sketch. Taking the color of each pixel and drawing rotated rectangles on main Sketch with the colors of each pixel from image.

My confusion is
how do I define PGraphics variables.
Do I need to make another class or wrapper class?
What exactly is a wrapper class?

You can create a PImage to store your current sketch content:

PImage temporalImage = get();

More here. Additioanlly, you can use a PGraphics using createGraphics(). Try any of them and if you have any other question, please provide some code.

Kf

I complicated it. It worked fine with pgraphics .Thanks.