-- threshold filter

level = 0.5

for y=0, height-1 do
	for x=0, width-1 do
		v = get_value (x,y)
		if v>level then
			v=1.0
		else
			v=0.0
		end
		set_value (x,y,v)
	end
	progress (y/height)
end

-- gluas functions:
-- ================
--
-- pixel setters and getters:
--
-- set_hsl (x,y,h,s,l)
-- set_hsv (x,y,h,s,v)
-- set_lab (x,y,l,a,b)
-- set_rgb (x,y,r,g,b)
-- set_rgba (x,y,r,g,b,a)
-- set_alpha (x,y,alpha)
-- set_value (x,y,value)
-- a       = get_alpha (x,y)
-- v       = get_value (x,y)
-- h,s,l   = get_hsl   (x,y)
-- h,s,v   = get_hsv   (x,y)
-- l,a,b   = get_lab   (x,y)
-- r,g,b   = get_rgb   (x,y)
-- r,g,b,a = get_rgba  (x,y)
--
-- special functions:
--
-- flush() - commit changes to image being processed
-- process(ratio) - sets progress bar,. 0.0 = none 1.0 = full
