module Graphics.UI.Threepenny.Canvas ( -- * Synopsis -- | Partial binding to the HTML5 canvas API. -- * Documentation Canvas, Vector, drawImage, clearCanvas, ) where import Graphics.UI.Threepenny.Core {----------------------------------------------------------------------------- Canvas ------------------------------------------------------------------------------} type Canvas = Element type Vector = (Int,Int) -- | Draw the image of an image element onto the canvas at a specified position. drawImage :: Element -> Vector -> Canvas -> UI () drawImage image (x,y) canvas = runFunction $ ffi "%1.getContext('2d').drawImage(%2,%3,%4)" canvas image x y -- | Clear the canvas clearCanvas :: Canvas -> UI () clearCanvas = runFunction . ffi "%1.getContext('2d').clear()"