SVG image wont render

Joe_L

Member
Licensed User
Longtime User
The following SVG image throws numberformat exception.

B4X:
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!--Generated by ucancode v1.0-->

<svg width="45.86mm"  height="45.51mm" shape-rendering="geometricPrecision" xmlns:a="http://www.adobe.com/svg10-extensions"  xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink">
<path    style="fill:#b41464;fill-rule:nonzero;fill-opacity:1;stroke:none;" d="   M 10.60 19.77    L 21.45 10.44    L 22.33 9.87    L 53.86 69.94    L 35.42 29.38    L 56.06 68.39    L 55.81 67.57    L 53.96 67.57    L 53.19 68.39  z " /> 
<path    style="fill:none;stroke:#000000;stroke-width:0.71px;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;"    d="   M 12.83 68.74    L 52.83 18.60    L 52.94 68.42    L 53.04 68.24    L 53.22 68.10    L 53.43 67.93    L 53.61 67.82    L 53.89 67.82    L 54.21 67.75    L 54.50 67.82    L 54.99 68.00    L 55.38 68.24    L 55.56 68.67    L 55.56 68.92    L 55.56 69.09    L 55.45 69.38    L 55.38 69.52    L 55.17 69.70    L 54.99 69.77    L 54.78 69.87    L 54.50 69.94    L 54.21 69.94    L 53.89 69.94    L 53.61 69.87    L 53.33 69.70  " /> 
</svg>

If appears to be objecting to width="45.86mm" height="45.51mm" if I manually edit out the mm to give width="45.86" height="45.51" it draws ok (except for leaving the scaling undefined). Is this a bug in the library or in the underlying android lib?

Unfortunately I've got to handle 1000's of images like this.
 

agraham

Expert
Licensed User
Longtime User
As I stated in the first post of the SVG library thread "The library implements what it calls "a subset of the SVG Basic 1.1 specification". In this case the only suffix accepted is "px".

There is no underlying Android library, the implementation uses Canvas and draws on it.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…