summaryrefslogtreecommitdiff
path: root/html/examples/render.lua
blob: b57f906fc2778cb68d48e6f58cc743022e13754c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require"imlua"
require"imlua_process"

local image = im.ImageCreate(500, 500, im.RGB, im.BYTE)

im.ProcessRenderRandomNoise(image)
image:Save("render_noise.bmp", "BMP")

im.ProcessRenderConstant(image, { 128.0, 0.0, 255.0 })
image:Save("render_constant.bmp", "BMP")

im.ProcessRenderWheel(image, 100, 200)
image:Save("render_wheel.bmp", "BMP")

im.ProcessRenderTent(image, 300, 200)
image:Save("render_tent.bmp", "BMP")

im.ProcessRenderRamp(image, 0, 500, 0)
image:Save("render_ramp.bmp", "BMP")

im.ProcessRenderBox(image, 200, 200)
image:Save("render_box.bmp", "BMP")

im.ProcessRenderSinc(image, 100.0, 100.0)
image:Save("render_sinc.bmp", "BMP")

im.ProcessRenderGaussian(image, 100.0)
image:Save("render_gaussian.bmp", "BMP")

im.ProcessRenderLapOfGaussian(image, 100.0)
image:Save("render_lapofgaussian.bmp", "BMP")

im.ProcessRenderCosine(image, 100.0, 100.0)
image:Save("render_cosine.bmp", "BMP")

im.ProcessRenderGrid(image, 100.0, 100.0)
image:Save("render_grid.bmp", "BMP")

im.ProcessRenderChessboard(image, 100.0, 100.0)
image:Save("render_chess.bmp", "BMP")

im.ProcessRenderCone(image, 200)
image:Save("render_cone.bmp", "BMP")

local render_func = function (x, y, d, param)
	return math.mod(x + y, 256)
end

im.ProcessRenderOp(image, render_func, "test", {}, 0)
image:Save("render_func.bmp", "BMP")