Widget for importing SVG images in LC ?

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

Post Reply
ValiantCuriosity
Posts: 128
Joined: Thu Jun 30, 2016 3:08 am

Widget for importing SVG images in LC ?

Post by ValiantCuriosity » Sun Feb 10, 2019 2:29 am

I use SVG images in the app that I'm trying to re-write in LC. These sorts of vector images seem important for responsive design in iOS. The .png images become pixelated when they are increased in size.

It appears as though there is no simple way to import color SVG images into LC. I notice a lot of forum discussions that go back to 2016 related to the issue of SVG images but I can't see any way to import them.

Am I missing some obvious way to import my SVG images/logos in LC?

TIA
-Rachel
May I never be cured of my curiosity! :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Widget for importing SVG images in LC ?

Post by richmond62 » Sun Feb 10, 2019 11:28 am

No, I don't think you are missing anything: there has been an ongoing discussion and a lot of "tooth sucking".

I worked out a very, very primitive stack to import monochrome SVG images made in Inkscape,
but that is not much good.

For instance, I wanted a 3 colour svg image, so had to import each colour as a separate
monochrome SVG image, layer the things, and then colourise each layer internally.

The "man" in this respect is, however, not myself, but Alejandro El Tejada . . .
so look for his postings and uploads. :D

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Widget for importing SVG images in LC ?

Post by bogs » Sun Feb 10, 2019 11:47 am

I myself don't use svg, when I recently had need to convert some I shelled out to image magick, however, as well as what Richmond said, there are other links to look at -
BYU Lc svg
Brian's icon tool
ClipArtGuy's icon(s) tool

Funny, I thought all this was what that svg widget was for, and it is, kinda I guess. All of the above are, as far as I know, the top existing solutions aside from Greg Miller (pink) and Alejandro.
Image

ValiantCuriosity
Posts: 128
Joined: Thu Jun 30, 2016 3:08 am

Re: Widget for importing SVG images in LC ?

Post by ValiantCuriosity » Mon Feb 18, 2019 12:25 am

Well...dang!

SVG seems so important now. Maybe LC creators will come up with something out of their magic Hats.

-Rachel
May I never be cured of my curiosity! :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Widget for importing SVG images in LC ?

Post by richmond62 » Mon Feb 18, 2019 10:55 am

Maybe LC creators will come up with something out of their magic Hats.
Yeah, well, maybe when they consider the 'promises' they made during a Kickstarter thing a while ago.

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Widget for importing SVG images in LC ?

Post by bogs » Mon Feb 18, 2019 11:08 am

Good morning Richmond! (Afternoon where you are).
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Widget for importing SVG images in LC ?

Post by richmond62 » Mon Feb 18, 2019 11:30 am

Good "moaning" bogs!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Widget for importing SVG images in LC ?

Post by jacque » Mon Feb 18, 2019 5:31 pm

Am I missing some obvious way to import my SVG images/logos in LC?
I just open the SVG in BBEdit (any text editor should work) and copy the path to the clipboard. The part you copy must start with the first Move instruction. In LC, change the path of an existing SVG by pasting what you copied. Complex paths may not be supported but most work fine.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

ValiantCuriosity
Posts: 128
Joined: Thu Jun 30, 2016 3:08 am

Re: Widget for importing SVG images in LC ?

Post by ValiantCuriosity » Mon Feb 18, 2019 8:19 pm

@Jackie,
Wow! I will give this a try and see. Thank you. The work around would sure open up some much better options for development. As it stands now, when trying to use responsive design, I end up with image pixelation. That is especially true of background objects. Not sure about "paths" since I need these to be compiled with the iOS app, but I will definitely try this option out.

As I'm sure you are aware, responsive design can be a nightmare. I'd love to create for Android, but have found it so confusing with sizes, resolutions, video, etc that I gave up. I hope that LC developers will continue to work on the responsive design piece of the LC environment. I've tried all of the various code options:

Code: Select all

set the fullscreenmode of me to "exactFit" 
Each of them have definite drawbacks. Users do NOT want the letterbox these days. "exactFit" seems best for now. It would work much better when combined with an easy way to import SVG graphics.

However, I can only imagine the nightmare that LC coders have had trying to keep this project alive for so many years and update it successfully to today's standards. It is truly a work of genius that they have done so well.

Thank you, thank you, thank you for your help :lol:

What a great forum.
-Rachel
May I never be cured of my curiosity! :D

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Widget for importing SVG images in LC ?

Post by bogs » Mon Feb 18, 2019 9:11 pm

ValiantCuriosity wrote:
Mon Feb 18, 2019 8:19 pm
but have found it so confusing with sizes, resolutions, video, etc that I gave up.
Jacque and Richard and a bunch of others will be able to tell you better (cause I don't do mobile), but you can write your own routines to scale whatever part of the interface you want to whatever size you need, even if you don't know the size in advance, and it isn't terribly difficult to do.

One way to do that is in the livecode lessons (not necessarily the best way, but not the worst either :wink: )
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Widget for importing SVG images in LC ?

Post by jacque » Mon Feb 18, 2019 9:41 pm

ValiantCuriosity wrote:
Mon Feb 18, 2019 8:19 pm
As I'm sure you are aware, responsive design can be a nightmare. I'd love to create for Android, but have found it so confusing with sizes, resolutions, video, etc that I gave up. I hope that LC developers will continue to work on the responsive design piece of the LC environment. I've tried all of the various code options:

Code: Select all

set the fullscreenmode of me to "exactFit" 
Each of them have definite drawbacks. Users do NOT want the letterbox these days. "exactFit" seems best for now. It would work much better when combined with an easy way to import SVG graphics.
Actually, "exactFit" will stretch your layout to fit the current screen and is usually a poor choice for mobile because controls won't scale proportionally. Things onscreen will appear stretched or distorted. I mostly use "showAll" or "noBorder", both of which scale proportionally. If you plan ahead for where the empty side bars will appear, they will be unnoticeable for the most part. This generally means providing backgrounds that extend beyond the card dimensions, or providing a backgroundColor or backgroundPattern on the card which will fill in the empty areas so there are no black bars.

I find fullscreenMode to be the easiest way to scale for different screen sizes (remember that Apple has also introduced a non-standard size with the last iPhone) and it automatically works with all the different Android screen dimensions. But the other way to manage it, which we all used before fullscreenMode was available, is to script the position and size of all the screen elements based on their relative placement to the actual screen size. This takes longer to write but can be more accurate and doesn't require including a background fill and outsized horizontal backgrounds behind navigation and tool bars.

Below is an example of an extended Android header bar. There will be no empty areas at the sides no matter how wide the screen is. The card color is set to white, so those areas will fill in white at the edges.
Attachments
stretchBg.png
stretchBg.png (11.29 KiB) Viewed 8564 times
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

ValiantCuriosity
Posts: 128
Joined: Thu Jun 30, 2016 3:08 am

Re: Widget for importing SVG images in LC ?

Post by ValiantCuriosity » Tue Feb 19, 2019 7:16 pm

Thanks again Jackie.

I think that some of the materials that I've been reading and then applying in code, were written before these additions were available. Either that, or they weren't mentioned in the docs that I'm studying. I appreciate the "heads up". I'll give your solutions a try today. :D

Progressing slowly, but surely. LC is an amazing piece of work, but there is a LOT to learn... If it can make a coder out of me, that is almost a miracle. ;-)

OH, and Bogs,
Just you wait. I have about a thousand questions reserved for you. Problem is, that I haven't gotten far enough in the learning process to understand any of the answers. :oops:

Smiles,
-Rachel
May I never be cured of my curiosity! :D

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Widget for importing SVG images in LC ?

Post by jacque » Tue Feb 19, 2019 8:00 pm

There's a critical mass of info you need, and once that kicks in everything else falls into place and you get that eureka moment. It usually only takes a few weeks so you're right on schedule.

A lot of the materials you're reading are probably old, but the basics haven't changed in forever so it isn't wasted time.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Widget for importing SVG images in LC ?

Post by bogs » Tue Feb 19, 2019 8:27 pm

ValiantCuriosity wrote:
Tue Feb 19, 2019 7:16 pm
OH, and Bogs,
Just you wait. I have about a thousand questions reserved for you. Problem is, that I haven't gotten far enough in the learning process to understand any of the answers. :oops:
Oh I dunno about that, anything I could answer with authority would probably be in the 'baby steps' category anyway :wink:
jacque wrote:
Tue Feb 19, 2019 8:00 pm
There's a critical mass of info you need, and once that kicks in everything else falls into place and you get that eureka moment. It usually only takes a few weeks so you're right on schedule.
In a week or two, you will FAR surpass where I am after nearly 7 years Image
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Widget for importing SVG images in LC ?

Post by richmond62 » Thu Feb 21, 2019 10:10 am

At the risk of being accused of being repetitive . . .
Attachments
SVG Importer.livecode.zip
Like, err, what it says on the box.
(87.19 KiB) Downloaded 240 times

Post Reply