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

Color transforms do not work on Safari using the canvas backend #25

Open
Herschel opened this issue Aug 18, 2019 · 7 comments
Open

Color transforms do not work on Safari using the canvas backend #25

Herschel opened this issue Aug 18, 2019 · 7 comments
Labels
canvas Issues relating to the CanvasRenderingContext2D renderer P-low Priority: Low rendering safari web Issues relating to the HTML5 frontend

Comments

@Herschel
Copy link
Member

Herschel commented Aug 18, 2019

Safari does not support CanvasRenderingContext2d.filter which is used to render the color transforms on display objects. I tried a few tricks such as putting the filter directly on the image element, but no luck.

Not sure how to solve this one. Either we find a better, fast way to apply color transforms on all browsers, or we add a potentially slower workaround for Safari.

@Herschel Herschel added web Issues relating to the HTML5 frontend canvas Issues relating to the CanvasRenderingContext2D renderer rendering safari labels Aug 18, 2019
@Justin-CB
Copy link
Contributor

If this is still a problem, I think it would be better to use a workaround, rather than have it not wprk at all.

@Herschel
Copy link
Member Author

It's less of a problem since the alternate canvas drawing path was added; simple shapes draw directly via canvas paths, and the color transform can be directly applied to the colors. So anything that is made up of solid fills will work with color transforms.

It still occurs for things that fallback to the old SVG rendering path. Unfortunately I don't think there's a good way to do this otherwise; it'd probably require rendering the art to an intermediate buffer (and several times if it has both an additive and a multiplicative color). I might implement this workaround when we add the blend modes/filter, which will require bitmap caching support anyway.

I would be more concerned about it if I didn't plan to have a WebGL renderer, where the issue doesn't apply.

@Herschel
Copy link
Member Author

Herschel commented May 4, 2020

WebGL support was merged in and made default in #520, so this is no longer an issue in general use. However, the issue still occurs if the canvas backend is used.

@Herschel Herschel added the P-low Priority: Low label May 4, 2020
@Herschel Herschel changed the title Color transforms do not work on Safari Color transforms do not work on Safari using the canvas backend May 4, 2020
@bbb651
Copy link
Contributor

bbb651 commented Dec 7, 2020

I found this polyfill that uses a second hidden canvas to apply the filter and copy draw it onto the main canvas, I haven't tested it but it'll probably be a noticeable hit in performance, I still think it's better than nothing.

@Lord-McSweeney
Copy link
Collaborator

Safari still doesn't support this.

@karlcow
Copy link

karlcow commented Sep 27, 2023

Some discussions happening on https://bugs.webkit.org/show_bug.cgi?id=198416

@isrishtisingh
Copy link

I found this polyfill

I tried this package, it is breaking all my canvas drawings.
Any other options to make Canvas/Ctx.filter function to work on iOS Chrome/Safari browsers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
canvas Issues relating to the CanvasRenderingContext2D renderer P-low Priority: Low rendering safari web Issues relating to the HTML5 frontend
Projects
None yet
Development

No branches or pull requests

6 participants