createGraphics save the whole sketch

how can I pass the whole sketch as a function to the createGraphics variable and not get the error as “img.pattern is not a function”?

Do you have some code or an online example for us to take a look at? ,
i think the idea is to create a add buffer and draw INTO it.
( other as the example:
-a- create in setup()
-b- draw into it in setup also if static
-c- draw in draw()
later you can show it in draw…

so create a canvas first by normal draw()…
and then copy it into a Graphics buffer
? what sense would it make, even if possible.

for save canvas to picture file pls use

Actually this is a huge project:

I have this function called “mainShow(n)” and I want it to show in my createGraphics “pg” as=> pg.mainShow(n); but I got the error that it is not a function

saving canvas as a picture file causes my code to crash! and as I mention below my my project is huge, I put the whole project in seperate function and I wanna add that function into createGraphics but it does’t let me so

yes, but here for the forum and easy understanding,
you should make a extra small example of your problem
to show what you try to do.

a class could have a function a graphics buffer not.

1 Like