lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I think that perhaps I should give an example of EzSVG, since despite
all the suggestions, that still is closest to what I am looking for.

It is not a backend, in the sense that one is coding in some other
abstraction layer and SVG is an implementation layer. Neither does it
render SVG into GTk or whatever.

It requires you to think in terms of SVG constructions, but expressed
as idiomatic-looking Lua code instead of as an XML variant.

-- create a group (very handy, also stays a group in Inkscape/Illustrator)
local group = EzSVG.Group()

for r=0,360, 10 do
    -- create a line and add a transform (rotation with r degrees,
centered on 500/500)
    local line = EzSVG.Line(100, 500, 900, 500):rotate(r, 500, 500)
    -- add it to the group
    group:add(line)
end

-- add the group to the document
doc:add(group)

The CamelCase annoys me, and I would be happier with table arguments, i.e.

   local line = ezsvg.line{x1=100,y1=500;
x2=900,y2=500}:rotate{angle=r; x=500,y=500}

but the basic concept looks good.

So I am looking for a fuller-featured, well-supported library a;omg
similar lines. Otherwise I'll just fork the repository.