You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by nnaass <al...@gmail.com> on 2007/10/16 16:32:48 UTC

SVGGen and filters

First, Hi all and thanks for this great product .

I'm doing some stuff using SVGGraphics2D and SVGGen, everything is great
until I want to use filters. I really don't want to use batik image
generated by svggen.

for example, what should I do to get a simple drop shadow ?

<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" >
     <defs>
          <filter id="filter" filterRes="100" x="0" y="0">
               <feGaussianBlur stdDeviation="4 4"/>
               <feOffset dx="4" dy="4"/>
          </filter>
     </defs>
     <rect x="4" y="4" width="100" height="100" fill="grey"
filter="url(#filter)"/>
     <rect x="0" y="0" width="100" height="100" fill="blue" stroke="black"/>
</svg>

I found many java code that will achieve that but they are all very
complected and they use BufferdImage (that will end up to be hard coded
image in the SVG source). 

I also want a way to have it both-ways, in java and exporting it to SVG. 

Any idea ?

-- 
View this message in context: http://www.nabble.com/SVGGen-and-filters-tf4634566.html#a13234758
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: SVGGen and filters

Posted by th...@kodak.com.
Hi NNaass,

nnaass <al...@gmail.com> wrote on 10/16/2007 10:32:48 AM:

> I'm doing some stuff using SVGGraphics2D and SVGGen, everything is great
> until I want to use filters. I really don't want to use batik image
> generated by svggen.
> 
> for example, what should I do to get a simple drop shadow ?

   The concept of filters goes well beyond what the Graphics2D
interface can accommodate so you will need to get the group that
you want filtered (via 'SVGGraphics2D.getRoot()') and then
add the filter stuff. 

   You will need to create the filter elements 
with Document.createElementNS, set the various attributes on those
elements with 'setAttributeNS', and add the filter attribute to
the group from getRoot, and finally append them both to your
final document (which you will need to manage yourself).

> <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" >
>      <defs>
>           <filter id="filter" filterRes="100" x="0" y="0">
>                <feGaussianBlur stdDeviation="4 4"/>
>                <feOffset dx="4" dy="4"/>
>           </filter>
>      </defs>
>      <rect x="4" y="4" width="100" height="100" fill="grey"
> filter="url(#filter)"/>
>      <rect x="0" y="0" width="100" height="100" fill="blue" 
stroke="black"/>
> </svg>
> 
> I found many java code that will achieve that but they are all very
> complected and they use BufferdImage (that will end up to be hard coded
> image in the SVG source). 
> 
> I also want a way to have it both-ways, in java and exporting it to SVG. 

> 
> Any idea ?
> 
> -- 
> View this message in context: http://www.nabble.com/SVGGen-and-
> filters-tf4634566.html#a13234758
> Sent from the Batik - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>