ditaa is a small command-line utility that can convert diagrams drawn using ascii art ('drawings' that contain characters that resemble lines like | / - ), into proper bitmap graphics.
GNU Lesser General Public License v3.0
927
stars
87
forks
source link
CustomShapeDefinition to provide shapes programmatically #2
The general way to extend DITAA with new shapes is to parse and SVG file and then render this shape with SVG in the output. This is very general but requires the batik libraries to be available. In my case I needed a simple way to extend the shapes programmatically.
It turned out that this was quite easy to do in the design. I added 2 methods to the CustomShapeDefinition. A render method that could completely take over the rendering and a simpler getPath method that can provide a GeneralPath.
If the CustomShapeDefinition can provide a path, this path is used and all options work as they do for the built in types. If there is no path, the render method is called. If this returns false, the standard custom shapes are used.
[I would appreciate it if you could merge this since it seems useful to others and then I don't have to fork this project. Thanks for the good work!]
The general way to extend DITAA with new shapes is to parse and SVG file and then render this shape with SVG in the output. This is very general but requires the batik libraries to be available. In my case I needed a simple way to extend the shapes programmatically.
It turned out that this was quite easy to do in the design. I added 2 methods to the CustomShapeDefinition. A render method that could completely take over the rendering and a simpler getPath method that can provide a GeneralPath.
If the CustomShapeDefinition can provide a path, this path is used and all options work as they do for the built in types. If there is no path, the render method is called. If this returns false, the standard custom shapes are used.
[I would appreciate it if you could merge this since it seems useful to others and then I don't have to fork this project. Thanks for the good work!]
This change is![Reviewable](https://reviewable.io/review_button.svg)