Get an SVG

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Get an SVG

Post by richmond62 » Thu Mar 03, 2022 7:53 pm

Not much good when push comes to shove unless one doesn't
really mind that the imported image is NOT a scaleable vector object.
Attachments
SVG getter.livecode.zip
Stack.
(1 KiB) Downloaded 97 times
Last edited by richmond62 on Tue Jul 12, 2022 3:13 pm, edited 1 time in total.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3990
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Get a SVG

Post by bn » Fri Mar 04, 2022 8:52 am

richmond62 wrote:
Thu Mar 03, 2022 7:53 pm
Not much good when push comes to shove unless one doesn't
really mind that the imported image is NOT a scaleable vector object.
Actually the resulting image _is_ scalable without loss of resolution. This in in contrast to a regular image.
Try to enlarge the image and you will notice that it does it quite well. No jaggies. All this thanks to Mark Waddingham.

Although the library "Drawing" which is where "drawingSvgCompileFile" lives has problems with some complex SVGs. It seems that there are many slight variations of "SVG" specifications which make it difficult to get them all.

Kind regards
Bernd

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Get a SVG

Post by jacque » Fri Mar 04, 2022 7:14 pm

I haven't looked at your stack but if it uses the drawing library to convert an SVG, there's a quick way built into LC. The "import as image" menu item automatically converts SVG files to LC scalable format.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Get an SVG

Post by richmond62 » Fri Mar 04, 2022 9:03 pm

No jaggies.
My stupidity: Not Mark's brilliance.
Last edited by richmond62 on Tue Jul 12, 2022 3:13 pm, edited 1 time in total.

jmk_phd
Posts: 213
Joined: Sat Apr 15, 2017 8:29 pm

Re: Get a SVG

Post by jmk_phd » Sun Jul 10, 2022 10:41 pm

Jacque wrote:
The "import as image" menu item automatically converts SVG files to LC scalable format.
Never saw this before in the LC documentation, but it does seem to work -- at least for a relatively simple SVG -- when tried in a simple stack!

Still, the LiveCode folks warn us in the dictionary that SVG functionality is provisional and subject to change until the LC 9 development cycle is complete, so I'm very wary of using SVGs in an app planned soon for publication.

The original (1996) version of my app employed a long-defunct IDE (Prograph) that did store SVGs in the Mac resource fork. It was a bummer that upon adopting LiveCode I had to render all 237 of these as bitmaps -- which, apart from bloating the app, doesn't accommodate well the more popular high-resolution screens. I'd convert these complex graphics back to SVGs if I were confident that these would display properly.

Still, I was blown away by Paul McClernan's sample stacks at

https://github.com/PaulMcClernan/OpenXT ... ayLibMaker

His incredibly complex SVG images of playing cards are a sight to behold, and way beyond what I thought was possible in LC.

jeff k

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Get a SVG

Post by jacque » Mon Jul 11, 2022 12:28 am

If it works in the IDE it will work in an app, it's a one-time conversion.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Get an SVG

Post by richmond62 » Tue Jul 12, 2022 1:41 pm

Back in 2017.
Attachments
SVG Importer.livecode.zip
Stack.
(83.43 KiB) Downloaded 74 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Get an SVG

Post by richmond62 » Tue Jul 12, 2022 3:22 pm

The "import as image" menu item automatically converts SVG files to LC scalable format.
-
SShot 2022-07-12 at 17.19.42.png
-
That works: and, in my screenshot you can see I have imported the SVG file twice and
scaled one of the imported versions with no obvious damage.

I am attaching the original SVG just for fun.
Attachments
04A8.svg.zip
File.
(2.12 KiB) Downloaded 76 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Get an SVG

Post by richmond62 » Tue Jul 12, 2022 3:26 pm

SShot 2022-07-12 at 17.25.20.png
-
And this worked rather well.
Attachments
1551410380.svg.zip
File.
(54.86 KiB) Downloaded 86 times

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1206
Joined: Thu Apr 11, 2013 11:27 am

Re: Get a SVG

Post by LCMark » Tue Jul 12, 2022 4:58 pm

jmk_phd wrote:
Sun Jul 10, 2022 10:41 pm
Still, the LiveCode folks warn us in the dictionary that SVG functionality is provisional and subject to change until the LC 9 development cycle is complete, so I'm very wary of using SVGs in an app planned soon for publication.
Ooops - I didn't realize that was still there. That referred to the LC9.0 development cycle - which finished in April 2018.

The version (1) of the drawing format used in the engine is stable and isn't going to change.

If any changes / new features are added to the SVG compiler in future then there will be a bump in version of the format, but V1 format files will still work (and if there is ever a need/compelling reason to drop V1 format support, it will either be optional, or we will provide a converter to upgrade existing V1 files to later versions).

Upshot - if drawingSvgCompile (or just using `Import as Control`) on your SVG files produces good output for you, then you have no need to worry about anything changing that will break them in a future engine version :)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Get an SVG

Post by richmond62 » Tue Jul 12, 2022 5:23 pm

The Dictionary really does need a vast overhaul.

1. Bits left out.

2. Bits written in an obfuscatory manner.

3. Bits that are no longer relevant.

4. Bits that need changing.

jmk_phd
Posts: 213
Joined: Sat Apr 15, 2017 8:29 pm

Re: Get an SVG

Post by jmk_phd » Mon Aug 01, 2022 7:44 pm

I second Richmond's observation that updating the Dictionary deserves much more attention than it's gotten. I often encounter typos and words/phrases that simply trail off into nowhere. (I've never even considered purchasing a print version, inasmuch as this presumably would fall even further behind with each revision of LC.)

Still, I can report that after spending a week or so redrawing nearly three hundred even complex 300ppi pngs as SVGs, it was well worth the effort. The "Import as Control > Image file..." has worked flawlessly. These look better even on a standard-resolution display, and terrific on a Retina screen.

As a plus, it's significantly reduced the size of the standalones, which matters for an app downloadable from a website.

jeff k

stam
Posts: 2635
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Get an SVG

Post by stam » Tue Aug 02, 2022 2:31 pm

I think that rather than complaining about this in the forum (especially under a very misleading title such as this one), if we think we've identified a documentation error we should first post it in the bug review subforum and then if there is consensus post a bug report for documentation errors.
I have done this on occasion and it works.

Documentation is too extensive for LC to keep updated and much of it would benefit from clearer explanations, more examples, etc, especially for those new to the language.

I think submitting a bug report for documentation may realistically be the best way for LC to target those bits that need updating.
And posting these first in the bug review subforum here will provide a sanity check.

S.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Get an SVG

Post by richmond62 » Tue Aug 02, 2022 3:01 pm

I think that rather than complaining about this in the forum (especially under a very misleading title such as this one), if we think we've identified a documentation error
How about opening up a section on Documentation right here in the Forums?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Get an SVG

Post by FourthWorld » Tue Aug 02, 2022 3:53 pm

richmond62 wrote:
Tue Aug 02, 2022 3:01 pm
How about opening up a section on Documentation right here in the Forums?
How about reporting errors using the existing error reporting method?
https://quality.livecode.com/
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”