summaryrefslogtreecommitdiff
path: root/html/examples/imagergb.wlua
diff options
context:
space:
mode:
authorscuri <scuri>2009-06-26 17:22:45 +0000
committerscuri <scuri>2009-06-26 17:22:45 +0000
commitfeab2c247a73bffa2cba7833e05b6b4f92351e41 (patch)
treefa81b2e5b56dcf09d67dd845f2bbb2cbe8675605 /html/examples/imagergb.wlua
parent6571550c067af0bb8579d892ab2cf2b8e4543c6e (diff)
*** empty log message ***
Diffstat (limited to 'html/examples/imagergb.wlua')
-rw-r--r--html/examples/imagergb.wlua35
1 files changed, 35 insertions, 0 deletions
diff --git a/html/examples/imagergb.wlua b/html/examples/imagergb.wlua
new file mode 100644
index 0000000..b7c6f11
--- /dev/null
+++ b/html/examples/imagergb.wlua
@@ -0,0 +1,35 @@
+require("iupcdaux") -- utility module used in some samples
+
+w = 100
+h = 100
+
+image_rgb = cd.CreateImageRGB(w, h)
+
+size = w * h
+i = 0
+while i < size do
+
+ if i < size/2 then
+ image_rgb.r[i] = 255
+ image_rgb.g[i] = 0
+ image_rgb.b[i] = 0
+ else
+ image_rgb.r[i] = 0
+ image_rgb.g[i] = 0
+ image_rgb.b[i] = 255
+ end
+
+ i = i + 1
+end
+
+dlg = iupcdaux.new_dialog(w, h)
+cnv = dlg[1] -- retrieve the IUP canvas
+
+-- custom function used in action callback
+-- from the iupcdaux module
+function cnv:Draw(canvas)
+ canvas:PutImageRectRGB(image_rgb, 0, 0, w, h, 0, 0, 0, 0)
+end
+
+dlg:show()
+iup.MainLoop()