wumpus-core 0.52.0 → 0.52.1
raw patch · 13 files changed
+161/−69 lines, 13 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Wumpus.Core.Geometry: instance (u ~ Scalar u, Num u, InnerSpace u) => InnerSpace (Vec2 u)
+ Wumpus.Core.Geometry: instance (Num u, InnerSpace u, u ~ Scalar u) => InnerSpace (Vec2 u)
- Wumpus.Core.AffineTrans: reflectXPlane :: (Num u, Scale t, Translate t, u ~ (DUnit t)) => Point2 u -> t -> t
+ Wumpus.Core.AffineTrans: reflectXPlane :: (Num u, Scale t, Translate t, u ~ DUnit t) => Point2 u -> t -> t
- Wumpus.Core.AffineTrans: reflectYPlane :: (Num u, Scale t, Translate t, u ~ (DUnit t)) => Point2 u -> t -> t
+ Wumpus.Core.AffineTrans: reflectYPlane :: (Num u, Scale t, Translate t, u ~ DUnit t) => Point2 u -> t -> t
- Wumpus.Core.AffineTrans: rotate120About :: (RotateAbout t, (DUnit t) ~ u) => Point2 u -> t -> t
+ Wumpus.Core.AffineTrans: rotate120About :: (RotateAbout t, DUnit t ~ u) => Point2 u -> t -> t
- Wumpus.Core.AffineTrans: rotate30About :: (RotateAbout t, (DUnit t) ~ u) => Point2 u -> t -> t
+ Wumpus.Core.AffineTrans: rotate30About :: (RotateAbout t, DUnit t ~ u) => Point2 u -> t -> t
- Wumpus.Core.AffineTrans: rotate45About :: (RotateAbout t, (DUnit t) ~ u) => Point2 u -> t -> t
+ Wumpus.Core.AffineTrans: rotate45About :: (RotateAbout t, DUnit t ~ u) => Point2 u -> t -> t
- Wumpus.Core.AffineTrans: rotate60About :: (RotateAbout t, (DUnit t) ~ u) => Point2 u -> t -> t
+ Wumpus.Core.AffineTrans: rotate60About :: (RotateAbout t, DUnit t ~ u) => Point2 u -> t -> t
- Wumpus.Core.AffineTrans: rotate90About :: (RotateAbout t, (DUnit t) ~ u) => Point2 u -> t -> t
+ Wumpus.Core.AffineTrans: rotate90About :: (RotateAbout t, DUnit t ~ u) => Point2 u -> t -> t
- Wumpus.Core.AffineTrans: rotateAbout :: (RotateAbout t, u ~ (DUnit t)) => Radian -> Point2 u -> t -> t
+ Wumpus.Core.AffineTrans: rotateAbout :: (RotateAbout t, u ~ DUnit t) => Radian -> Point2 u -> t -> t
- Wumpus.Core.AffineTrans: transform :: (Transform t, u ~ (DUnit t)) => Matrix3'3 u -> t -> t
+ Wumpus.Core.AffineTrans: transform :: (Transform t, u ~ DUnit t) => Matrix3'3 u -> t -> t
- Wumpus.Core.AffineTrans: translate :: (Translate t, u ~ (DUnit t)) => u -> u -> t -> t
+ Wumpus.Core.AffineTrans: translate :: (Translate t, u ~ DUnit t) => u -> u -> t -> t
- Wumpus.Core.AffineTrans: translateBy :: (Translate t, (DUnit t) ~ u) => Vec2 u -> t -> t
+ Wumpus.Core.AffineTrans: translateBy :: (Translate t, DUnit t ~ u) => Vec2 u -> t -> t
- Wumpus.Core.BoundingBox: boundary :: (Boundary t, u ~ (DUnit t)) => t -> BoundingBox u
+ Wumpus.Core.BoundingBox: boundary :: (Boundary t, u ~ DUnit t) => t -> BoundingBox u
- Wumpus.Core.Geometry: class Num u => Tolerance u
+ Wumpus.Core.Geometry: class Num u => Tolerance u where length_tolerance = 100 * eq_tolerance
Files
- CHANGES +83/−0
- src/Wumpus/Core/BoundingBox.hs +3/−3
- src/Wumpus/Core/Colour.hs +3/−3
- src/Wumpus/Core/Geometry.hs +3/−3
- src/Wumpus/Core/GraphicProps.hs +3/−3
- src/Wumpus/Core/OutputSVG.hs +7/−7
- src/Wumpus/Core/PictureInternal.hs +8/−8
- src/Wumpus/Core/SVGDoc.hs +13/−13
- src/Wumpus/Core/Text/Base.hs +3/−3
- src/Wumpus/Core/TrafoInternal.hs +6/−6
- src/Wumpus/Core/Utils/FormatCombinators.hs +15/−12
- src/Wumpus/Core/VersionNumber.hs +3/−3
- wumpus-core.cabal +11/−5
CHANGES view
@@ -1,4 +1,87 @@ +0.52.0 to 0.52.1:+ + * Removed internal @(<>)@ format combinator that caused + problems for GHC 7.4.+ +0.51.0 to 0.52.0:+ + * Added limited support for adding SVG ids to text and + Primitives.+ + * Fixed types of @d2r@ and @r2d@ to Double for degrees, rather + than a parametric (Real a, Floating a) type. Although this is+ less general, it removes the burden of type annotating the + common case.+ + * Added the vector functions @orthoVec@, @vsum@ and @vdiff@ to + @Core.Geometry@.+ + * Re-named @clip@ to @clipPrimitive@+ +0.50.0 to 0.51.0:+ + * Added special cases to handle continuity to the function + @lineDirection@ in @Core.Geometry@.+ + * Added @zeroVec@ to @Core.Geometry@.+ + * Extended some Haddock documentation.+ +0.43.0 to 0.50.0:+ + * Major change hence the version number jump - the notion of + parametric unit has been removed from the @Picture@ objects + (it for remains the @Geometric@ objects @Point2@, @Vec2@ etc.). + Certain useful units, e.g. @em@ and @en@, are contextual on + the \"current point size\", and having a parametric unit here + was actually a hinderance to supporting units properly in + higher-level layers. Now all Picture objects (those defined + or exported from @Core.Picture@) are fixed to use Double + - representing PostScript points. Higher level layers that + intend to support alternative units must translate drawing + objects to PostScript point measurements /before/ calling the + Picture API. Geometric objects - objects defined in + @Core.Geometry@, e.g. @Point2@, @Vec2@ - are still polymorphic + on unit. + + * Picture API change - Various function names changed.+ @lineTo@ becomes @absLineTo@ and @curveTo@ becomes + @absCurveTo@. The path builders are qualified with /Prim/, + @vertexPath@ becomes @vertexPrimPath@, @vectorPath@ becomes + @vectorPrimPath@, @emptyPath@ becomes @emptyPrimPath@ and + @curvedPath@ becomes @curvedPrimPath@. @xlink@ becomes + @xlinkPrim@.+ + * API change - @PtSize@ data type replaced by @AfmUnit@ for font + measurements.+ + * API and representation change - clipping paths are represented+ as @Primitive@ constructor rather than a @Picture@ constructor.+ This should make them more useful. The type of the function + @clip@ in @Core.Picture@ has likewise changed.+ + * Picture API change - changed @primPath@ to @absPrimPath@, added+ the functions @relPrimPath@, @relLineTo@, @relCurveTo@.+ + * Added the class @Tolerance@ to @Core.Geometry@ and made the Eq + instances of @Point2@, @Vec2@ and @BoundingBox@ tolerant. + Tolerance accounts for a fairly lax equality on floating point + numbers - it is suitable for Wumpus (printing) where high + accuracy is needed.+ +0.42.1 to 0.43.0:+ + * API change - the function @bezierCircle@ in @Core.Geometry@+ has changed. It now implements a better method of drawing + circles with Bezier curves and no longer needs the + subvision factor. The old circle drawing function has been + retained as @subdivisionCircle@ as it is useful for + corroborating @bezierCircle@, but the general use of + @subdivisionCircle@ should be avoided.+ + * Added a function @bezierEllipse@ to @Core.Geometry@.+ 0.42.0 to 0.42.1: * Fixed bug in the @curvedPath@ function in @Core.Picture@
src/Wumpus/Core/BoundingBox.hs view
@@ -5,7 +5,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Wumpus.Core.BoundingBox--- Copyright : (c) Stephen Tetley 2009-2011+-- Copyright : (c) Stephen Tetley 2009-2012 -- License : BSD3 -- -- Maintainer : stephen.tetley@gmail.com@@ -89,8 +89,8 @@ fmap f (BBox p0 p1) = BBox (fmap f p0) (fmap f p1) instance Format u => Format (BoundingBox u) where- format (BBox p0 p1) = parens (text "BBox" <+> text "ll=" <> format p0 - <+> text "ur=" <> format p1) + format (BBox p0 p1) = parens (text "BBox" <+> text "ll=" >< format p0 + <+> text "ur=" >< format p1) --------------------------------------------------------------------------------
src/Wumpus/Core/Colour.hs view
@@ -3,7 +3,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Wumpus.Core.Colour--- Copyright : (c) Stephen Tetley 2009-2011+-- Copyright : (c) Stephen Tetley 2009-2012 -- License : BSD3 -- -- Maintainer : stephen.tetley@gmail.com@@ -63,8 +63,8 @@ instance Format RGBi where format (RGBi 0 0 0) = text "*black*" format (RGBi 255 255 255) = text "*white*"- format (RGBi r g b) = integral r <> comma <> integral g - <> comma <> integral b+ format (RGBi r g b) = integral r >< comma >< integral g + >< comma >< integral b --------------------------------------------------------------------------------
src/Wumpus/Core/Geometry.hs view
@@ -7,7 +7,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Wumpus.Core.Geometry--- Copyright : (c) Stephen Tetley 2009-2011+-- Copyright : (c) Stephen Tetley 2009-2012 -- License : BSD3 -- -- Maintainer : stephen.tetley@gmail.com@@ -362,7 +362,7 @@ format (V2 a b) = parens (text "Vec" <+> format a <+> format b) instance Format u => Format (Point2 u) where- format (P2 a b) = parens (format a <> comma <+> format b)+ format (P2 a b) = parens (format a >< comma <+> format b) instance Format u => Format (Matrix3'3 u) where format (M3'3 a b c d e f g h i) = @@ -374,7 +374,7 @@ instance Format Radian where- format (Radian d) = double d <> text ":rad"+ format (Radian d) = double d >< text ":rad" -------------------------------------------------------------------------------- -- Vector space instances
src/Wumpus/Core/GraphicProps.hs view
@@ -3,7 +3,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Wumpus.Core.GraphicProps--- Copyright : (c) Stephen Tetley 2009-2011+-- Copyright : (c) Stephen Tetley 2009-2012 -- License : BSD3 -- -- Maintainer : stephen.tetley@gmail.com@@ -253,7 +253,7 @@ format (CFill rgb) = format rgb <+> text "Fill" format (CStroke _ rgb) = format rgb <+> text "Closed-stroke" format (OStroke _ rgb) = format rgb <+> text "Open-stroke"- format (CFillStroke f _ s) = format f <+> text "Fill" <> char '/'+ format (CFillStroke f _ s) = format f <+> text "Fill" >< char '/' <+> format s <+> text "Stroke" @@ -265,7 +265,7 @@ instance Format EllipseProps where format (EFill rgb) = format rgb <+> text "Fill" format (EStroke _ rgb) = format rgb <+> text "Stroke"- format (EFillStroke f _ s) = format f <+> text "Fill" <> char '/'+ format (EFillStroke f _ s) = format f <+> text "Fill" >< char '/' <+> format s <+> text "Stroke" --------------------------------------------------------------------------------
src/Wumpus/Core/OutputSVG.hs view
@@ -4,7 +4,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Wumpus.Core.OutputSVG--- Copyright : (c) Stephen Tetley 2009-2011+-- Copyright : (c) Stephen Tetley 2009-2012 -- License : BSD3 -- -- Maintainer : stephen.tetley@gmail.com@@ -472,21 +472,21 @@ makeFontAttrs :: FontAttr -> Doc makeFontAttrs (FontAttr sz face) = attr_font_family (svg_font_family face) <+> attr_font_size sz - <> suffix (svg_font_style face) + >< suffix (svg_font_style face) where suffix SVG_REGULAR = empty - suffix SVG_BOLD = space <> attr_font_weight "bold"+ suffix SVG_BOLD = space >< attr_font_weight "bold" - suffix SVG_ITALIC = space <> attr_font_style "italic"+ suffix SVG_ITALIC = space >< attr_font_style "italic" suffix SVG_BOLD_ITALIC = - space <> attr_font_weight "bold" <+> attr_font_style "italic"+ space >< attr_font_weight "bold" <+> attr_font_style "italic" - suffix SVG_OBLIQUE = space <> attr_font_style "oblique"+ suffix SVG_OBLIQUE = space >< attr_font_style "oblique" suffix SVG_BOLD_OBLIQUE = - space <> attr_font_weight "bold" <+> attr_font_style "oblique"+ space >< attr_font_weight "bold" <+> attr_font_style "oblique"
src/Wumpus/Core/PictureInternal.hs view
@@ -5,7 +5,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Wumpus.Core.PictureInternal--- Copyright : (c) Stephen Tetley 2009-2011+-- Copyright : (c) Stephen Tetley 2009-2012 -- License : BSD3 -- -- Maintainer : stephen.tetley@gmail.com@@ -417,19 +417,19 @@ instance Format PrimPath where format (PrimPath vs ctm) = vcat [ hcat $ map format vs- , text "ctm=" <> format ctm ]+ , text "ctm=" >< format ctm ] instance Format PrimPathSegment where format (RelCurveTo p1 p2 p3) =- text "rel_curve_to " <> format p1 <+> format p2 <+> format p3+ text "rel_curve_to " >< format p1 <+> format p2 <+> format p3 - format (RelLineTo pt) = text "rel_line_to " <> format pt+ format (RelLineTo pt) = text "rel_line_to " >< format pt instance Format PrimLabel where format (PrimLabel s opt_id ctm) = vcat [ dquotes (format s) , maybe (char '_') text $ opt_id - , text "ctm=" <> format ctm+ , text "ctm=" >< format ctm ] instance Format LabelBody where@@ -439,9 +439,9 @@ instance Format PrimEllipse where- format (PrimEllipse hw hh ctm) = text "hw=" <> format hw- <+> text "hh=" <> format hh- <+> text "ctm=" <> format ctm+ format (PrimEllipse hw hh ctm) = text "hw=" >< format hw+ <+> text "hh=" >< format hh+ <+> text "ctm=" >< format ctm instance Format XLink where
src/Wumpus/Core/SVGDoc.hs view
@@ -3,7 +3,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Wumpus.Core.SVGDoc--- Copyright : (c) Stephen Tetley 2009-2011+-- Copyright : (c) Stephen Tetley 2009-2012 -- License : BSD3 -- -- Maintainer : stephen.tetley@gmail.com@@ -85,7 +85,7 @@ escapeSpecial :: Int -> Doc-escapeSpecial i = text "&#" <> int i <> char ';'+escapeSpecial i = text "&#" >< int i >< char ';' -- Note - it is easier put particular attrs at the end (esp. d @@ -99,25 +99,25 @@ svgElemB name attrs body = vcat [ open, indent 2 body, close ] where open = angles (text name <+> attrs)- close = angles (char '/' <> text name)+ close = angles (char '/' >< text name) svgElemB_no_attrs :: String -> Doc -> Doc svgElemB_no_attrs name body = vcat [ open, indent 2 body, close ] where open = angles (text name)- close = angles (char '/' <> text name)+ close = angles (char '/' >< text name) -- 1 line version of svgElemB -- svgElemB1 :: String -> Doc -> Doc -> Doc-svgElemB1 name attrs body = open <> body <> close+svgElemB1 name attrs body = open >< body >< close where open = angles (text name <+> attrs)- close = angles (char '/' <> text name)+ close = angles (char '/' >< text name) svgAttr :: String -> Doc -> Doc-svgAttr name val = text name <> char '=' <> dquotes val+svgAttr name val = text name >< char '=' >< dquotes val dquoteText :: String -> Doc dquoteText = dquotes . text @@ -303,7 +303,7 @@ val_rgb :: RGBi -> Doc val_rgb (RGBi r g b) = - text "rgb" <> tupled [integral r, integral g, integral b]+ text "rgb" >< tupled [integral r, integral g, integral b] -- | @ font-family=\"...\" @@@ -384,8 +384,8 @@ attr_stroke_dasharray = svgAttr "stroke-dasharray" . step where step [] = empty- step [(a,b)] = int a <> comma <> int b - step ((a,b):xs) = int a <> comma <> int b <> step xs+ step [(a,b)] = int a >< comma >< int b + step ((a,b):xs) = int a >< comma >< int b >< step xs -- | @ stroke-dasharray=\"none\" @ --@@ -400,7 +400,7 @@ -- | @ clip_path="url(#...)" @ -- attr_clip_path :: String -> Doc-attr_clip_path ss = svgAttr "clip-path" (text "url" <> parens (text $ '#':ss)) +attr_clip_path ss = svgAttr "clip-path" (text "url" >< parens (text $ '#':ss)) -- | @ transform="..." @@@ -411,7 +411,7 @@ -- | @ matrix(..., ..., ..., ..., ..., ...) @ -- val_matrix :: Matrix3'3 Double -> Doc-val_matrix mtrx = text "matrix" <> tupled (map dtruncFmt [a,b,c,d,e,f])+val_matrix mtrx = text "matrix" >< tupled (map dtruncFmt [a,b,c,d,e,f]) where (a,b,c,d,e,f) = deconsMatrix mtrx @@ -427,4 +427,4 @@ -- | @ translate(..., ..., ..., ..., ..., ...) @ -- val_translate :: DVec2 -> Doc-val_translate (V2 x y) = text "translate" <> tupled [dtruncFmt x, dtruncFmt y]+val_translate (V2 x y) = text "translate" >< tupled [dtruncFmt x, dtruncFmt y]
src/Wumpus/Core/Text/Base.hs view
@@ -3,7 +3,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Wumpus.Core.Text.Base--- Copyright : (c) Stephen Tetley 2010-2011+-- Copyright : (c) Stephen Tetley 2010-2012 -- License : BSD3 -- -- Maintainer : stephen.tetley@gmail.com@@ -135,8 +135,8 @@ instance Format EscapedChar where format (CharLiteral c) = char c- format (CharEscInt i) = text "&#" <> int i <> semicolon- format (CharEscName s) = text "&" <> text s <> semicolon+ format (CharEscInt i) = text "&#" >< int i >< semicolon+ format (CharEscName s) = text "&" >< text s >< semicolon instance Monoid EscapedText where
src/Wumpus/Core/TrafoInternal.hs view
@@ -4,7 +4,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Wumpus.Core.TrafoInternal--- Copyright : (c) Stephen Tetley 2010-2011+-- Copyright : (c) Stephen Tetley 2010-2012 -- License : BSD3 -- -- Maintainer : stephen.tetley@gmail.com@@ -96,11 +96,11 @@ instance Format PrimCTM where format (PrimCTM dx dy sx sy ang) = - parens (text "CTM" <+> text "dx =" <> dtruncFmt dx- <+> text "dy =" <> dtruncFmt dy- <+> text "sx =" <> dtruncFmt sx - <+> text "sy =" <> dtruncFmt sy - <+> text "ang=" <> format ang )+ parens (text "CTM" <+> text "dx =" >< dtruncFmt dx+ <+> text "dy =" >< dtruncFmt dy+ <+> text "sx =" >< dtruncFmt sx + <+> text "sy =" >< dtruncFmt sy + <+> text "ang=" >< format ang )
src/Wumpus/Core/Utils/FormatCombinators.hs view
@@ -3,7 +3,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Wumpus.Core.Utils.FormatCombinators--- Copyright : (c) Stephen Tetley 2010-2011+-- Copyright : (c) Stephen Tetley 2010-2012 -- License : BSD3 -- -- Maintainer : stephen.tetley@gmail.com@@ -21,7 +21,7 @@ , Format(..) , empty , showsDoc- , (<>)+ , (><) , (<+>) , vconcat , separate@@ -117,7 +117,7 @@ instance Monoid Doc where mempty = empty- mappend = (<>)+ mappend = (><) --------------------------------------------------------------------------------@@ -136,7 +136,6 @@ -------------------------------------------------------------------------------- -infixr 6 <>, <+> @@ -151,13 +150,17 @@ showsDoc = Doc1 +infixr 6 ><+ -- | Horizontally concatenate two documents with no space -- between them. -- -(<>) :: Doc -> Doc -> Doc-a <> b = Join a b +(><) :: Doc -> Doc -> Doc+a >< b = Join a b +infixr 6 <+>+ -- | Horizontally concatenate two documents with a single space -- between them. -- @@ -167,7 +170,7 @@ -- | Vertical concatenate two documents with a line break. -- vconcat :: Doc -> Doc -> Doc-vconcat a b = a <> Line <> b+vconcat a b = a >< Line >< b @@ -176,12 +179,12 @@ separate sep (a:as) = step a as where step acc [] = acc- step acc (x:xs) = step (acc <> sep <> x) xs+ step acc (x:xs) = step (acc >< sep >< x) xs -- | Horizontally concatenate a list of documents with @(\<\>)@. -- hcat :: [Doc] -> Doc-hcat = foldr (<>) empty+hcat = foldr (><) empty -- | Horizontally concatenate a list of documents with @(\<+\>)@. --@@ -288,17 +291,17 @@ punctuate :: Doc -> [Doc] -> Doc punctuate _ [] = empty punctuate _ [x] = x-punctuate s (x:xs) = x <> s <> punctuate s xs+punctuate s (x:xs) = x >< s >< punctuate s xs -- | Enclose the final Doc within the first two. -- -- There are no spaces between the documents: ----- > enclose l r d = l <> d <> r+-- > enclose l r d = l >< d >< r -- enclose :: Doc -> Doc -> Doc -> Doc-enclose l r d = l <> d <> r+enclose l r d = l >< d >< r
src/Wumpus/Core/VersionNumber.hs view
@@ -3,7 +3,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Wumpus.Core.VersionNumber--- Copyright : (c) Stephen Tetley 2010-2011+-- Copyright : (c) Stephen Tetley 2010-2012 -- License : BSD3 -- -- Maintainer : stephen.tetley@gmail.com@@ -22,7 +22,7 @@ -- | Version number. ----- > (0,52,0)+-- > (0,52,1) -- wumpus_core_version :: (Int,Int,Int)-wumpus_core_version = (0,52,0)+wumpus_core_version = (0,52,1)
wumpus-core.cabal view
@@ -1,5 +1,5 @@ name: wumpus-core-version: 0.52.0+version: 0.52.1 license: BSD3 license-file: LICENSE copyright: Stephen Tetley <stephen.tetley@gmail.com>@@ -12,9 +12,10 @@ Wumpus-Core is a low-level library for generating static 2D vector pictures, its salient feature is portability due to no FFI dependencies. It can generate PostScript (EPS) files and SVG - files. The generated PostScript code is plain and reasonably + files. The generated PostScript code is plain and someways efficient as the use of stack operations, i.e @gsave@ and - @grestore@, is minimized. + @grestore@, is minimized (unfortunately there is no sharing + so the generated PostScript can be huge...). . Although Wumpus-Core only generates vector output, the generated PostScript can be interpreted by GraphicsMagick or a similar @@ -24,8 +25,8 @@ themselves are made from points. The usual affine transformations (rotations, scaling, translations) can be applied to Pictures. Unlike PostScript there is no notion of a - current point, Wumpus-Core builds pictures in a coordinate-free - style. + current point, Wumpus-Core builds pictures by direct + positioning of each element. . GENERAL DRAWBACKS... .@@ -48,6 +49,11 @@ . Changelog: . + v0.52.0 to v0.52.1:+ .+ * Removed internal @(<>)@ format combinator that caused + problems for GHC 7.4.+ . v0.51.0 to v0.52.0: . * Added limited support for adding SVG ids to text and