[英]Adding filter to pattern image of shape in fabric.js
I am trying to apply a filter to the pattern image of shape but receiving numerous errors. 我试图将过滤器应用于形状的图案图像,但收到许多错误。 I googled a lot but still cannot find a solution that works.
我在Google上搜索了很多,但仍然找不到有效的解决方案。 Below is my code.
以下是我的代码。 Q 1. Is it even possible?
Q 1.有可能吗? Q 2. How to achieve it!?
Q 2.如何实现!
var canvas = new fabric.Canvas('c1');
var circle = new fabric.Circle({
radius: 100, fill: 'green', left: 100, top: 100
});
canvas.add(circle);
loadPattern('http://i0.wp.com/www.illustratoring.com/wp-content/uploads/2012/12/chevron-pattern-illustrator.png?resize=40%2C40', circle);
function loadPattern(url, obj){
fabric.util.loadImage(url, function(img) {
obj.setPatternFill({
source: img,
repeat: 'repeat'
});
canvas.renderAll();
});
}
here is the JSfilddle https://jsfiddle.net/eepmzy9n/2/ I want to apply filters to the pattern image. 这是JSfilddle https://jsfiddle.net/eepmzy9n/2/我想将过滤器应用于图案图像。
Yes, this should be possible using the fabric js filters. 是的,使用fabric js过滤器应该可以实现。 Combining patterns and filters shouldn't be an issue.
模式和过滤器的组合应该不是问题。
Info on image filters: 图像滤镜信息:
Other code examples using filters: 使用过滤器的其他代码示例:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.