Skip to content
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

Bgcolor with transparent alpha value has strange behavior #135

Closed
grant-wilson opened this issue Feb 11, 2021 · 7 comments
Closed

Bgcolor with transparent alpha value has strange behavior #135

grant-wilson opened this issue Feb 11, 2021 · 7 comments

Comments

@grant-wilson
Copy link

Pts behaves strangely when the bgcolor is transparent. The canvas slowly darkens and visual artifacts appear.
This can be demonstrated with this simple demo.
pts_demo.zip

@williamngan
Copy link
Owner

Hi @grant-wilson -- you can use "transparent" or false to set the bgcolor instead of an rgba value. Eg:

space.setup( {bgcolor: "transparent"} );

Alternatively, you can clear the canvas by calling space.clear("transparent") when needed.

I just realize the CanvasSpace's setup documentation was truncated so the parameters were hidden. I will fix it asap.

Thanks!

@grant-wilson
Copy link
Author

grant-wilson commented Feb 11, 2021

Hi @williamngan ,

Thank you for the quick reply.
You are right that using the color name "transparent" works great!
This is exactly what I needed.

However I would argue that the behavior seen when using an rgba value with an alpha less than ff is probably not intended.
You can see what happens by running the pts_demo.html file I attached.

I have updated the title to reflect more clearly what I am talking about.

@grant-wilson grant-wilson changed the title Transparent Canvas Behavior Bgcolor with semi-transparent alpha value has strange behavior Feb 11, 2021
@grant-wilson grant-wilson changed the title Bgcolor with semi-transparent alpha value has strange behavior Bgcolor with transparent alpha value has strange behavior Feb 11, 2021
@williamngan
Copy link
Owner

Thanks @grant-wilson. I see what you mean now -- that's a good catch. I will try to fix it in the next release.

In the meantime, you can call space.clear( "transparent" ) and then draw a semi-transparent rect that fills the canvas as a temporary fix.

@jperrett256
Copy link

Not sure if should be separate issue, but it falls under same heading, so I thought it was worth mentioning here.
While "transparent" does work, using false for bgcolor does not seem to work. (Contradicts the documentation.)
pts_demo.zip

@williamngan
Copy link
Owner

Thanks for report this @jperrett256 -- this looks like a regression and we will fix it in the next patch release!

williamngan added a commit that referenced this issue Mar 10, 2021
@williamngan
Copy link
Owner

@jperrett256 - this should be fixed in v0.10.4. Thanks again for reporting the issue.

@williamngan
Copy link
Owner

Closing this issue now. Please reopen if there're still issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants