-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added feature to saveCanvas() to support framebuffer #6510
Added feature to saveCanvas() to support framebuffer #6510
Conversation
Is there anything else left that needs to be addressed in this PR? |
Thanks for taking on this task! I think we don't need to do anything to support Line 26 in 28740f9
What we would need to do to resolve the issue is to add support for the
|
…into feature/savecanvas-framebuffer # Conflicts: # src/image/image.js
src/image/image.js
Outdated
|
||
if (arguments[0] instanceof HTMLCanvasElement) { | ||
htmlCanvas = arguments[0]; | ||
args.shift(); | ||
} else if (arguments[0] instanceof p5.Element) { | ||
htmlCanvas = arguments[0].elt; | ||
args.shift(); | ||
} else if (arguments[0] instanceof p5.Framebuffer) { | ||
const framebuffer = arguments[0]; | ||
temporaryGraphics = createGraphics(framebuffer.width, framebuffer.height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I think this all works in global mode! The last thing to do is to also make it work in instance mode, where createGraphics
isn't globally defined. I think in that case using this.createGraphics
will work though? Maybe try that and try using this in an instance mode sketch to verify
Works in both global and instance mode now.👍 |
Resolves #6404
Introduces an enhancement to the
saveCanvas
function, allowing it to accept a framebuffer as an input.Changes:
saveCanvas
function.p5.Graphics
as a param.Screenshots of the change:
PR Checklist
npm run lint
passes