If I use the menu File -> Image as Control -> Image File, .svg file are imported without any problem. But I'm unable to import the same .svg file with the import command
Create a button's icon with a part of a big image? - Beleaguered Castle
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Create a button's icon with a part of a big image?
Is there a way to import as control by script?
If I use the menu File -> Image as Control -> Image File, .svg file are imported without any problem. But I'm unable to import the same .svg file with the import command
If I use the menu File -> Image as Control -> Image File, .svg file are imported without any problem. But I'm unable to import the same .svg file with the import command
-
richmond62
- Livecode Opensource Backer

- Posts: 10231
- Joined: Fri Feb 19, 2010 10:17 am
Re: Create a button's icon with a part of a big image?
Mmmm . . .
- -
C'est un crôt . . .
Ce code fonctionne avec les images PNG! Et des JPGs, GIFs et (possiblement) BMPs.
Le problème réside dans le mot 'paint'. Les images SVGs n'ont pas 'paint', ils ont des lignes.
- -
C'est un crôt . . .
Code: Select all
on mouseUp
answer file "Select image:"
if the result is not cancel then
set the lockscreen to true
import paint from file it
set the name of the last control to "XYZ"
wait 5 ticks
set the lockscreen to false
end if
end mouseUp
Le problème réside dans le mot 'paint'. Les images SVGs n'ont pas 'paint', ils ont des lignes.
-
richmond62
- Livecode Opensource Backer

- Posts: 10231
- Joined: Fri Feb 19, 2010 10:17 am
Re: Create a button's icon with a part of a big image?
-
This is SLOW, so wait. 
Code: Select all
on mouseup
answer file "select an SVG image"
put it into XYZ
create image
put it into ABC
set the text of ABC to drawingSvgCompileFile(XYZ)
end mouseup
- Attachments
-
- Import SVG.livecode.zip
- Stack.
- (858 Bytes) Downloaded 159 times
-
richmond62
- Livecode Opensource Backer

- Posts: 10231
- Joined: Fri Feb 19, 2010 10:17 am
Re: Create a button's icon with a part of a big image?
-
And how the !@#$%^&*( did Richmond know what to look for in the Dictionary?
Café ! Tu peux dormir quand tu es mort !
OBVIOUSLY this will NOT import SVG images that contain font components successfully.
And how the !@#$%^&*( did Richmond know what to look for in the Dictionary?
Café ! Tu peux dormir quand tu es mort !
OBVIOUSLY this will NOT import SVG images that contain font components successfully.
Re: Create a button's icon with a part of a big image?
That is a very interesting command Richmond, thank you for highlighting it...
This could be very useful for my own purposes, but I'm slightly concerned about the disclaimer at the end of the API:
This could be very useful for my own purposes, but I'm slightly concerned about the disclaimer at the end of the API:
And of course, i'd have to remember to include XML for the standaloneNote: The drawing binary format is not currently considered stable and is subject to change until the end of the RC cycle for 9. At present it is advised that SVG files be compiled as needed when developing in the IDE, and then compiled ahead-of-time when building a standalone.
-
richmond62
- Livecode Opensource Backer

- Posts: 10231
- Joined: Fri Feb 19, 2010 10:17 am
Re: Create a button's icon with a part of a big image?
What Zak has not told us is whether he wants to use this in a standalone, or simply
for his own uses in the IDE.
Oh, and THIS is from LC 10 DP-4, so I would not hold my breath:
- -
Oh, and as my licence [very kindly supplied by LiveCode for educational purposes] is going 'poof' in 2 weeks time,
I. at least, am "learning to live with" Livecode 9.6.3. Community, at least until someone somewhere manages to
produce a 'continuation' Open Source version, or LiveCode themselves offer a 'RevMedia reborn' version.
My stack works with LC 10-dp 4:
-
for his own uses in the IDE.
Oh, and THIS is from LC 10 DP-4, so I would not hold my breath:
- -
Oh, and as my licence [very kindly supplied by LiveCode for educational purposes] is going 'poof' in 2 weeks time,
I. at least, am "learning to live with" Livecode 9.6.3. Community, at least until someone somewhere manages to
produce a 'continuation' Open Source version, or LiveCode themselves offer a 'RevMedia reborn' version.
My stack works with LC 10-dp 4:
-
Re: Create a button's icon with a part of a big image?
Merci beaucoup richmond
Une fois de plus, vous êtes d'une aide précieuse !
It works great. I looked at the Dictionnary before posting but didn't find this command.
I made a loop based on your script to import all .svg files in a folder an dit works great
I'm using LC 9.6.8 with a License (don't remember which one, it's a kind of "middle" licence: not the biggest but one I paid).
I'm planning to build a standalone.
It works great. I looked at the Dictionnary before posting but didn't find this command.
I made a loop based on your script to import all .svg files in a folder an dit works great
I'm using LC 9.6.8 with a License (don't remember which one, it's a kind of "middle" licence: not the biggest but one I paid).
I'm planning to build a standalone.
-
richmond62
- Livecode Opensource Backer

- Posts: 10231
- Joined: Fri Feb 19, 2010 10:17 am
Re: Create a button's icon with a part of a big image?
1. Open the Dictionary.
2. Search for 'SVG':
- -
Ce n'est pas difficile.
2. Search for 'SVG':
- -
Ce n'est pas difficile.
-
richmond62
- Livecode Opensource Backer

- Posts: 10231
- Joined: Fri Feb 19, 2010 10:17 am
Re: Create a button's icon with a part of a big image?
?:I made a loop based on your script to import all .svg files in a folder an dit works great
-
Re: Create a button's icon with a part of a big image?
I searched "image"
-
richmond62
- Livecode Opensource Backer

- Posts: 10231
- Joined: Fri Feb 19, 2010 10:17 am
Re: Create a button's icon with a part of a big image?
I, first of all, looked at the image stuff, and then realised that an SVG file does not contain 'paint'.I searched "image"
That is why, earlier on, I tried a standard import image script and ended up looking un peu fou.
SVGs are Vector Images, and as a result, are treated differently.
-
richmond62
- Livecode Opensource Backer

- Posts: 10231
- Joined: Fri Feb 19, 2010 10:17 am
Re: Create a button's icon with a part of a big image?
"To use this function in a standalone, you must include the XML extension."
It would be just great if someone could explain how to do that . . .
- -
?
It would be just great if someone could explain how to do that . . .
- -
?
Re: Create a button's icon with a part of a big image?
Hi Richmond,
I think they mean the "SVG Icon Drawing Library", which has a separate entry in the list of Inclusions.
Best
Klaus
I think they mean the "SVG Icon Drawing Library", which has a separate entry in the list of Inclusions.
Best
Klaus
-
richmond62
- Livecode Opensource Backer

- Posts: 10231
- Joined: Fri Feb 19, 2010 10:17 am
Re: Create a button's icon with a part of a big image?
Thank you very much, Klaus, for
the help.
the help.
-
richmond62
- Livecode Opensource Backer

- Posts: 10231
- Joined: Fri Feb 19, 2010 10:17 am
Re: Create a button's icon with a part of a big image?
Oh, wait a big fat moment . . .
SVG icons are one thing,
and importing SVG images might be another.
SVG icons are one thing,
and importing SVG images might be another.