Graphics.DrawSVG method

Alwyn, I tested with the MonkeyBread SVG plugin as well and had better success with DrawSVG for the scaling required for my project. I had hoped to meet with Christian before one of the dinners he scheduled in the USA earlier this year, but I had work conflicts that precluded my attendance. If I am unable to implement using DrawSVG, I will revisit use of the MonkeyBread plugin.

My project does not require complex graphics. I have tested with all the images now and there are only four that do not render correctly with DrawSVG. Of those four, the B and the 8 are the only two that are critical. My partner created a new set of project images with fewer nodes. I am attaching the B and the 8 from that set. Later today - for completeness - I will post the other two images that did not render correctly. I suspect at least one has an image under the top layer that may be causing an issue. I want to examine the file again to determine if that is the case.

The inconsistencies between Mac and Windows rasterization is unfortunate; particularly in light of DrawSVG being an open source initiative.

The “additional features” I mentioned in my last post were in reference to my project. However, I did make a simple addition via the OpenAsSVG method to allow for programmatically changing the color of a single color image when the file is opened.

The B:

[code]<?xml version="1.0" encoding="UTF-8" standalone="no"?>

rdf:RDF<cc:Work
rdf:about="">dc:formatimage/svg+xml</dc:format><dc:type
rdf:resource=“http://purl.org/dc/dcmitype/StillImage” />dc:title</dc:title></cc:Work></rdf:RDF><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity=“1”
objecttolerance=“10”
gridtolerance=“10”
guidetolerance=“10”
inkscape:pageopacity=“0”
inkscape:pageshadow=“2”
inkscape:window-width=“640”
inkscape:window-height=“480”
id=“namedview12”
showgrid=“false”
units=“px”
inkscape:zoom=“0.23838384”
inkscape:cx=“55.296604”
inkscape:cy=“495”
inkscape:current-layer=“svg2” />[/code]

The 8:

[code]<?xml version="1.0" encoding="UTF-8" standalone="no"?>

rdf:RDF<cc:Work
rdf:about="">dc:formatimage/svg+xml</dc:format><dc:type
rdf:resource=“http://purl.org/dc/dcmitype/StillImage” />dc:title</dc:title></cc:Work></rdf:RDF><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity=“1”
objecttolerance=“10”
gridtolerance=“10”
guidetolerance=“10”
inkscape:pageopacity=“0”
inkscape:pageshadow=“2”
inkscape:window-width=“640”
inkscape:window-height=“480”
id=“namedview12”
showgrid=“false”
units=“px”
inkscape:zoom=“0.23838384”
inkscape:cx=“273.4322”
inkscape:cy=“495”
inkscape:current-layer=“svg2” />[/code]

Thank you for posting the sample data for testing. Some good news for you Karen, I’ve tracked down where the issue is with the B and 8 files. I hope to have it fixed in the next couple of days. Will let you know as soon as I have it fixed.

Let’s see, if time permits in the future I might revisit the Mac Win inconsistencies to look at possible solutions. Things should hopefully settle down a bit in a few months from now.

For now however my focus with the DrawSVG project is simply just to attend to show stoppers such as the B8 issue.

PS. It is very pleasing to hear that you are finding DrawSVG useful :wink:

Alwyn, wonderful to hear you were able to isolate the issue! The other two images that did not render correctly follow. Again, these are not critical to my project but are included in case they are useful. Thank you! - (Note: I tried posting this earlier and it seems to have disappeared. I am including one of the svg images here and will put the other one in a separate post.)

Jeep:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.0" width="750" height="750" id="svg2" inkscape:version="0.91 r13725" viewBox="0 0 211.66667 211.66667" sodipodi:docname="JEEP.svg"> <metadata id="metadata11"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" id="namedview9" inkscape:document-units="px" showgrid="false" inkscape:zoom="0.2148658" inkscape:cx="76.79212" inkscape:cy="137.295" inkscape:current-layer="svg2" units="px" /> <defs id="defs4" /> <path style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" d="m 52.626871,40.216667 18.778752,4.860471 -8.57795,37.957963 -20.16977,0 9.968968,-42.818434 z M 0,92.061691 l 59.581964,0 6.723256,9.258049 13.910186,-12.266899 -10.432639,-9.9524 14.837533,-13.655603 36.39832,32.866023 -15.06937,13.424169 -11.128148,-9.25805 -17.387733,14.81288 2.550203,3.93466 35.007298,0 18.31508,-30.088619 46.83096,0 0,18.284609 -35.0073,0 -19.7061,31.01446 -57.031762,0 L 46.599124,110.57779 0,110.57779 0,92.061691 Z m 27.356699,29.857179 1.622855,0 1.159181,0 1.391019,0.23154 1.391019,0.23154 1.391018,0.23155 1.159184,0.23154 1.391019,0.46292 1.159181,0.46289 1.159182,0.46289 1.159184,0.46292 1.159181,0.69436 1.159181,0.69435 0.927347,0.69435 1.159181,0.69436 0.927347,0.69435 0.927346,0.92579 0.927344,0.92581 0.927347,0.69435 0.695509,1.15725 0.927347,0.92581 0.695509,0.92581 0.463672,1.15725 0.69551,0.92581 0.463672,1.15725 0.463674,1.15725 0.69551,1.15727 0.231845,1.15725 0.231846,1.15724 0.231845,1.15727 0.231846,1.38871 0.231845,1.15725 0,1.3887 0,1.15725 -0.231845,1.38871 -0.231846,1.15727 -0.231845,1.15724 -0.231846,1.15725 -0.231845,1.15727 -0.69551,1.15725 -0.463674,1.15722 -0.463672,1.15724 -0.69551,1.15728 -0.463672,0.92578 -0.695509,0.92582 -0.927347,1.15724 -0.695509,0.92582 -0.927347,0.92581 -0.927344,0.69435 -0.927346,0.92579 -0.927347,0.69435 -1.159181,0.69435 -0.927347,0.69436 -1.159181,0.69435 -1.159181,0.69435 -1.159184,0.46292 -1.159182,0.4629 -1.159181,0.46289 -1.391019,0.46292 -1.159184,0.23154 -1.391018,0.23154 -1.391019,0.4629 -1.391019,0 -1.159181,0.23154 -1.622855,0 -1.391018,0 -1.159182,-0.23154 -1.391019,0 -1.391018,-0.46292 -1.391019,-0.23154 -1.159182,-0.23155 -1.391019,-0.46289 -1.159182,-0.46322 -1.159182,-0.46289 -1.159182,-0.46292 -1.159183,-0.69436 -1.159182,-0.69435 -1.159182,-0.69435 -0.927346,-0.69436 -1.1591818,-0.69435 -0.6955094,-0.92579 -1.1591823,-0.69435 -0.6955094,-0.92581 -0.9273455,-0.92581 -0.6955094,-1.15725 -0.6955093,-0.92581 -0.6955093,-0.92579 -0.4636731,-1.15727 -0.6955091,-1.15725 -0.4636729,-1.15725 -0.4636729,-1.15727 -0.2318365,-1.15724 -0.23183652,-1.15725 -0.46367287,-1.15727 0,-1.15725 -0.23183653,-1.38871 0,-1.15724 0,-1.38871 0.23183653,-1.15727 0,-1.38871 0.46367287,-1.15724 0.23183652,-1.15725 0.2318365,-1.15727 0.4636729,-1.15725 0.4636729,-1.15725 0.6955091,-1.15727 0.4636731,-0.92578 0.6955093,-1.15728 0.6955093,-0.92578 0.6955094,-0.92582 0.9273455,-1.15724 0.6955094,-0.69436 1.1591823,-0.92581 0.6955094,-0.92581 1.1591818,-0.69436 0.927346,-0.69435 1.159182,-0.69435 1.159182,-0.69436 1.159183,-0.69435 1.159182,-0.46289 1.159182,-0.46289 1.159182,-0.46292 1.391019,-0.4629 1.159182,-0.23154 1.391019,-0.23154 1.391018,-0.23154 1.391019,-0.23155 1.159182,0 1.391018,0 z m 0,17.35883 0.927346,0 0.695509,0 0.927347,0.23154 0.695509,0.23154 0.695509,0.46292 0.69551,0.23154 0.463672,0.4629 0.695509,0.46289 0.463672,0.46292 0.463675,0.69435 0.463672,0.46287 0.231845,0.69435 0.463672,0.69435 0.231846,0.69436 0,0.69435 0,0.92581 0,0.69436 0,0.69435 -0.231846,0.69435 -0.463672,0.69436 -0.231845,0.69435 -0.463672,0.46289 -0.463675,0.69436 -0.463672,0.46289 -0.695509,0.46292 -0.463672,0.46289 -0.69551,0.23154 -0.695509,0.4629 -0.695509,0.23154 -0.927347,0 -0.695509,0.23154 -0.927346,0 -0.695509,0 -0.695509,-0.23154 -0.927345,0 -0.69551,-0.23154 -0.695509,-0.4629 -0.695509,-0.23154 -0.69551,-0.46289 -0.463673,-0.46317 -0.463673,-0.46289 -0.463672,-0.69435 -0.463673,-0.4629 -0.231838,-0.69435 -0.463673,-0.69435 -0.231837,-0.69436 0,-0.69435 0,-0.69435 0,-0.92582 0,-0.69435 0.231837,-0.69435 0.463673,-0.69435 0.231838,-0.69436 0.463673,-0.46289 0.463672,-0.69435 0.463673,-0.46292 0.463673,-0.4629 0.69551,-0.46289 0.695509,-0.23154 0.695509,-0.46292 0.69551,-0.23154 0.927345,-0.23155 0.695509,0 0.695509,0 z m 137.710841,-17.35883 1.39102,0 1.39102,0 1.39102,0.23154 1.15918,0.23154 1.39102,0.23155 1.39102,0.23154 1.15918,0.46292 1.39102,0.46289 1.15918,0.46289 1.15919,0.46292 1.15918,0.69436 1.15918,0.69435 0.92735,0.69435 0.92734,0.69436 1.15918,0.69435 0.92735,0.92579 0.92734,0.92581 0.92735,0.69435 0.69551,1.15725 0.69551,0.92581 0.69551,0.92581 0.69551,1.15725 0.69551,0.92581 0.46367,1.15725 0.46367,1.15725 0.46368,1.15727 0.46367,1.15725 0.23184,1.15724 0.23185,1.15727 0.23184,1.38871 0,1.15725 0,1.3887 0,1.15725 0,1.38871 -0.23184,1.15727 -0.23185,1.15722 -0.23184,1.15724 -0.46367,1.15725 -0.46368,1.15727 -0.46367,1.15725 -0.46367,1.15724 -0.69551,1.15728 -0.69551,0.92578 -0.69551,0.92582 -0.69551,1.15724 -0.69551,0.92582 -0.92735,0.92581 -0.92734,0.69435 -0.92735,0.92579 -1.15918,0.69435 -0.92734,0.69435 -0.92735,0.69436 -1.15918,0.69435 -1.15918,0.69435 -1.15919,0.46292 -1.15918,0.4629 -1.39102,0.46289 -1.15918,0.46292 -1.39102,0.23154 -1.39102,0.23154 -1.15918,0.4629 -1.39102,0 -1.39102,0.23154 -1.39102,0 -1.39102,0 -1.39101,-0.23154 -1.39102,0 -1.39102,-0.4629 -1.15918,-0.23154 -1.39102,-0.23154 -1.15918,-0.46292 -1.15919,-0.46289 -1.39101,-0.4629 -1.15919,-0.46292 -1.15918,-0.69435 -0.92734,-0.69435 -1.15919,-0.69436 -1.15918,-0.69435 -0.92734,-0.69435 -0.92735,-0.92579 -0.92735,-0.69435 -0.92734,-0.92581 -0.69551,-0.92582 -0.69551,-1.15724 -0.92735,-0.92582 -0.46367,-0.92578 -0.69551,-1.15728 -0.46367,-1.15724 -0.46367,-1.15758 -0.46368,-1.15727 -0.23184,-1.15724 -0.46367,-1.15725 -0.23185,-1.15727 -0.23184,-1.15725 0,-1.38871 0,-1.15724 0,-1.38871 0,-1.15727 0.23184,-1.38871 0.23182,-1.15724 0.46367,-1.15725 0.23185,-1.15727 0.46367,-1.15725 0.46367,-1.15725 0.46368,-1.15727 0.6955,-0.92578 0.46368,-1.15728 0.92734,-0.92578 0.69551,-0.92582 0.69551,-1.15724 0.92735,-0.69436 0.92734,-0.92581 0.92735,-0.92581 0.92734,-0.69436 1.15919,-0.69435 1.15918,-0.69435 0.92735,-0.69436 1.15918,-0.69435 1.15918,-0.46289 1.39102,-0.46289 1.15918,-0.46292 1.15918,-0.4629 1.39102,-0.23154 1.15918,-0.23154 1.39102,-0.23154 1.39102,-0.23155 1.39102,0 1.39102,0 z m 0,17.35883 0.69551,0 0.92735,0 0.69551,0.23154 0.69551,0.23154 0.69551,0.46292 0.69551,0.23154 0.69551,0.4629 0.69551,0.46289 0.46367,0.46292 0.46367,0.69435 0.46367,0.4629 0.23185,0.69435 0.23185,0.69435 0.23184,0.69435 0.23185,0.69436 0,0.92581 0,0.69435 -0.23185,0.69436 -0.23184,0.69435 -0.23185,0.69435 -0.23185,0.69436 -0.46367,0.46286 -0.46367,0.69436 -0.46367,0.46289 -0.69551,0.46292 -0.69551,0.46289 -0.69551,0.23154 -0.69551,0.4629 -0.69551,0.23154 -0.69551,0 -0.92735,0.23154 -0.69551,0 -0.92734,0 -0.69551,-0.23154 -0.69551,0 -0.92735,-0.23154 -0.69551,-0.4629 -0.6955,-0.23154 -0.46368,-0.46289 -0.69551,-0.46292 -0.46367,-0.46289 -0.46367,-0.69436 -0.23185,-0.46289 -0.46367,-0.69435 -0.23185,-0.69436 -0.23184,-0.69435 -0.23185,-0.69435 0,-0.69436 0,-0.92581 0.23185,-0.69435 0.23184,-0.69436 0.23185,-0.69435 0.46367,-0.69435 0.23185,-0.46289 0.46367,-0.69436 0.46367,-0.46292 0.69551,-0.46289 0.46368,-0.46289 0.6955,-0.23155 0.69551,-0.46292 0.92735,-0.23154 0.69551,-0.23154 0.69551,0 0.92734,0 z m 24.8065,-64.343379 0,50.224879 21.79263,-0.46292 0,-49.530499 -21.79263,-0.23154 z" id="path7" inkscape:connector-curvature="0" /> </svg>

Alwyn, the final image:

Phone:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.0" width="750" height="750" id="svg2" inkscape:version="0.91 r13725" viewBox="0 0 211.66667 211.66667" sodipodi:docname="PHONE.svg"> <metadata id="metadata11"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" id="namedview9" inkscape:document-units="px" showgrid="false" inkscape:zoom="0.2148658" inkscape:cx="76.79212" inkscape:cy="137.295" inkscape:current-layer="svg2" units="px" /> <defs id="defs4" /> <path style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" d="m 64.776258,38.561686 1.926433,0 1.204019,0.242516 0.963217,0.484832 0.963213,0.484861 0.240814,1.212095 0,1.212095 -0.722412,1.939386 -0.722412,2.181788 -3.130452,5.818101 -3.612059,5.57567 -3.371254,5.818101 -3.612059,6.060531 -3.371254,5.575671 -3.371257,5.818105 -3.371254,5.8181 -3.612059,5.57567 -0.722412,1.93938 -0.722412,1.69693 -1.204019,1.45453 -0.963217,0.96969 -1.204018,0.72726 -1.926434,0.969692 -1.926439,0.24252 -2.648842,0 -2.889647,0 -3.130452,-0.485032 -3.130452,-0.72726 -3.371255,-0.9697 -1.685627,-0.72726 -1.685628,-1.2121 -1.926431,-1.45452 -1.685628,-1.21212 L 8.1873339,91.651858 6.2609022,89.470068 4.0936668,87.288278 2.1672354,84.379228 1.6856276,82.439868 0.72241181,80.258088 0.48160778,77.833867 0,75.652079 0,72.985459 0,70.561241 0.24080488,68.137022 0.48160977,65.712833 1.4448236,63.288615 2.1672354,60.864396 3.371255,58.440207 l 1.2040199,-2.181788 1.9264314,-2.424218 1.9264314,-2.66662 2.6488433,-2.181788 2.889647,-2.181788 1.685628,-0.727263 1.685627,-0.727262 2.40804,-0.727263 2.408039,-0.727263 5.538492,-0.969693 6.260901,-0.969693 6.983313,-0.727262 7.705728,-0.969665 7.705725,-0.969693 8.428137,-0.727262 z m 82.114142,0 -1.92643,0 -1.20402,0.242516 -0.96322,0.484832 -0.96321,0.484861 -0.24081,1.212095 0,1.212095 0.72241,1.939386 0.72241,2.181788 3.13045,5.818101 3.61206,5.57567 3.37125,5.818101 3.61206,6.060531 3.37126,5.575671 3.61206,5.818105 3.13045,5.8181 3.61206,5.57567 0.72241,1.93938 0.72241,1.69693 1.20402,1.45453 0.96322,0.96969 1.20402,0.72726 1.92643,0.969692 1.92643,0.24252 2.64884,0 2.88965,0 3.13045,-0.484862 3.13045,-0.72726 3.37127,-0.9697 1.68562,-0.72726 1.68563,-1.21209 1.92643,-1.45453 1.68563,-1.21212 2.16723,-1.93936 1.92644,-2.18179 2.16723,-2.18179 1.92643,-2.90905 0.48161,-1.93935 0.96322,-2.18179 0.24081,-2.424219 0.48161,-2.181788 0,-2.66662 0,-2.424218 -0.24082,-2.424219 -0.24081,-2.424189 -0.9632,-2.424219 -0.72242,-2.424218 -1.20401,-2.424189 -1.20403,-2.181788 -1.92643,-2.424219 -1.92643,-2.66662 -2.64884,-2.181787 -2.88965,-2.181788 -1.68563,-0.727263 -1.68562,-0.727262 -2.40804,-0.727263 -2.40804,-0.727263 -5.53849,-0.969693 -6.26091,-0.969693 -6.98331,-0.727262 -7.70573,-0.969665 -7.70572,-0.969693 -8.42814,-0.727262 z m -72.722789,24.242096 -1.444823,-0.242516 -0.963214,-0.727263 -0.722412,-0.48486 -0.722412,-0.484833 -0.240813,-1.212094 0,-0.969693 0.240813,-1.454526 0.481607,-1.696927 0.481607,-1.454525 0.48161,-1.696955 0.722412,-1.939358 0.722411,-1.696956 1.204019,-1.454525 0.722412,-1.696955 0.963217,-1.696927 0.722411,-1.454526 0.481607,-1.212123 1.204019,-1.212095 0.722412,-0.969693 0.963217,-0.969664 1.204018,-0.727263 1.20403,-0.484861 1.204011,-0.484832 1.204018,-0.727263 3.852864,-0.242516 4.816078,-0.242516 5.056883,-0.242516 5.779297,0.242516 5.05688,0 5.05688,0.484832 4.57528,0.242516 3.61206,0.727263 1.92643,0.484861 1.68563,0.484832 1.44482,0.969693 0.96322,0.969664 1.20402,0.727263 0.72241,1.212123 0.72241,0.969665 0.24081,1.212123 0.72241,1.696927 0.72242,1.212124 0.96321,1.696927 0.72241,1.696955 0.72241,1.212095 0.48161,1.696956 0.72241,1.454525 0.72242,1.696956 0.96321,2.181788 0.24081,1.454525 -0.24081,1.212095 -0.24081,0.727262 -0.96322,0.484832 -0.96322,0.484861 -1.20401,0 -1.20402,0.242517 -7.70573,0 -7.46492,0 -7.70573,0 -6.98331,0 -7.464926,0 -7.705725,0 -7.464923,0 -7.224118,0 z m -11.317784,13.57556 0.240814,-0.727263 0.481607,-0.969693 0.240813,-0.727263 0.48159,-0.484832 0.481607,-0.727262 0.963216,-0.484833 0.722412,-0.242516 0.722412,-0.242516 1.926431,0 2.167235,0 1.926433,0 2.167236,0 1.92643,0 2.167236,0 1.92643,-0.242517 2.167236,0 0.963216,0.242517 0.722412,0.484832 0.722412,0.484832 0.481607,0.969693 0.722412,0.727263 0.240813,0.727262 0,1.212095 0,0.727263 0,0.969693 0,0.727262 0,0.727259 0,0.9697 0,0.72726 0,0.96966 0,0.72727 0,0.72726 4.575276,0 4.334471,0 4.334466,0 4.33448,0 4.09366,0 4.57528,0 4.33447,0 4.33447,0 0,-0.72726 0,-0.72727 0,-0.96966 0,-0.72726 0,-0.9697 0,-0.727259 0,-0.969693 0,-0.969664 0,-0.727263 0.24081,-1.212123 0.48161,-0.727263 0.48161,-0.727262 0.48161,-0.727263 0.72241,-0.484832 0.96319,-0.242516 0.72242,0 1.68562,0 2.40804,0 1.92644,0 2.40803,0 2.16724,0 2.40804,0 1.92643,0 2.16723,0 0.96322,0.242516 0.72241,0.484832 0.72241,0.727263 0.96322,0.484861 0.72241,0.484832 0.48161,0.727262 0.24081,0.969693 0.4816,0.484804 4.57528,9.939275 4.81608,9.93925 4.57527,9.696842 4.81608,9.93925 5.05688,9.93924 4.57528,9.93928 4.81608,9.93924 4.81607,9.69685 0,2.66662 0,2.18179 0,2.18178 0,1.69696 -0.24081,2.18179 0,1.93935 0,2.18179 0.24081,2.18179 0,1.2121 -0.24081,0.48486 -0.24081,0.72726 -0.24082,0.72726 -0.4816,0.24252 -0.72242,0.24251 -0.72241,0 -0.72241,0.24252 -3.13045,0 -3.37126,0 -4.33447,0 -4.57527,0 -4.81608,0 -4.33447,0 -3.61206,0 -3.37125,0 -0.96322,0 -1.20402,0 -0.72241,-0.24252 -0.72241,-0.48486 -0.48161,-0.72726 -0.48161,-0.72726 -0.24081,-0.72726 -0.24082,-1.2121 0,-1.69696 0,-1.45452 0,-1.69693 0,-1.69695 0,-1.69696 0.24082,-1.45452 0,-1.69693 -0.24082,-1.69696 -10.83617,0 -10.59538,0 -10.83618,0 -10.59537,0 -10.836175,0 -11.076982,0 -10.595372,0 -10.836178,0 0,1.45453 0,1.69695 0,1.45453 0,1.69693 0,1.69695 0,1.69696 0,1.21209 0,1.69696 -0.240813,0.96966 -0.240813,0.9697 -0.240814,0.72726 -0.481607,0.48483 -0.48161,0.72726 -0.722411,0.48486 -0.722412,0 -0.722412,0.24252 -3.852861,0 -3.852864,0 -4.093666,0 -3.852864,0 -4.093666,0 -3.852864,0 -3.852864,0 -4.093666,0 -0.963216,-0.24252 -0.963215,-0.24251 -0.722412,-0.48486 -0.963139,-0.96955 -0.481608,-0.72727 -0.240804,-1.21212 -0.240804,-0.96966 0,-1.45453 0,-1.93939 0,-1.93935 0,-1.45453 0,-1.93936 0,-1.93938 -0.240805,-1.69693 0,-1.93938 0.240805,-1.93936 5.056882,-9.69685 5.538493,-10.18167 5.297684,-9.69682 5.056883,-10.18167 5.297687,-9.69685 5.53849,-9.939252 5.297688,-9.69684 5.056882,-10.181676 z m 40.695863,28.363248 3.13045,0 3.61206,0.24251 3.37126,0.48483 3.13045,0.48486 2.88965,0.72727 2.88964,0.72726 2.88965,0.96966 2.16723,0.9697 2.40805,1.45452 1.92643,0.9697 1.92643,1.69692 1.20402,1.45453 1.20402,1.45452 0.72241,1.69696 0.48161,1.69695 0.24081,1.69693 -0.24081,1.45453 -0.48161,1.93938 -0.72241,1.69693 -1.20402,1.45452 -1.20402,1.45453 -1.92643,1.45453 -1.92643,1.45452 -2.40805,0.96969 -2.16723,1.2121 -2.88965,0.96969 -2.88964,0.96969 -2.88965,0.48484 -3.13045,0.48483 -3.37126,0.48486 -3.61206,0.24252 -3.13045,0 -3.37125,0 -3.612063,-0.24252 -3.371254,-0.48486 -3.130452,-0.48483 -2.889647,-0.48486 -2.889647,-0.96967 -2.889648,-0.96969 -2.167235,-1.2121 -2.408038,-0.96969 -1.926433,-1.45452 -1.926431,-1.45453 -1.204018,-1.45453 -1.204022,-1.45452 -0.722412,-1.69696 -0.722411,-1.93935 -0.240814,-1.45453 0.240814,-1.69695 0.722411,-1.69693 0.722412,-1.69696 1.204022,-1.45452 1.204018,-1.45453 1.926431,-1.69695 1.926433,-0.96967 2.408038,-1.45452 2.167235,-0.9697 2.889648,-0.96969 2.889647,-0.72726 2.889647,-0.72726 3.130452,-0.48484 3.371254,-0.48483 3.612063,-0.24251 3.37125,0 z" id="path7" inkscape:connector-curvature="0" /> </svg>

Great stuff Karen.

I’ve added these files to the library of test files.

MonkeyBread has a SVG plugin?

Yes, the ImageMagick plugin. More info about it on this page…

http://www.monkeybreadsoftware.de/xojo/plugins.shtml

Ah, OK, thanks Alwyn!

Hi Karen,

Your 8 figure is really turning out to be a tricky path to fix. It might be that I’ve reached the limit to where I can push the Xojo 2D canvas rendering.

The biggest problem I’m having is that I have no low level control over the “fill-rule” algorithm used for rendering, which is “oddeven” for your images. I’ve been using, although functional, very questionable workarounds to achieved the correct effects.

Given all this there are however plausible workarounds to the problem. If you just break up your images in simpler shapes instead of having it as a single path instruction, it renders correctly. Below is the SVG I’ve created for your 8 figure which renders correctly when using two paths.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Creator: CorelDRAW X7 -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xml:space="preserve"
   width="750"
   height="750"
   version="1.1"
   style="clip-rule:evenodd;fill-rule:evenodd;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
   viewBox="0 0 8333.3333 8333.3333"
   id="svg2"
   inkscape:version="0.48.4 r9939"
   sodipodi:docname="8_fix.svg"
   inkscape:export-filename="test_00043.png"
   inkscape:export-xdpi="11.250001"
   inkscape:export-ydpi="11.250001"><metadata
     id="metadata14"><rdf:RDF><cc:Work
         rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:window-width="1280"
     inkscape:window-height="962"
     id="namedview12"
     showgrid="false"
     units="px"
     inkscape:zoom="0.67425132"
     inkscape:cx="545.1926"
     inkscape:cy="408.85079"
     inkscape:current-layer="svg2"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1" /><defs
     id="defs4"><style
       type="text/css"
       id="style6">
    .fil0 {fill:black}
   </style></defs><path
     style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
     d="m 4166.8401,3129.3187 c -1840.9798,0 -3333.50683,1164.9305 -3333.50683,2602.0074 0,1437.0767 1492.52703,2602.0072 3333.50683,2602.0072 1840.9796,0 3333.1598,-1164.9305 3333.1598,-2602.0072 0,-1437.0769 -1492.1802,-2602.0074 -3333.1598,-2602.0074 z m -41.2744,1685.4773 c 900.0344,0 1629.8146,415.6797 1629.8146,928.5986 0,512.9191 -729.7802,928.9436 -1629.8146,928.9436 -900.0344,0 -1629.8146,-416.0245 -1629.8146,-928.9436 0,-512.9189 729.7802,-928.5986 1629.8146,-928.5986 z"
     id="path3021"
     inkscape:connector-curvature="0" /><path
     style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
     d="M 4191.5624,-1.727075e-6 C 2509.6798,-1.727075e-6 1145.9353,1069.2344 1145.9353,2388.0763 c 0,1318.842 1363.7445,2388.0763 3045.6271,2388.0763 1681.8827,0 3045.2804,-1069.2343 3045.2804,-2388.0763 C 7236.8428,1069.2344 5873.4451,-1.7270746e-6 4191.5624,-1.7270746e-6 z M 4133.6397,1679.8427 c 768.2112,0 1391.1867,320.9091 1391.1867,716.5618 0,395.6525 -622.9755,716.2146 -1391.1867,716.2146 -768.2112,0 -1390.8399,-320.5621 -1390.8399,-716.2146 0,-395.6527 622.6287,-716.5618 1390.8399,-716.5618 z"
     id="path3021-0"
     inkscape:connector-curvature="0" /></svg>

I trust this is a suitable solution for your problem at this point in time?

The only way I forsee that a proper SVG implementation can be achieved is by using platform specific declares, or doing the rendering with OpenGL. Doing it with OpenGL obviously defies the purposes of having easy access to the DrawSVG routine from the canvas object.

Perhaps Xojo could eventually expose more low level routines in their Canvas 2D context to provide for more fine grained control over rendering?

The basic problem is that Xojo’s graphics capabilities (vector AND Raster) need an overhaul to be brought into this century… But I am not optimistic that will happen before I retire, given how much else they need to do.

  • Karen

[quote=275490:@Alwyn Bester]Alwyn Bester yesterday Beta Testers, Xojo Pro Johannesburg, South Africa

I trust this is a suitable solution for your problem at this point in time?[/quote]

Alwyn, Your workaround with the 8 does take care of my specific problem. It is truly unfortunate that Xojo’s graphics capabilities limit implementation of the DrawSVG method. Thank you again for your assistance with the issue I encountered and for the guidance on a workaround.

Much appreciated!

Karen

[quote=228787:@Sam Rowlands]It’s funny how these things work out… I just wrote an SVG to PDF converter today as I wanted to use some SVG vectors in my Xojo application.

Once I finish my current project, I’ll tart it up and stick it out there too.[/quote]

Hi Sam, how did it go: Did you finnish your SVG to PDF converter?

Yes indeed, you can download it from the Mac App Store.
https://itunes.apple.com/gb/app/svg-converter-convert-svg/id1075707641?mt=12

Looks really good and seems to do it work :slight_smile:

I misunderstood your first post, I guess: I thought you where developing a class for Xojo to sell or share.

:slight_smile:

[quote=313096:@Dan Berghult]Looks really good and seems to do it work :slight_smile:
I misunderstood your first post, I guess: I thought you where developing a class for Xojo to sell or share.
:-)[/quote]
Sorry no, it’s a hacked job that uses the HTMLViewer (basically webkit) and a bunch of Apple declares to then turn the web content into PDF data, which can then be turned into PNG and such. Due to the nature it’s not really a drop in class that you can simply include in your project.

However if you’re on the Mac, you can convert it to PDF and load up the PDF within your application, which is what we actually used SVG Converter for.

Is Alwyn Bester still around?

I want to be able to quickly create Xojo pictures at various scales quickly from SVGs of chemical structures created by some open source software …

The Xojo pictures created from those SVGs by the Zoclee project pictures only shows part pf the structure, but If I open them in safari or other applications the whole molecule shows…

I don’t know if the software I am using to produce the SVGs is producing incorrect SVGs that other software knows how to deal with, or if there is an issue with the Zoclee code.

So Alwyn if you are still here and still maintaining the project here is the SVG content… I would really appreciate it if this could be made to work!

It is really shame that Xojo do snopt provide built in rendering of SVG pictures (even if not creation) because support for an Xplatform (even the WEB!) standard vector format that other apps understand and use is badly needed in Xojo IMO!

Thanks,

  • karen
<?xml version="1.0"?>
<svg version="1.1" id="topsvg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:cml="http://www.xml-cml.org/schema" x="0" y="0" width="200px" height="200px" viewBox="0 0 100 100">
<title> - Open Babel Depiction</title>
<g transform="translate(0,0)">
<svg width="100" height="100" x="0" y="0" viewBox="0 0 287.846 200"
font-family="sans-serif" stroke="rgb(76,76,76)" stroke-width="2"  stroke-linecap="round">
<line x1="109.3" y1="60.0" x2="74.6" y2="40.0" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="76.1" y1="42.6" x2="52.8" y2="56.1" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="73.1" y1="37.4" x2="49.8" y2="50.9" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="178.6" y1="100.0" x2="213.2" y2="120.0" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="216.2" y1="120.0" x2="216.2" y2="147.0" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="210.2" y1="120.0" x2="210.2" y2="147.0" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="213.2" y1="120.0" x2="236.6" y2="106.5" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="109.3" y1="60.0" x2="143.9" y2="40.0" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="118.1" y1="63.2" x2="142.3" y2="49.2" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="143.9" y1="40.0" x2="178.6" y2="60.0" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="178.6" y1="60.0" x2="178.6" y2="100.0" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="171.4" y1="66.0" x2="171.4" y2="94.0" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="178.6" y1="100.0" x2="143.9" y2="120.0" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="143.9" y1="120.0" x2="109.3" y2="100.0" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="142.3" y1="110.8" x2="118.1" y2="96.8" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<line x1="109.3" y1="100.0" x2="109.3" y2="60.0" stroke="rgb(76,76,76)"  stroke-width="2.0"/>
<text x="34.000000" y="68.000000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
<text x="207.205081" y="168.000000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
<text x="241.846097" y="108.000000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >OH</text>
</svg>
</g>
<text font-size="18.000000" fill ="gray" font-family="sans-serif"
x="10.000000" y="20.000000" ></text>
</svg>

We just worked on a project where we had to use GMImageMBS to read SVG’s. Dunno if plugins are an option for you but that’s what helped us.

Actually looking at what I posted I found the issue…Although I don’t know the SVG standard I saw the Width and Height were were defined as 200 each and then there was a “viewbox” statement
viewBox=“0 0 100 100” I assumed the was viewBox=“X Y Width Height”
do I edited teh file so that teh last 2 numbers were 200 and got the whole molecule to display!

I assume that is how browesers implement panning and zooming SVG’s And it should not be hard to add the capabilities to Alwyn’s implement those functions on teh desktop

Thanks Bob I did consoler that.

The MBS complete plugins I have are from 2014 and the GraphicsMagic one from back then did not seem to work with 2018R3, so I went to Alwyn’s code…

While chemical structures can be complex, the drawing primitives they require should be simple… so if Alwyn code is fast enough, I think I may have my solution!

  • Karen