Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
546 views
in Technique[技术] by (71.8m points)

graphics - Using SVG for additive color mixing (additive blending)

Coming from a graphic design background I know how to cheat to create an effect of additive color. The same basic solution is proposed in another post on here.

The post above refers to transparent .png files but the concept is the same. The basic effect I'd like to create is like the one pictured here.

I'd love to do it in SVG so that it can scale and so that when I am talking about a given topic (let's just say the topic is 'green') I can enlarge that portion of the graphic and the overlapping areas would still display correctly.

These posts seem to get pretty close:

But none of the above deal with SVG so let me give it a whirl.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Right now you can do this with SVG filters. Since your interest lies in mixing colors, you might be interested in researching the following filter primitives: feBlend, feComposite, feColorMatrix and feComponentTransfer.

If you want to learn the easy way (Inkscape) see this blogpost. I can also recommend reading the Inkscape book and in particular how to do custom filters. Here's one page showing feBlend with similar results as in your basic effect example.

Update: here's the relevant svg file from the inkscape book, it should look like the image below in browsers that support svg filters (and the BackgroundImage filter input, note that Gecko doesn't support BackgroundImage and enable-background). feBlend variations


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...