• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Skia Lua Bindings
2=================
3
4**Warning: The following has only been tested on Mac and Linux, but it will
5likely work for any Unix.**
6
7Prerequisites
8-------------
9
10This assumes you already have Skia building normally. If not, refer to [How to
11build Skia](../build).
12
13Build
14-----
15
16To build Lua support into Skia tools, set the GN argument `skia_use_lua` to `true`.
17Optionally, set `skia_use_system_lua`.  Then re-run GN.
18
19
20Try It Out
21----------
22
23The tools `lua_app` and `lua_pictures` should now be available when you compile,
24and `Viewer` should now have a `Lua` sample.
25
26
27To-Do
28-----
29
30Skia had a feature that let it be imported as an .so by Lua.
31This feature is not yet supported by GN, but would have looked something like this:
32
33    $ lua
34
35    Lua 5.2.0  Copyright (C) 1994-2011 Lua.org, PUC-Rio
36    > require 'skia'
37    > paint = Sk.newPaint()
38    > paint:setColor{a=1, r=1, g=0, b=0}
39    > doc = Sk.newDocumentPDF('test.pdf')
40    > canvas = doc:beginPage(72*8.5, 72*11)
41    > canvas:drawText('Hello Lua', 300, 300, paint)
42    > doc:close()
43