Function Screenshot

Screenshot(x1, y1, x2, y2)
This function allows you to capture a part of your window as a PNG image. The part is defined by a rectangle (x1, y1, x2, y2). In the example below you can see a small graphic editor with possibility to save and open images as PNG files:
function OnMouseUp(x, y)
	DrawCircle(x, y, 5)
end function

function OnKeyboard(c)
	if c="s"
		SaveFile(Screenshot(0, 0, GetWidth(), GetHeight()), "png")
	elseif c="o"
		img = OpenFile("png")
		if not IsNull(img)
			ClearScreen()
			DrawImage(0, 0, img)
		end if
	elseif c="c"
		ClearScreen()
	end if
end function

See also: