diff --git a/src/Graphics/Canvas.js b/src/Graphics/Canvas.js index 2d4e36b..c08316b 100644 --- a/src/Graphics/Canvas.js +++ b/src/Graphics/Canvas.js @@ -314,6 +314,15 @@ exports.transform = function(t) { }; }; +exports.setTransform = function(t) { + return function(ctx) { + return function() { + ctx.setTransform(t.m11, t.m12, t.m21, t.m22, t.m31, t.m32); + return ctx; + }; + }; +}; + exports.clearRect = function(ctx) { return function(r) { return function() { diff --git a/src/Graphics/Canvas.purs b/src/Graphics/Canvas.purs index 835b9bb..c998229 100644 --- a/src/Graphics/Canvas.purs +++ b/src/Graphics/Canvas.purs @@ -476,9 +476,12 @@ type Transform = , m32 :: Number } --- | Apply a general transformation. +-- | Apply a general transformation to the current transformation matrix foreign import transform :: forall eff. Transform -> Context2D -> Eff (canvas :: CANVAS | eff) Context2D +-- | Set the transformation matrix +foreign import setTransform :: forall eff. Transform -> Context2D -> Eff (canvas :: CANVAS | eff) Context2D + -- | Enumerates types of text alignment. data TextAlign = AlignLeft | AlignRight | AlignCenter | AlignStart | AlignEnd