Hello,
Can you provide more clarity on what you are trying to do?
You tagged as Beginners and Homework and this may require some more of a skill level and advanced topics.
Please format your code as a courtesy to the community:
https://discourse.processing.org/faq#format-your-code
There are resources (tutorials, references, examples, etc.) here:
https://processing.org/https://processing.org/
And examples that come with Processing:
This is an “Intermediate” tutorial:
https://processing.org/tutorials/pixels/
Reference:
https://processing.org/reference/PImage_mask_.html
There are examples in the Image and Image Processing sections ready to run.
And a bit of searching… I found some good examples out there.
UPDATE 2021-07-23
This tutorial discusses PGraphics:
https://processing.org/tutorials/rendering/
Reference:
https://processing.org/reference/PGraphics.html
:)