Vector Images and the SVGL stack

Richard Gaskin ambassador at
Mon Nov 9 19:56:56 EST 2015

-hh wrote:
 > R.G. wrote:
 >> He [Alejandro] does a very good job of it, but SVG includes
 >> primitives beyond what LC offers. We have ovals, lines,
 >> polygons, roundRects, and rects, but SVG also allows paths
 >> that can consist of straight lines, curves, and even Beiziers.
 > LC is pretty good able to do straight lines, curves, and even
 > quadratic or cubic Bezier curves ...
 > And Alejandro translates SVG also to these (did already LC's Ian
 > in his basic SVGL of 2009). And moreover, very difficult, Al
 > currently imports to Graphic Effects.

The difference between a true Bezier object and emulating Beziers with 
polygons is resolution.  Polygons can be made to like very good on 
screen, but cannot be made to resize larger, or print to a printer with 
higher resolution than the monitor, with the same smoothness as a true 
Bezier curve object.

When thinking of SVG path emulation in a language that has no native 
support for such things (yet), consider a circle: an infinite number of 
points a given distance from a given point.  Of course an infinite 
number of points would take infinite processing power to calculate, but 
a graphics engine like LiveCode's or Skia's (which in recent versions is 
the same thing) will render a circle primitive by calculating only the 
points it needs for the display device it's being rendered on.

Given that, if a fixed number of points is used to define a circle at a 
given resolution, enlarging the object will expose its points, making it 
evident that it's an approximation made from a polygon.  The larger the 
resizing, the more jaggy its appearance.  Shrunk down small enough a 
stop sign will look like a circle, but enlarged it becomes increasingly 
clear that it's a polygon.

Same with Beziers and mixed-type paths, since neither are among LC's 
built-in primitives at this time.

Skia, however, has SVG libraries available, which can be used to render 
any primitives defined in SVG to the full resolution of the display 
device (or printer, as the case may be).

  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  Ambassador at      

More information about the use-livecode mailing list