packages feed

blank-canvas 0.2.0.1 → 0.2.2

raw patch · 4 files changed

+44/−7 lines, 4 filesdep ~scottydep ~wai-extradep ~warpnew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: scotty, wai-extra, warp

API changes (from Hackage documentation)

+ Graphics.Blank: bezierCurveTo :: (Float, Float, Float, Float, Float, Float) -> Canvas ()
+ Graphics.Blank: fillRect :: (Float, Float, Float, Float) -> Canvas ()
+ Graphics.Blank: globalAlpha :: Float -> Canvas ()
+ Graphics.Blank: lineJoin :: String -> Canvas ()
+ Graphics.Blank: strokeRect :: (Float, Float, Float, Float) -> Canvas ()

Files

Graphics/Blank/Canvas.hs view
@@ -3,6 +3,9 @@ module Graphics.Blank.Canvas where  import Graphics.Blank.Events++import Control.Applicative (Applicative(..))+import Control.Monad (ap) import Numeric  data Canvas :: * -> * where@@ -16,18 +19,29 @@         return = Return         (>>=) = Bind --- HTML5 Canvas assignments: FillStyle, Font, LineCap, LineWidth, MiterLimit, StrokeStyle, TextAlign, TextBaseline+instance Applicative Canvas where+  pure  = return+  (<*>) = ap++instance Functor Canvas where+  fmap f c = c >>= return . f++-- HTML5 Canvas assignments: FillStyle, Font, GlobalAlpha, LineCap, LineJoin, LineWidth, MiterLimit, StrokeStyle, TextAlign, TextBaseline data Command         -- regular HTML5 canvas commands         = Arc (Float,Float,Float,Float,Float,Bool)         | BeginPath+        | BezierCurveTo (Float,Float,Float,Float,Float,Float)         | ClearRect (Float,Float,Float,Float)         | ClosePath         | Fill+        | FillRect (Float,Float,Float,Float)         | FillStyle String         | FillText (String,Float,Float)         | Font String+        | GlobalAlpha Float         | LineCap String+        | LineJoin String         | LineTo (Float,Float)         | LineWidth Float         | MiterLimit Float@@ -37,6 +51,7 @@         | Scale (Float,Float)         | Save         | Stroke+        | StrokeRect (Float,Float,Float,Float)         | StrokeText (String,Float,Float)         | StrokeStyle String         | TextAlign String
Graphics/Blank/Generated.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.Blank.Generated where  import Graphics.Blank.Canvas@@ -5,13 +6,17 @@ instance Show Command where   show (Arc (a1,a2,a3,a4,a5,a6)) = "c.arc(" ++ showJ a1 ++ "," ++ showJ a2 ++ "," ++ showJ a3 ++ "," ++ showJ a4 ++ "," ++ showJ a5 ++ "," ++ showB a6 ++ ");"   show BeginPath = "c.beginPath();"+  show (BezierCurveTo (a1,a2,a3,a4,a5,a6)) = "c.bezierCurveTo(" ++ showJ a1 ++ "," ++ showJ a2 ++ "," ++ showJ a3 ++ "," ++ showJ a4 ++ "," ++ showJ a5 ++ "," ++ showJ a6 ++ ");"   show (ClearRect (a1,a2,a3,a4)) = "c.clearRect(" ++ showJ a1 ++ "," ++ showJ a2 ++ "," ++ showJ a3 ++ "," ++ showJ a4 ++ ");"   show ClosePath = "c.closePath();"   show Fill = "c.fill();"+  show (FillRect (a1,a2,a3,a4)) = "c.fillRect(" ++ showJ a1 ++ "," ++ showJ a2 ++ "," ++ showJ a3 ++ "," ++ showJ a4 ++ ");"   show (FillStyle (a1)) = "c.fillStyle = (" ++ show a1 ++ ");"   show (FillText (a1,a2,a3)) = "c.fillText(" ++ show a1 ++ "," ++ showJ a2 ++ "," ++ showJ a3 ++ ");"   show (Font (a1)) = "c.font = (" ++ show a1 ++ ");"+  show (GlobalAlpha (a1)) = "c.globalAlpha = (" ++ showJ a1 ++ ");"   show (LineCap (a1)) = "c.lineCap = (" ++ show a1 ++ ");"+  show (LineJoin (a1)) = "c.lineJoin = (" ++ show a1 ++ ");"   show (LineTo (a1,a2)) = "c.lineTo(" ++ showJ a1 ++ "," ++ showJ a2 ++ ");"   show (LineWidth (a1)) = "c.lineWidth = (" ++ showJ a1 ++ ");"   show (MiterLimit (a1)) = "c.miterLimit = (" ++ showJ a1 ++ ");"@@ -21,6 +26,7 @@   show (Scale (a1,a2)) = "c.scale(" ++ showJ a1 ++ "," ++ showJ a2 ++ ");"   show Save = "c.save();"   show Stroke = "c.stroke();"+  show (StrokeRect (a1,a2,a3,a4)) = "c.strokeRect(" ++ showJ a1 ++ "," ++ showJ a2 ++ "," ++ showJ a3 ++ "," ++ showJ a4 ++ ");"   show (StrokeText (a1,a2,a3)) = "c.strokeText(" ++ show a1 ++ "," ++ showJ a2 ++ "," ++ showJ a3 ++ ");"   show (StrokeStyle (a1)) = "c.strokeStyle = (" ++ show a1 ++ ");"   show (TextAlign (a1)) = "c.textAlign = (" ++ show a1 ++ ");"@@ -36,6 +42,9 @@ beginPath :: () -> Canvas () beginPath () = Command BeginPath +bezierCurveTo :: (Float,Float,Float,Float,Float,Float) -> Canvas ()+bezierCurveTo = Command . BezierCurveTo+ clearRect :: (Float,Float,Float,Float) -> Canvas () clearRect = Command . ClearRect @@ -45,6 +54,9 @@ fill :: () -> Canvas () fill () = Command Fill +fillRect :: (Float,Float,Float,Float) -> Canvas ()+fillRect = Command . FillRect+ fillStyle :: String -> Canvas () fillStyle = Command . FillStyle @@ -54,9 +66,15 @@ font :: String -> Canvas () font = Command . Font +globalAlpha :: Float -> Canvas ()+globalAlpha = Command . GlobalAlpha+ lineCap :: String -> Canvas () lineCap = Command . LineCap +lineJoin :: String -> Canvas ()+lineJoin = Command . LineJoin+ lineTo :: (Float,Float) -> Canvas () lineTo = Command . LineTo @@ -83,6 +101,9 @@  stroke :: () -> Canvas () stroke () = Command Stroke++strokeRect :: (Float,Float,Float,Float) -> Canvas ()+strokeRect = Command . StrokeRect  strokeText :: (String,Float,Float) -> Canvas () strokeText = Command . StrokeText
blank-canvas.cabal view
@@ -1,9 +1,9 @@ Name:                blank-canvas-Version:             0.2.0.1+Version:             0.2.2 Synopsis:            HTML5 Canvas Graphics Library-Description:         A Haskell port of the HTML5 Canvas API. +Description:         A Haskell port of the HTML5 Canvas API.                      blank-canvas works by providing a web service that-                     displays the users' Haskell commands inside a browser. +                     displays the users' Haskell commands inside a browser.  License:             BSD3 License-file:        LICENSE@@ -43,11 +43,11 @@   build-depends:       base             >= 4.3.1        && < 5,                        aeson            == 0.6.*,                        containers       == 0.4.*,-                       scotty           == 0.4.*,+                       scotty           >= 0.4.5,                        text             == 0.11.*,                        transformers     >= 0.2.2,-                       wai-extra        == 1.2.*,-                       warp             >= 1.2.0.1      && < 1.3,+                       wai-extra        >= 1.2.0.6      && < 1.4,+                       warp             >= 1.2.0.1      && < 1.4,                        stm              == 2.2.*    GHC-options:  -Wall -fno-warn-orphans
static/index.html view
@@ -46,6 +46,7 @@                  // start the server-side                 $.ajax({ url: "/start",                          type: "POST",+                         contentType: "application/json; charset=utf-8",                          data: $.toJSON([w,h]),                          dataType: "script"});              });