Get an SVG
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Get an SVG
Not much good when push comes to shove unless one doesn't
really mind that the imported image is NOT a scaleable vector object.
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.
-
- VIP Livecode Opensource Backer
- Posts: 3990
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Get a SVG
Actually the resulting image _is_ scalable without loss of resolution. This in in contrast to a regular image.richmond62 wrote: ↑Thu Mar 03, 2022 7:53 pmNot much good when push comes to shove unless one doesn't
really mind that the imported image is NOT a scaleable vector object.
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
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Get a SVG
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
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Get an SVG
My stupidity: Not Mark's brilliance.No jaggies.
Last edited by richmond62 on Tue Jul 12, 2022 3:13 pm, edited 1 time in total.
Re: Get a SVG
Jacque wrote:
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
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!The "import as image" menu item automatically converts SVG files to LC scalable format.
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
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Get a SVG
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
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Get an SVG
Back in 2017.
- Attachments
-
- SVG Importer.livecode.zip
- Stack.
- (83.43 KiB) Downloaded 74 times
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Get an SVG
- -The "import as image" menu item automatically converts SVG files to LC scalable format.
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
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Get an SVG
And this worked rather well.
- Attachments
-
- 1551410380.svg.zip
- File.
- (54.86 KiB) Downloaded 86 times
Re: Get a SVG
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
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Get an SVG
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.
1. Bits left out.
2. Bits written in an obfuscatory manner.
3. Bits that are no longer relevant.
4. Bits that need changing.
Re: Get an SVG
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
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
Re: Get an SVG
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.
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.
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Get an SVG
How about opening up a section on Documentation right here in the Forums?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
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Get an SVG
How about reporting errors using the existing error reporting method?richmond62 wrote: ↑Tue Aug 02, 2022 3:01 pmHow about opening up a section on Documentation right here in the Forums?
https://quality.livecode.com/
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn