packages feed

diagrams-lib 0.7 → 0.7.1

raw patch · 5 files changed

+95/−8 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Diagrams.Attributes: LineMiterLimit :: (Last Double) -> LineMiterLimit
+ Diagrams.Attributes: getLineMiterLimit :: LineMiterLimit -> Double
+ Diagrams.Attributes: instance AttributeClass LineMiterLimit
+ Diagrams.Attributes: instance Default LineCap
+ Diagrams.Attributes: instance Default LineColor
+ Diagrams.Attributes: instance Default LineJoin
+ Diagrams.Attributes: instance Default LineMiterLimit
+ Diagrams.Attributes: instance Default LineWidth
+ Diagrams.Attributes: instance Semigroup LineMiterLimit
+ Diagrams.Attributes: instance Typeable LineMiterLimit
+ Diagrams.Attributes: lineColorA :: HasStyle a => LineColor -> a -> a
+ Diagrams.Attributes: lineMiterLimit :: HasStyle a => Double -> a -> a
+ Diagrams.Attributes: lineMiterLimitA :: HasStyle a => LineMiterLimit -> a -> a
+ Diagrams.Attributes: lineWidthA :: HasStyle a => LineWidth -> a -> a
+ Diagrams.Attributes: newtype LineMiterLimit
+ Diagrams.TwoD.Text: fontSizeA :: HasStyle a => FontSize -> a -> a
+ Diagrams.TwoD.Text: instance Default FontSize

Files

CHANGES.markdown view
@@ -1,3 +1,24 @@+0.7.1 (11 September 2013)+-------------------------++* **New features**++    - New standard miter limit attribute+    - New functions `lineColorA`, `lineWidthA`, `lineMiterLimitA`,+      `fontSizeA` for directly applying attribute values+    - `setDefault2DAttributes` now sets default line cap (butt), line+      join (miter), and miter limit (10) attributes++* **New instances**++    - `Data.Default` instances for+        - `LineCap`+	- `LineJoin`+	- `LineMiterLimit`+	- `LineWidth`+	- `LineColor`+	- `FontSize`+ 0.7 (9 August 2013) ------------------- 
diagrams-lib.cabal view
@@ -1,5 +1,5 @@ Name:                diagrams-lib-Version:             0.7+Version:             0.7.1 Synopsis:            Embedded domain-specific language for declarative graphics Description:         Diagrams is a flexible, extensible EDSL for creating                      graphics of many types.  Graphics can be created
src/Diagrams/Attributes.hs view
@@ -29,7 +29,7 @@     Color(..), SomeColor(..)    -- ** Line color-  , LineColor, getLineColor, lineColor, lc, lcA+  , LineColor, getLineColor, lineColor, lineColorA, lc, lcA    -- ** Fill color   , FillColor, getFillColor, recommendFillColor, fillColor, fc, fcA@@ -42,7 +42,7 @@    -- * Lines   -- ** Width-  , LineWidth, getLineWidth, lineWidth, lw+  , LineWidth, getLineWidth, lineWidth, lineWidthA, lw    -- ** Cap style   , LineCap(..), LineCapA, getLineCap, lineCap@@ -50,6 +50,9 @@   -- ** Join style   , LineJoin(..), LineJoinA, getLineJoin, lineJoin +  -- ** Miter limit+  , LineMiterLimit(..), getLineMiterLimit, lineMiterLimit, lineMiterLimitA+   -- ** Dashing   , Dashing(..), DashingA, getDashing, dashing @@ -57,6 +60,8 @@  import           Diagrams.Core +import           Data.Default.Class+ import           Data.Colour import           Data.Colour.RGBSpace import           Data.Colour.SRGB (sRGBSpace)@@ -99,6 +104,9 @@   deriving (Typeable, Semigroup) instance AttributeClass LineColor +instance Default LineColor where+    def = LineColor (Last (SomeColor black))+ getLineColor :: LineColor -> SomeColor getLineColor (LineColor (Last c)) = c @@ -110,6 +118,10 @@ lineColor :: (Color c, HasStyle a) => c -> a -> a lineColor = applyAttr . LineColor . Last . SomeColor +-- | Apply a 'lineColor' attribute.+lineColorA :: HasStyle a => LineColor -> a -> a+lineColorA = applyAttr+ -- | A synonym for 'lineColor', specialized to @'Colour' Double@ --   (i.e. opaque colors). lc :: HasStyle a => Colour Double -> a -> a@@ -235,6 +247,9 @@   deriving (Typeable, Semigroup) instance AttributeClass LineWidth +instance Default LineWidth where+    def = LineWidth (Last 0.01)+ getLineWidth :: LineWidth -> Double getLineWidth (LineWidth (Last w)) = w @@ -242,6 +257,10 @@ lineWidth :: HasStyle a => Double -> a -> a lineWidth = applyAttr . LineWidth . Last +-- | Apply a 'LineWidth' attribute.+lineWidthA ::  HasStyle a => LineWidth -> a -> a+lineWidthA = applyAttr+ -- | A convenient synonym for 'lineWidth'. lw :: HasStyle a => Double -> a -> a lw = lineWidth@@ -258,6 +277,9 @@   deriving (Typeable, Semigroup, Eq) instance AttributeClass LineCapA +instance Default LineCap where+    def = LineCapButt+ getLineCap :: LineCapA -> LineCap getLineCap (LineCapA (Last c)) = c @@ -278,12 +300,36 @@   deriving (Typeable, Semigroup, Eq) instance AttributeClass LineJoinA +instance Default LineJoin where+    def = LineJoinMiter+ getLineJoin :: LineJoinA -> LineJoin getLineJoin (LineJoinA (Last j)) = j  -- | Set the segment join style. lineJoin :: HasStyle a => LineJoin -> a -> a lineJoin = applyAttr . LineJoinA . Last+++-- | Miter limit attribute affecting the 'LineJoinMiter' joins.+--   For some backends this value may have additional effects.+newtype LineMiterLimit = LineMiterLimit (Last Double)+  deriving (Typeable, Semigroup)+instance AttributeClass LineMiterLimit++instance Default LineMiterLimit where+    def = LineMiterLimit (Last 10)++getLineMiterLimit :: LineMiterLimit -> Double+getLineMiterLimit (LineMiterLimit (Last l)) = l++-- | Set the miter limit for joins with 'LineJoinMiter'.+lineMiterLimit :: HasStyle a => Double -> a -> a+lineMiterLimit = applyAttr . LineMiterLimit . Last++-- | Apply a 'LineMiterLimit' attribute.+lineMiterLimitA :: HasStyle a => LineMiterLimit -> a -> a+lineMiterLimitA = applyAttr  -- | Create lines that are dashing... er, dashed. data Dashing = Dashing [Double] Double
src/Diagrams/TwoD/Adjust.hs view
@@ -24,18 +24,22 @@  import Diagrams.Core -import Diagrams.Attributes  (lw, lc)+import Diagrams.Attributes  (lineWidthA, lineColorA, lineCap+                            , lineJoin, lineMiterLimitA+                            ) import Diagrams.Util        ((#))  import Diagrams.TwoD.Types  (R2, p2) import Diagrams.TwoD.Size   ( size2D, center2D, SizeSpec2D(..)                             , requiredScaleT, requiredScale                             )-import Diagrams.TwoD.Text   (fontSize)+import Diagrams.TwoD.Text   (fontSizeA)  import Data.AffineSpace     ((.-.)) import Data.Semigroup +import Data.Default.Class+ import Data.Colour.Names    (black)  -- | Set default attributes of a 2D diagram (in case they have not@@ -46,8 +50,15 @@ --       * Line color black -- --       * Font size 1+--+--       * Line cap LineCapButt+--+--       * line join miter+--+--       * Miter limit 10 setDefault2DAttributes :: Semigroup m => QDiagram b R2 m -> QDiagram b R2 m-setDefault2DAttributes d = d # lw 0.01 # lc black # fontSize 1+setDefault2DAttributes d = d # lineWidthA def # lineColorA def # fontSizeA def+                             # lineCap def # lineJoin def # lineMiterLimitA def  -- | Adjust the size and position of a 2D diagram to fit within the --   requested size. The first two arguments specify a method for
src/Diagrams/TwoD/Text.hs view
@@ -24,7 +24,7 @@   -- ** Font family   , Font(..), getFont, font   -- ** Font size-  , FontSize(..), getFontSize, fontSize+  , FontSize(..), getFontSize, fontSize, fontSizeA   -- ** Font slant   , FontSlant(..), FontSlantA, getFontSlant, fontSlant, italic, oblique   -- ** Font weight@@ -41,8 +41,10 @@  import Data.Colour -import Data.Typeable+import           Data.Default.Class +import           Data.Typeable+ ------------------------------------------------------------ -- Text diagrams ------------------------------------------------------------@@ -167,6 +169,9 @@   deriving (Typeable, Semigroup, Eq) instance AttributeClass FontSize +instance Default FontSize where+    def = FontSize (Last 1)+ -- | Extract the size from a @FontSize@ attribute. getFontSize :: FontSize -> Double getFontSize (FontSize (Last s)) = s@@ -176,6 +181,10 @@ --   is @1@. fontSize :: HasStyle a => Double -> a -> a fontSize = applyAttr . FontSize . Last++-- | Apply a 'FontSize' attribute.+fontSizeA :: HasStyle a => FontSize -> a -> a+fontSizeA = applyAttr  -------------------------------------------------- -- Font slant