aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleLua.cpp
diff options
context:
space:
mode:
authorGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-08 16:39:44 +0000
committerGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-08 16:39:44 +0000
commitfb858245216dafee4de731fce4f0fa58c746d3e9 (patch)
treeebdab8c84c1e98d0d2494994488cc5c65e07348d /samplecode/SampleLua.cpp
parent09efb177ed163cef118b192b796fc8afe2890408 (diff)
add pdf lib to lua_pictures to fix linker error
Revert "Revert "add document and textAlign support to lua"" This reverts commit f603260d7df6315788af3eadb18db556daf41c13. git-svn-id: http://skia.googlecode.com/svn/trunk@9482 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleLua.cpp')
-rw-r--r--samplecode/SampleLua.cpp25
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: