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 Ken Arnold <ar...@moonhill.org> on 2005/06/24 04:38:02 UTC

Modified SVG images

We're trying to create what is essentially a filter for SVG  
documents.  In order to make them look hand-sketched, I want to take  
a "normal" SVG document that describes (say) a "Create New Folder"  
button in a dialog box, and jigger around its coordinates, turn  
straight lines into hand-stroked-looking beziers, etc.  The idea is  
to produce from the one "normal" template SVG doc a set of similar  
but variant images.

We have all the math ready to transform shapes and lines this way.   
But as a starting point we did a quick XML doc format of our own.   
Now it's time to do the real thing.

So after searching around the batik sources and doc, I have an idea  
of approach, but before I get going I'd like to see if anyone has any  
advice they'd like to give me.

My thinking is that this is a ShapePainter issue.  For example, I  
could have my own variant of ShapePainter that copied its shape from  
the pristine template shape, modifying the coordinates and lines in  
the shape as needed.  I'm not yet sure how to set up a factory to  
insert my custom shape painters, but it seems like I need to create  
use a custom bridge.

This is (not at *all* surprisingly) an area that's not deeply  
documented.  So if I'm barking up the wrong tree, or if I'm *not*,  
I'd love to hear it.

Thanks in advance.

         Ken

P.S.  If you care why, you can see what's been done for larger, less  
generic portions of the work at http://napkinlaf.sf.net/

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


Re: Modified SVG images

Posted by Archie Cobbs <ar...@dellroad.org>.
Ken Arnold wrote:
> So after searching around the batik sources and doc, I have an idea  of 
> approach, but before I get going I'd like to see if anyone has any  
> advice they'd like to give me.

Heh.. be careful what you ask for :-)

A totally different approach, maybe not useful, but FWIW...

Create an XSLT tranform taking the normal SVG as input and producing your
filtered SVG. You would need to define your own custom XSLT functions,
e.g., filterpath() to take an SVG "path" attribute and filter it. Then
you can describe how SVG tags get modified in a semi-natural way.

Supposedly it's possible to plug in your own functions into the XSLT
translater but I've never done it.

We've had great success in mixing XSLT and SVG. We do it at build time
rather than runtime, but it makes it easy to do things like compose
a picture by picking out icons, filters, etc. from different input files.

Cheers,
-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

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