-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fixed transparency of background problem #5225
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
Conversation
This comment has been minimized.
This comment has been minimized.
@montoyamoraga please review this pull request |
hi @two-ticks sorry i'm not familiar with this section of the code, |
I think the implementation here is probably going to be way too slow especially with larger canvases since it requires going through the pixels array of the whole canvas. Can this possibly be implemented in another way? |
Maybe we can implement it with |
I'm not quite sure what you mean by |
I have tried something similar to this and some more variations of it. Idea was to change if (args[0] instanceof p5.Image) {
if (args[1] >= 0) {
// set transparency of background
const ctx = this.getContext("2d");
ctx.globalAlpha = args[1]; // Turn transparency on
this._pInst.image(img, 0, 0, this.width, this.height);
} else {
this._pInst.image(args[0], 0, 0, this.width, this.height);
} p5.js/src/core/p5.Renderer2D.js Line 197 in 374acfb
|
Ok, |
Thanks @two-ticks for working on it. @limzykenneth, any recommended next steps to merge this PR? |
For this we will need an alternate implementation than the one in this PR as it is likely to be too slow. If @Palaksharma23 wants to have a go and @two-ticks isn't currently working on this I'm happy to review any new changes. The solution doesn't have to use |
I would be very happy if @Palaksharma23 wants to work on this and get assigned. Waiting for @Palaksharma23 to reply. |
Hey @two-ticks @limzykenneth, I am new to p5.js and got issue #5175 in my mail from CodeTriage (thought of investigating it further to learn). I looked at #5225 and the other |
I think |
I can't assign @yashlamba on #5175 as only participants of the thread can be assigned but @yashlamba feel free to work on this. Thanks! |
Thanks @limzykenneth, I'll go ahead and open a new PR. |
Thanks @two-ticks and @yashlamba. I will close this PR since it has been fixed on the recent merge of #5683! |
Resolves #5175
Changes:
example sketch
Screenshots of the change:
PR Checklist
npm run lint
passes