简体   繁体   中英

Can I apply filters to Fabric.js primitives?

Is it possible to apply the Image filters to primitives, paths, shapes and text? It's kind of weird to be able to do them on the more complicated images, but not be able to blue a rectangle. Any "cheat" to do this?

If you look in the fabric.js code, you will see that the fabric.js filter feature is creating a new image from the original image (ie each pixel in the new image is calculated by manually applying the filter to pixels in the original image). Thus, the fabric.js filter feature only applies to images.

Remember that fabric.js provides a model on top of a canvas element. The current standard specs for a canvas 2D rendering context does not support the general concept of filters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM