Re: color blend mode filter

Peter Schonefeld <[email protected]>
Newsgroups gmane.text.xml.svg.devel
Message-ID <CAOWkeqe2Y+inc5TTXipKe8_ZWSQKEtJvo2c=NM6_6hcZhZY4Yg@mail.gmail.com>
Hi James,

The following might be a step in the right direction...

   <defs>

      <g id="colorLayer" opacity="1">
           <rect x="0" y="0" width="200" height="400" fill="blue" />
           <rect x="400" y="0" width="200" height="400" fill="red" />
      </g>

      <filter id="fltr" x="0" y="0" width="100%" height="100%" >
           <feImage xlink:href="#colorLayer" result="colors" />
           <feColorMatrix in="SourceGraphic" type="saturate" values="0"
result="desat"/>
 <feColorMatrix in="desat" type="matrix"  values="-1 0 0 0 1   0 -1 0 0 1
0 0 -1 0 1   0 0 0 1 0" result="desatInvert"/>
   <feColorMatrix type="luminanceToAlpha" in="desatInvert"
result="alphaMask" />
           <feComposite in="colors" in2="desat" operator="arithmetic"
k1="1" result="darken"/>
           <feComposite in="colors" in2="desat" operator="arithmetic"
k1="1" k2="1" k3="1" result="lighten"/>
           <feBlend in="alphaMask" in2="lighten" mode="screen"
result="blendA" />
           <feComposite in2="alphaMask" in="darken" operator="in"
result="blendB"/>
            <feMerge>
  <feMergeNode in="blendA"/>
                <feMergeNode in="blendB"/>
            </feMerge>
        </filter>

      </defs>

      <image xlink:href="imgb.jpg" width="600" height="400"
filter="url(#fltr)"/>

In summary, define your colorful shapes in the defs g element and then use
a combination of blend and composite ops to get the color like effect. The
alphaMask node helps bring the dark values back.  If you need to retain the
colors of the original graphic you should be able to use a composite of the
#colorLayer's SourceAlpha to mask outside of the color shapes.

Would love to know if you find another way besides this!

Pete
http://VectorShapes.com


[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.