Importing 1022 colors into LiveCode gradient

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
capellan
Posts: 415
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Importing 1022 colors into LiveCode gradient

Post by capellan » Wed Nov 23, 2016 4:48 am

Hi All,

I was testing the practical limits of importing svg gradients into LiveCode vector graphics and
have success importing a svg with 1022 gradients. (Look attached files)

But I want to know, How many colors could we add safely to a LiveCode gradient?
Which are the practical limits of this feature?

Thanks in advance,

Al
1022 colors on LiveCode gradient.zip
Compressed folder with a stack and one svg file
(15.36 KiB) Downloaded 78 times

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

Re: Importing 1022 colors into LiveCode gradient

Post by bn » Wed Nov 23, 2016 12:43 pm

Hi Alejandro,

when I look at the "ramp" of the fillgradient there are only 255 lines. I do not see 1022 lines.

And the graphic looks differently than the SVG you provided.

Kind regards
Bernd

capellan
Posts: 415
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Re: Importing 1022 colors into LiveCode gradient

Post by capellan » Wed Nov 23, 2016 11:57 pm

My mistake :oops:

Effectively, your observation answers my question:
LiveCode gradient ramp have an artificial limit
of 255 colors.

Looks that LiveCode imports the correct sequence of first 234 colors
but after these 234 colors, it just choose one color after
every 3 or 4 colors in the ramp list.

Check the attached files with both color ramp lists.

By the way, Bernd, Hermann and Willhelm, all of you enjoy really impressive math skills.
Could you join your minds to solve a recognized problem of svg files?

The problems is about flatten (or applying) all transforms to every element
in a svg file (groups, rectangles, arcs, circles, paths, gradients,etc) and produce
a new svg that is visually identical to the original, but without any transforms.

What do you think?

Many, many thanks again for reviewing this post! :D

Al
255 color limit on LiveCode gradient ramp.zip
text files with gradients color ramp lists
(11.02 KiB) Downloaded 75 times

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

Re: Importing 1022 colors into LiveCode gradient

Post by bn » Thu Nov 24, 2016 9:08 am

Hi Alejandro,

I see what LC does in you attached files. So it is a limitation of Livecode. But I don't see a real use case for more than 255 colors/points on the ramp. Unless you want to import a gradient with more than 255 colors/points on the ramp from a SVG file as you have no obvious or easy way to map those 1022 to 255 entries.
Is this for importing SVG files?
The problems is about flatten (or applying) all transforms to every element
in a svg file (groups, rectangles, arcs, circles, paths, gradients,etc) and produce
a new svg that is visually identical to the original, but without any transforms.
assuming you want this to translate SVG information into points for graphics then
maybe this library for transforms in LC by MaxV is a beginning?
https://github.com/angerangel/LCR3D
I never worked with it but it should also work for 2D objects/graphics.
Kind regards
Bernd

capellan
Posts: 415
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Re: Importing 1022 colors into LiveCode gradient

Post by capellan » Thu Nov 24, 2016 10:41 pm

Hi Bernd,
Is this for importing SVG files?
No, it's for creating SVG files within LiVeCode...
but I could just show them within the Browser widget :)
assuming you want this to translate SVG information into points for graphics then
maybe this library for transforms in LC by MaxV is a beginning?
https://github.com/angerangel/LCR3D
I never worked with it but it should also work for 2D objects/graphics.
Actually SVGL contains code for this task, but SVG format is very difficult
to work with. It's not fortuitous that it took so long (almost a decade)
to became widely supported and used among browsers, design apps and designers:
http://blog.siliconpublishing.com/2015/ ... se-of-svg/

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

Re: Importing 1022 colors into LiveCode gradient

Post by bn » Fri Nov 25, 2016 11:30 am

Hi Alejandro,

there are plans to implement
https://github.com/memononen/nanosvg
in LCB

Mark Waddingham has a pull-request that I can not find currently which is not final yet. It stalled a year ago.
https://github.com/livecode/livecode/pull/3089

I think that should take care of many problems of rendering more complex SVGs in LCB

I don't think it is useful to develop a parsing system in LCB which would be a huge undertaking.

I just wait patiently

Kind regards
Bernd

capellan
Posts: 415
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Re: Importing 1022 colors into LiveCode gradient

Post by capellan » Fri Nov 25, 2016 6:08 pm

Some months ago, I started and stopped working with
removing transforms from svg, because when I fixed the code
to import correctly a particular svg file, then it failed with
many others svg files...

Maybe there is another way of solving this, without creating
a code branch for every different type of svg file that
every application produce.

Al

capellan
Posts: 415
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Re: Importing 1022 colors into LiveCode gradient

Post by capellan » Wed Feb 15, 2017 2:50 am

By the way, in this forum thread:
http://forums.livecode.com/phpBB2/viewt ... 11&t=28384
there is an example of converting a svg into a bitmap
using LiveCode browser widget.

Al

Post Reply

Return to “Rich Media”