xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Beghin <minimoi1...@hotmail.com>
Subject RE: SVG Colors inversion
Date Mon, 28 Jun 2010 08:29:35 GMT

Thanks Thomas,

I am going to have a look at the new advices you gave me. 

The CSSS one seems great.


I'm gonna try to add this first, as I didn't managed to find a correct matrix doing all the
job ;)

>> I'am going to give this a try.
>> And going to try to fidn the matrix I've got to create ^^

>        Filters are worth a try, but you might find that 
> feComponentTransfer is faster and easier to work with. 

>> It's hard to say if this would be more performant, but this might be
>> a good use case for feColorMatrixElement

>      This could work but it involves a lot more work than the 
>feComponentTransfer case (which is just a simple table lookup). 

Yeah in fact it is hard to find the correct matrix to use ! 

>> One part of this project consists in a kind of color inversion of 
>> some elements in the displayed SVG.
>> In fact, only black(resp white) have to be converted in  white(resp black).

>        This actually sounds like an excellent place to use CSS style sheets. 
>The simplest way (although perhaps not the fastest) would be to use a selector 
>with both descendent, attribute and class bits.  Something like 
>        svg[invert=false] .fill { fill: black } 
>        svg[invert=true]  .fill { fill: white } 
>        svg[invert=false] .fillStroke { fill: black; stroke: white } 
>        svg[invert=true]  .fillStroke { fill: white; stroke: black } 
>        The other possible option would be to use alternate Style sheets 
>that do something similar (might be a little faster). 
>        Then simply setting the 'invert' attribute on the root SVG element 
>should cause the colors to swap for all of the elements with an appropriate 
>'class' attribute. 

>       http://www.w3.org/TR/CSS2/selector.html#descendant-selectors

Installez gratuitement les nouvelles Emoch'ticones !
View raw message