{"id":20510178,"url":"https://github.com/grmartin/svg2fxml-extended","last_synced_at":"2026-06-06T11:31:25.527Z","repository":{"id":31556085,"uuid":"35120775","full_name":"grmartin/SVG2FXML-Extended","owner":"grmartin","description":"An extended implementation of the SVG2FXML converter. Intended for drop-in replacement along side it.","archived":false,"fork":false,"pushed_at":"2015-05-05T21:50:57.000Z","size":232,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T22:31:25.578Z","etag":null,"topics":["fxml","java","svg","svg-icons"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grmartin.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.MD","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-05T19:55:36.000Z","updated_at":"2022-10-08T04:19:30.000Z","dependencies_parsed_at":"2022-09-05T18:12:21.730Z","dependency_job_id":null,"html_url":"https://github.com/grmartin/SVG2FXML-Extended","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/grmartin/SVG2FXML-Extended","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grmartin%2FSVG2FXML-Extended","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grmartin%2FSVG2FXML-Extended/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grmartin%2FSVG2FXML-Extended/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grmartin%2FSVG2FXML-Extended/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grmartin","download_url":"https://codeload.github.com/grmartin/SVG2FXML-Extended/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grmartin%2FSVG2FXML-Extended/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33981122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fxml","java","svg","svg-icons"],"created_at":"2024-11-15T20:28:27.244Z","updated_at":"2026-06-06T11:31:25.509Z","avatar_url":"https://github.com/grmartin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SVG2FXML Extended\n\nI know, not a creative name... but lets move past it.\n\nThis project is intended as a light-wrapper around [Tom Schindl](https://github.com/tomsontom)'s SVG2FXML Conversion JAR (documented on his [blog](http://tomsondev.bestsolution.at/2012/01/16/svg-for-fxml-conversion/); a part of his [e-fx-eclipse](https://github.com/tomsontom/e-fx-clipse) codebase), simply embedding information lost from the root tag of the input SVG document to the FXML document created by his conversion script.\n\nThis was last tested on his ```8.1-SNAPSHOT``` version, which should be included in binary form within this project. However, it was obtained from his [nightly builds](http://downloads.efxclipse.org/downloads/nightly/dist/) from the e-fx-clipse server.\n\n## License Information\n\nThe e-fx-clipse codebase is under the [EPLv1](http://www.eclipse.org/legal/epl-v10.html). While the Application code provided here remains under the EPLv1, The code within the JavaFX Support Sub-project is Public Domain. See ```LICENSE.MD``` for more details.\n\n## Project\n\nThe project is configured to be built with Gradle. The main directory of the repository contains all one should need to simply build this project, as well as its public domain support project. One command should do the whole thing.\n\t\n\t$ gradlew build\n\t\nIf all is good from the build process, you will have a build folder with the ```SVG2FXML-Extended-0.81.jar``` within it. This application can be run via the ```java -jar``` command easily, provided you include the original SVG2FXML Jar along side it.\n\n### A creation story and a real world usage example.\n\nThis was built simply to be used within another project of mine, however I found a few odd things. There appears to be mixed information on how to do this online within JavaFX. All I wanted to do was use some SVG Icons I had as button icons.\n\n![Button icon Example](docs/ButtonIcons.png)\n\nAfter stumbling across Tom's blog, I started playing with his tool. The conversion worked flawlessly, and i was able to load up the Nodes from his FXML document easily, and was even able to use the following to convert the FXML SVGPath to an Image for an ImageView.\n\n    WritableImage img = new WritableImage(1024, 1024);\n    SnapshotParameters params = new SnapshotParameters();\n    params.setFill(new Color(0, 0, 0, 0));\n    params.setDepthBuffer(false);\n\n    result.snapshot(params, img);\n    ImageView iv = new ImageView();\n    iv.setFitWidth(16.0);\n    iv.setFitHeight(16.0);\n    iv.setImage(img);\n    button.setGraphic(iv);\n               \nHowever, I HATED that I had to hard code the SVG sizes, and in-fact my assumptions were incorrect. So my first step was to try and parse out sizes, however id have to first Parse the SVGPath data, I was no stranger to that, however i found a couple of my images didnt start and end within their bounds, some were beyond and others started at say 300x250 (TL) and ended at 507x980 (BR).\n\nSo I decided I had to embed the information from the SVG root tag's attributes. Thus this main project was born, a method to wrap Tom's application and inject my own data in to the process.\n\nHowever it is fair to say, most of the time, FXML doesn't like one embedding data in to their \"view\" layer. After a lot of struggle, I found a way to embed this metadata, allowing me to have a single file represent this information. Create my own invisible tag. Read it out, and that is the result of the ```JavaFX Support``` sub-project.\n\nAfter this wrapper was created, and some minor visual adjustments to make these images clearer at my desired 16x16 size, the code looks like this:\n\n    int w = DEFAULT_WIDTH;\n    int h = DEFAULT_HEIGHT;\n\n    Data dataElement = (Data) result.lookup(\"#svg_root_element\");\n\n    if (dataElement != null) {\n        String width = dataElement.get(\"width\");\n        String height = dataElement.get(\"height\");\n\n        if (!StringUtils.isEmpty(width)) {\n            w = parse(width, w);\n        }\n        if (!StringUtils.isEmpty(height)) {\n            h = parse(height, h);\n        }\n    }\n\n    BoxBlur boxBlur = new BoxBlur();\n    boxBlur.setWidth(10);\n    boxBlur.setHeight(10);\n    boxBlur.setIterations(1);\n\n    result.setEffect(boxBlur);\n    WritableImage img = new WritableImage(w, h);\n    SnapshotParameters params = new SnapshotParameters();\n    params.setFill(new Color(0, 0, 0, 0));\n    params.setDepthBuffer(false);\n\n    result.snapshot(params, img);\n    ImageView iv = new ImageView();\n    iv.setFitWidth(16.0);\n    iv.setFitHeight(16.0);\n    iv.setImage(img);\n    button.setGraphic(iv);\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrmartin%2Fsvg2fxml-extended","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrmartin%2Fsvg2fxml-extended","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrmartin%2Fsvg2fxml-extended/lists"}