B4i Library iSVG (Scalable Vectors Graphics)

Erel

Administrator
Staff member
Licensed User
upload_2015-11-29_17-25-55.png

This library is based on SVGKit open source project: https://github.com/SVGKit/SVGKit
It allows displaying SVG graphics.

There are two steps:
1. Initialize the SVG object with the SVG file.
2. Export the SVG to a Bitmap based on the target size.

Repeat step #2 whenever the ImageView size changes.

See the attached example project.
If you are using a local Mac builder then you should download this zip file and copy its content to the Mac Libs folder: www.b4x.com/b4i/files/SVGMac.zip

The library xml file is attached.

SVGKit license: https://raw.githubusercontent.com/SVGKit/SVGKit/2.x/LICENSE
 

Attachments

sorex

Expert
Licensed User
Thanks Erel!

This comes right on time to test it with my packer.
I'll give it a try tonight (don't have an iPhone here at work)
 

sorex

Expert
Licensed User
I had to rewrite several routine because

it didn't expose the width/height of the read in svg
it doesn't support bytestream

but that was the "easy" part.

unfortunately it doesn't display my files for some unknown reason altho they display fine in InkScape, IE, other svg tools and on Android.
I sent an example to the SVGKit author maybe it's a bug in their parser.

I'll keep you posted.
 

sorex

Expert
Licensed User
They suggest to set a breakpoint and see where it goes wrong.

But that's something I can't do, right?
 

sorex

Expert
Licensed User
with several SVG files that have been optimized on shorting path d parameters but I know part of the cause.

it's their parser that freaks out on certain occasions like these...

translate("-300-300") fails in SVGKit, works in all other displayers
translate("-300 -300") works

also a problem that it draws outside of the actual working area so it seems that it didn't draw anything untill you change the M(ove) parameters
then it suddenly shows something.

now that I know this I can manually edit the stuff so that it displays right.
 

LucianDesign

Member
Licensed User
Is there a chance to update this library to use SVGKit 2.0 (which is a major release) ... this current iSVG library is based on SVGKit 1.2 from 2014.
 

sorex

Expert
Licensed User
@Erel,

had there been an update of this library lately?

when I compile this project I'm now getting this compile error...

ld: framework not found SVGKit for architecture armv7
 

sorex

Expert
Licensed User
no, I'm using the remote builder.

last compilation was in januar then it worked fine.
 

sorex

Expert
Licensed User
now it works fine again.

thanks a lot for this fast intervention!
 

Grant Fullen

Member
Licensed User
I'm getting the following error message
library not found for -lSVGKit-iOS.1.2.0
That's from trying to compile the example. I placed the xml file in the Libs folder for the local mac builder. It shows up as
  • iSVG: 1.20
  • libiSVG, size=83312, modified=08/17/2017 18:56:48
In the local mac builder test web page
 
Top