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

Native browser filters for canvas? #1187

Open
ghost opened this issue Oct 2, 2021 · 4 comments
Open

Native browser filters for canvas? #1187

ghost opened this issue Oct 2, 2021 · 4 comments

Comments

@ghost
Copy link

ghost commented Oct 2, 2021

I would like to ask to add support for native filters for HTML5 Canvas due to hardware acceleration in rendering. The fact is that if you use ImageData, then one way or another you can get drawdowns in FPS, even if you run compute shaders through the GPU. Plus cache can not fully solve performance issues. I would also like to mention the problems of cross origin policy when using ImageData.

Details:

If this Issues does not concern, then I ask you to transfer it to the category of discussions.

@lavrton
Copy link
Member

lavrton commented Oct 5, 2021

Previously, this feature had a terrible browsers support. But now I think it is getting better. So, it will make sense to experimentally support it.

@vikpe
Copy link

vikpe commented Nov 25, 2022

Yes, native filters would be nice!

image

(source: MDN)

@vikpe
Copy link

vikpe commented Nov 30, 2022

Added CSS filters to my Quake model texture editor: https://vikpe.org/qw-gfx/ . Simple and performant.

css_filters.webm

apply filters:

layer.getContext().setAttr("filter", "blur(5px) hue-rotate(30deg)");
layer.draw();

get the result (layer with filters applied):

layer.getNativeCanvasElement();

remove filters:

layer.getContext().setAttr("filter", "none");
layer.draw();

@lavrton
Copy link
Member

lavrton commented Dec 17, 2022

Safari is the blocker. I hope they will support it soon.

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

2 participants