Replies: 12 comments 5 replies
-
I'm not very familiar with modularity in Java (this library predates it by quite a bit). I've updated the source to use Java 9 and included a module-info.java file. Please check this out and let me know if it works and the module exports are set up correctly. |
Beta Was this translation helpful? Give feedback.
-
It uses Maven to build, so if you have Maven installed you can build it that way. I also use the Netbeans IDE, so it should be buildable if you import it into that. Although most modern IDEs should be able to handle Maven projects. |
Beta Was this translation helpful? Give feedback.
-
Hmmmm |
Beta Was this translation helpful? Give feedback.
-
You might want to try My development machine runs Windows 10. |
Beta Was this translation helpful? Give feedback.
-
OK, got it working now... the 'corruption' of the published jar was a red herring. I can publish to mavenLocal and use within my project. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Cool, not my renderer at fault. What I mean by 2 is that given a diagram composed go java objects (well, kotlin but same difference) I want to convert that to svg.
Which is obviously a poor solution on many levels. I am hoping I can use the code in salamander to manipulate higher level concepts that strings. I looked at Batik (though it is not modular and is way more complicated than salamander) but it did subclass Graphics2D to output direct to an SVG format. That would be way cool, because I could reuse the paint() method in my code. But I can live without that. |
Beta Was this translation helpful? Give feedback.
-
I think I started writing a SVG Salamander exporter a long time ago, but it never was completed. You could create your own Batik style exporter by overriding Graphics2D - I did that once and discovered overriding it was surprisingly easy. The trouble with that approach is that you will only be receiving the final write-to-screen events which may or may not be what you want. Instead you could try walking the tree of nodes in the SVGDiagram and writing them out which should give you a more accurate representation. When I first designed SVGSalamander I made the mistake of assuming I could represent each of the tags with a plain Java object. Then I realized that in SVG so many of the different fields could take on multiple of types. If I were to redo it, I'd make the core structure more closely resemble an XML document which would solve a lot of the problems that it has. |
Beta Was this translation helpful? Give feedback.
-
Hi there, I have been looking at your code and thinking about possibilities. How feasible would it be to created a (shallow) tree of SVGElement programatically, then unparse these to an xml document? My existing code already does some of this, but without using the intermediate representation. Instead of writing the xml for a rectangle could I create a Rect SVGElement and insert it into parent? Would the parent then have enough information for me to walk the tree and render a valid svg/xml file? Maybe you already have this code and I have not spotted it? Thanks Phill |
Beta Was this translation helpful? Give feedback.
-
I've not actually used this code myself for several years, so my memory is a bit fuzzy. IIRC, the document node structure should follow that of an svg document closely. All references are stored in a table stored in one of the root elements (SVGUniverse, I think?) so you can look there for your definitions of symbols and fonts. You probably don't even need to create a copy of the tree first. Just create a class that recursively walks each node and creates XML for it. You can manually build the tree by creating elements and adding them. Make sure to call the build() method so that the internal state of the node is updated to reflect the XML attribute values. |
Beta Was this translation helpful? Give feedback.
-
HI there, thanks for that - I can see how that could be done. I have decided, however, to have a crack at implementing an svg renderer in Kotlin. I have done the easy bits (architecture, basic shapes, colours, solid fills, opacities). I am using the the spec and your code as references and aiming for a minimum-spec (static, standalone) implementation as that is all I need. My next task is to understand the text rendering part..... that looks like a bunch of fun. Thanks for your help, and for your code - it is aiding my understanding immensely. Phill |
Beta Was this translation helpful? Give feedback.
-
Hi there,
the descriptions make this sound like a great match for my needs, but I do not see a module info.java file here.... I am forced by circumstance only to depend upon modular jars so the lack is a blocker for me.
Are you planning on 'going modular'? If not I might see what I might achieve, but I am likely to get the exposure wrong which could have unintended consequences.
Beta Was this translation helpful? Give feedback.
All reactions