diff options
author | mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-06-08 13:25:23 +0000 |
---|---|---|
committer | mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-06-08 13:25:23 +0000 |
commit | bdf59df6a17520b372ef4567bdca52ccef0c506b (patch) | |
tree | 3a47ad552c554427cd774a3a4c1e390bddb058cb /samplecode/SampleLua.cpp | |
parent | ddc813b0def5a79d0eb5011240fecce6147ce9ef (diff) |
add document and textAlign support to lua
git-svn-id: http://skia.googlecode.com/svn/trunk@9480 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleLua.cpp')
-rw-r--r-- | samplecode/SampleLua.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/samplecode/SampleLua.cpp b/samplecode/SampleLua.cpp index fb40087a12..104a427d7a 100644 --- a/samplecode/SampleLua.cpp +++ b/samplecode/SampleLua.cpp @@ -50,10 +50,23 @@ static const char gCode[] = "" " end " " canvas:drawPath(path, path_paint);" "" - " paint:setTypeface(Sk.newTypeface('Times', 1));" - " paint:setColor{a = 1, r=0, g=0, b = 1};" - " paint:setTextSize(70);" - " canvas:drawText('Hamburgefons', 50, 200, paint);" + " paint:setColor{a=1,r=0,g=0,b=1};" + " local align = { 'left', 'center', 'right' };" + " paint:setTextSize(30);" + " for k, v in next, align do " + " paint:setTextAlign(v);" + " canvas:drawText('Hamburgefons', 320, 200 + 30*k, paint);" + " end " + "end " + "" + "function onStartup() " + " local paint = Sk.newPaint();" + " paint:setColor{a=1, r=1, g=0, b=0};" + " local doc = Sk.newDocumentPDF('/skia/trunk/test.pdf');" + " local canvas = doc:beginPage(72*8.5, 72*11);" + " canvas:drawText('Hello Lua', 300, 300, paint);" + " doc:close();" + " doc = nil;" "end " "" "function onDrawContent(canvas) " @@ -64,7 +77,9 @@ static const char gCode[] = "" " canvas:drawOval(r, paint) " " x = x + 1;" " if x > 100 then x = 0 end;" - "end"; + "end " + "" + "onStartup();"; class LuaView : public SampleView { public: |