Re: SVG to Image Map
Christoffer Dam Bruun <[email protected]>
| Newsgroups | gmane.text.xml.batik.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, I investigated the same feature since it would be very useful. I found the following attempts by other people http://www.mail-archive.com/[email protected]/msg01764.html http://mail-archives.apache.org/mod_mbox/xmlgraphics-batik-users/200303.mbox/%[email protected]%3E http://blog.jeroenreijn.com/2006/10/batik-and-imagemaps.html Best regards Christoffer Bruun On 05-07-2011 12:25, Pascal Burkhardt wrote: > Hi, > > i just implement a java tool to generating an image map from a svg. > > At first i get my map.svg file over an InputStream and parst it to an > Document. > > String parser = > XMLResourceDescriptor.getXMLParserClassName(); > SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); > Document doc = f.createDocument(null, input); > > With this document I get the dom element by id and the attribute "d" > as a String. > > For example: > > M479.231,243.809l0.545,0.476l1.067,0.581l0.587-0.18 > l0.434-1.184l0.607-1.417l0.581-0.793l0.8-0.613l0.883,0.466l4.662,8.69l3.559,3.765l1.602,3.498l0.756,3.151l1.612,0.465 > l2.537,1.66l0.894,0.063l1.539,1.596l-0.813,2.475l-0.683,1.712l-1.809,1.513l-0.011,0.254l0.523,0.158l0.244,0.011l0.147,0.35 > l-0.052,0.359l-0.394,0.697l-1.585,0.55l-1.264-0.264l-7.052-1.999l-3.79-1.205l-0.753-1.85l-0.522,0.158l-0.719,0.327 > l-1.639,0.771l-0.095,0.096l-0.032,0.17l0.232,3.224l-2.004-0.147l-2.944-2.886l-1.898,0.951l-0.989-1.301l-3.367-0.719 > l-1.189,0.084l-0.21,0.054l-1.575,0.592l-2.222,1.396l-0.084,0.645l0.544,0.117l-0.649,0.063l-1.973-0.127l-2.062-1.29l-0.233-0.19 > l-0.17-0.772l0.994-0.539l0.503-0.507l0.604-1.048l-0.402-0.697l-0.455-0.528v-1.522l0.284-0.55l0.455-0.676l0.419-0.308 > l2.247-2.929l-1.582-1.121l-1.622,0.317l-0.054-0.613l0.423-6.153l0.043-0.401l1.671-1.12l0.518-0.148l0.498,0.285l1.243,0.539 > l0.501,0.096l1.095,0.084l0.063-0.38l-0.021-0.138l-0.104-0.148l-0.365-0.286l-0.518-0.602l-0.138-0.307l0.031-0.105l1.126-2.231 > l5.6-0.169l1.146,0.232l0.908,0.053l0.725,0.021l0.434-0.138l0.387-0.211l0.465-0.359l0.662-0.857L479.231,243.809z > > > Now i parse this string with a PathParser and PathHandler. This works > nice and i get an output like this: > movetoRel: 479.231, 243.809 > linetoRel: 0.545, 0.476 > linetoRel: 1.067, 0.581 > linetoRel: 0.587, -0.18 > linetoRel: 0.434, -1.184 > linetoRel: 0.607, -1.417 > linetoRel: 0.581, -0.793 > linetoRel: 0.8, -0.613 > ..... > > The problem, which I have is, that i need absolute coordinates for the > image map and i don't know how to convert > these relative coordinates to absolute. > > Maybe someone have a solution for me :) > > Thanks for help ;) > > Greets, > Pascal B. > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] >