added native circle and ellipse objects - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/examples/graphics.lua
diff options
context:
space:
mode:
authorfrancesco-ST <francesco.abbate@st.com>2010年08月05日 14:29:43 +0200
committerfrancesco-ST <francesco.abbate@st.com>2010年08月05日 14:29:43 +0200
commit2dd683d5721fbd9d740feacf90caee564752696c (patch)
tree84eed8a5523fee1c8def4684307ef70eb388ca0d /examples/graphics.lua
parent19b34676bbbb009b5a60c572eebe82c447185b67 (diff)
downloadgsl-shell-2dd683d5721fbd9d740feacf90caee564752696c.tar.gz
added native circle and ellipse objects
Diffstat (limited to 'examples/graphics.lua')
-rw-r--r--examples/graphics.lua 24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/graphics.lua b/examples/graphics.lua
index 4316d9c0..f813858f 100644
--- a/examples/graphics.lua
+++ b/examples/graphics.lua
@@ -85,5 +85,29 @@ function demo2()
return p
end
+function demo3()
+ local n = 24
+ local color = {'red', 'yellow', 'blue', 'darkgreen', 'cyan'}
+ local p = window('black')
+ local txt = text()
+ txt.text = 'Hello world!'
+
+ p:setview(-1, -1, 1, 1)
+
+ local N = 128
+ for j=0, N do
+ local th = 2*pi*j/N
+ txt.angle = th
+ p:clear()
+ for k=0, n-1 do
+ local a = 2*pi*k/n - pi/2
+ local ch = |t| t[(k % #t)+1]
+ p:draw(txt, ch(color), {{'translate', x = 100*cos(a), y= 100*sin(a)}})
+ end
+ p:refresh()
+ end
+ return p
+end
+
p1 = demo1()
p2 = demo2()
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月17日 17:56:32 +0000

AltStyle によって変換されたページ (->オリジナル) /