curves 1.1.0.1 → 1.1.0.2
raw patch · 3 files changed
+42/−7 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Graphics.Curves: instance ImageElement Image
- Graphics.Curves: instance ImageElement Segment
- Graphics.Curves: instance ImageElement Vec
- Graphics.Curves.Colour: getAlpha :: Colour' a -> !a
- Graphics.Curves.Colour: getBlue :: Colour' a -> !a
- Graphics.Curves.Colour: getGreen :: Colour' a -> !a
- Graphics.Curves.Colour: getRed :: Colour' a -> !a
- Graphics.Curves.Colour: instance (Ord a, Num a) => Num (Colour' a)
- Graphics.Curves.Colour: instance Applicative Colour'
- Graphics.Curves.Colour: instance Eq a => Eq (Colour' a)
- Graphics.Curves.Colour: instance Foldable Colour'
- Graphics.Curves.Colour: instance Functor Colour'
- Graphics.Curves.Colour: instance Ord a => Ord (Colour' a)
- Graphics.Curves.Colour: instance Show a => Show (Colour' a)
- Graphics.Curves.Colour: instance Traversable Colour'
- Graphics.Curves.Math: getEnd :: Segment -> !Point
- Graphics.Curves.Math: getStart :: Segment -> !Point
- Graphics.Curves.Math: getX :: Vec -> !Scalar
- Graphics.Curves.Math: getY :: Vec -> !Scalar
- Graphics.Curves.Math: instance (Transformable a, Transformable b) => Transformable (Either a b)
- Graphics.Curves.Math: instance (Transformable a, Transformable b) => Transformable (a, b)
- Graphics.Curves.Math: instance (Transformable a, Transformable b, Transformable c) => Transformable (a, b, c)
- Graphics.Curves.Math: instance DistanceToPoint Segment
- Graphics.Curves.Math: instance DistanceToPoint Vec
- Graphics.Curves.Math: instance Eq Basis
- Graphics.Curves.Math: instance Eq Segment
- Graphics.Curves.Math: instance Eq Vec
- Graphics.Curves.Math: instance Fractional Vec
- Graphics.Curves.Math: instance Num Vec
- Graphics.Curves.Math: instance Ord Basis
- Graphics.Curves.Math: instance Ord Segment
- Graphics.Curves.Math: instance Ord Vec
- Graphics.Curves.Math: instance Show Basis
- Graphics.Curves.Math: instance Show Segment
- Graphics.Curves.Math: instance Show Vec
- Graphics.Curves.Math: instance Transformable ()
- Graphics.Curves.Math: instance Transformable (Rigid a)
- Graphics.Curves.Math: instance Transformable Basis
- Graphics.Curves.Math: instance Transformable Segment
- Graphics.Curves.Math: instance Transformable Vec
- Graphics.Curves.Math: instance Transformable a => Transformable (Maybe a)
- Graphics.Curves.Math: instance Transformable a => Transformable [a]
- Graphics.Curves.Math: instance Transformable b => Transformable (a -> b)
- Graphics.Curves.Math: origin :: Basis -> Point
- Graphics.Curves.Math: xUnit :: Basis -> Point
- Graphics.Curves.Math: yUnit :: Basis -> Point
- Graphics.Curves.SVG.Path: instance Show CoordType
- Graphics.Curves.SVG.Path: instance Show PathCmd
- Graphics.Curves.SVG.Path: instance Show PathToken
- Graphics.Curves.Text.Fonts.Liberation: instance Eq FontStyle
- Graphics.Curves.Text.Fonts.Liberation: instance Eq Modifier
- Graphics.Curves.Text.Fonts.Liberation: instance Ord FontStyle
- Graphics.Curves.Text.Fonts.Liberation: instance Ord Modifier
- Graphics.Curves.Text.Fonts.Liberation: instance Show FontStyle
- Graphics.Curves.Text.Fonts.Liberation: instance Show Modifier
+ Graphics.Curves: instance Graphics.Curves.ImageElement Graphics.Curves.Image.Image
+ Graphics.Curves: instance Graphics.Curves.ImageElement Graphics.Curves.Math.Segment
+ Graphics.Curves: instance Graphics.Curves.ImageElement Graphics.Curves.Math.Vec
+ Graphics.Curves.Colour: [getRed, getGreen, getBlue, getAlpha] :: Colour' a -> !a
+ Graphics.Curves.Colour: instance (GHC.Classes.Ord a, GHC.Num.Num a) => GHC.Num.Num (Graphics.Curves.Colour.Colour' a)
+ Graphics.Curves.Colour: instance Data.Foldable.Foldable Graphics.Curves.Colour.Colour'
+ Graphics.Curves.Colour: instance Data.Traversable.Traversable Graphics.Curves.Colour.Colour'
+ Graphics.Curves.Colour: instance GHC.Base.Applicative Graphics.Curves.Colour.Colour'
+ Graphics.Curves.Colour: instance GHC.Base.Functor Graphics.Curves.Colour.Colour'
+ Graphics.Curves.Colour: instance GHC.Classes.Eq a => GHC.Classes.Eq (Graphics.Curves.Colour.Colour' a)
+ Graphics.Curves.Colour: instance GHC.Classes.Ord a => GHC.Classes.Ord (Graphics.Curves.Colour.Colour' a)
+ Graphics.Curves.Colour: instance GHC.Show.Show a => GHC.Show.Show (Graphics.Curves.Colour.Colour' a)
+ Graphics.Curves.Math: [getStart, getEnd] :: Segment -> !Point
+ Graphics.Curves.Math: [getX, getY] :: Vec -> !Scalar
+ Graphics.Curves.Math: [origin, xUnit, yUnit] :: Basis -> Point
+ Graphics.Curves.Math: instance (Graphics.Curves.Math.Transformable a, Graphics.Curves.Math.Transformable b) => Graphics.Curves.Math.Transformable (Data.Either.Either a b)
+ Graphics.Curves.Math: instance (Graphics.Curves.Math.Transformable a, Graphics.Curves.Math.Transformable b) => Graphics.Curves.Math.Transformable (a, b)
+ Graphics.Curves.Math: instance (Graphics.Curves.Math.Transformable a, Graphics.Curves.Math.Transformable b, Graphics.Curves.Math.Transformable c) => Graphics.Curves.Math.Transformable (a, b, c)
+ Graphics.Curves.Math: instance GHC.Classes.Eq Graphics.Curves.Math.Basis
+ Graphics.Curves.Math: instance GHC.Classes.Eq Graphics.Curves.Math.Segment
+ Graphics.Curves.Math: instance GHC.Classes.Eq Graphics.Curves.Math.Vec
+ Graphics.Curves.Math: instance GHC.Classes.Ord Graphics.Curves.Math.Basis
+ Graphics.Curves.Math: instance GHC.Classes.Ord Graphics.Curves.Math.Segment
+ Graphics.Curves.Math: instance GHC.Classes.Ord Graphics.Curves.Math.Vec
+ Graphics.Curves.Math: instance GHC.Num.Num Graphics.Curves.Math.Vec
+ Graphics.Curves.Math: instance GHC.Real.Fractional Graphics.Curves.Math.Vec
+ Graphics.Curves.Math: instance GHC.Show.Show Graphics.Curves.Math.Basis
+ Graphics.Curves.Math: instance GHC.Show.Show Graphics.Curves.Math.Segment
+ Graphics.Curves.Math: instance GHC.Show.Show Graphics.Curves.Math.Vec
+ Graphics.Curves.Math: instance Graphics.Curves.Math.DistanceToPoint Graphics.Curves.Math.Segment
+ Graphics.Curves.Math: instance Graphics.Curves.Math.DistanceToPoint Graphics.Curves.Math.Vec
+ Graphics.Curves.Math: instance Graphics.Curves.Math.Transformable ()
+ Graphics.Curves.Math: instance Graphics.Curves.Math.Transformable (Graphics.Curves.Math.Rigid a)
+ Graphics.Curves.Math: instance Graphics.Curves.Math.Transformable Graphics.Curves.Math.Basis
+ Graphics.Curves.Math: instance Graphics.Curves.Math.Transformable Graphics.Curves.Math.Segment
+ Graphics.Curves.Math: instance Graphics.Curves.Math.Transformable Graphics.Curves.Math.Vec
+ Graphics.Curves.Math: instance Graphics.Curves.Math.Transformable a => Graphics.Curves.Math.Transformable (GHC.Base.Maybe a)
+ Graphics.Curves.Math: instance Graphics.Curves.Math.Transformable a => Graphics.Curves.Math.Transformable [a]
+ Graphics.Curves.Math: instance Graphics.Curves.Math.Transformable b => Graphics.Curves.Math.Transformable (a -> b)
+ Graphics.Curves.SVG.Path: instance GHC.Show.Show Graphics.Curves.SVG.Path.CoordType
+ Graphics.Curves.SVG.Path: instance GHC.Show.Show Graphics.Curves.SVG.Path.PathCmd
+ Graphics.Curves.SVG.Path: instance GHC.Show.Show Graphics.Curves.SVG.Path.PathToken
+ Graphics.Curves.Text.Fonts.Liberation: instance GHC.Classes.Eq Graphics.Curves.Text.Fonts.Liberation.FontStyle
+ Graphics.Curves.Text.Fonts.Liberation: instance GHC.Classes.Eq Graphics.Curves.Text.Fonts.Liberation.Modifier
+ Graphics.Curves.Text.Fonts.Liberation: instance GHC.Classes.Ord Graphics.Curves.Text.Fonts.Liberation.FontStyle
+ Graphics.Curves.Text.Fonts.Liberation: instance GHC.Classes.Ord Graphics.Curves.Text.Fonts.Liberation.Modifier
+ Graphics.Curves.Text.Fonts.Liberation: instance GHC.Show.Show Graphics.Curves.Text.Fonts.Liberation.FontStyle
+ Graphics.Curves.Text.Fonts.Liberation: instance GHC.Show.Show Graphics.Curves.Text.Fonts.Liberation.Modifier
- Graphics.Curves.Colour: Colour :: !a -> !a -> !a -> !a -> Colour' a
+ Graphics.Curves.Colour: Colour :: !a -> Colour' a
- Graphics.Curves.Math: Basis :: Point -> Point -> Point -> Basis
+ Graphics.Curves.Math: Basis :: Point -> Basis
- Graphics.Curves.Math: Seg :: !Point -> !Point -> Segment
+ Graphics.Curves.Math: Seg :: !Point -> Segment
- Graphics.Curves.Math: Vec :: !Scalar -> !Scalar -> Vec
+ Graphics.Curves.Math: Vec :: !Scalar -> Vec
Files
- Graphics/Curves/Math.hs +0/−1
- Graphics/Curves/SVG/Path.hs +39/−3
- curves.cabal +3/−3
Graphics/Curves/Math.hs view
@@ -27,7 +27,6 @@ ) where import Control.Applicative-import Test.QuickCheck type Scalar = Double
Graphics/Curves/SVG/Path.hs view
@@ -35,15 +35,50 @@ show (TokCmd c) = [c] show (TokNum x) = show x +lexNum :: String -> Maybe (String, String)+lexNum s = start s+ where+ eat c = fmap (\(a, b) -> (c:a, b))+ ret s = Just ("", s)+ bad = Nothing++ start ('-':s) = eat '-' $ num s+ start s = num s++ num (c:s) | isDigit c = eat c $ num1 s+ num _ = bad++ num1 (c:s) | isDigit c = eat c $ num1 s+ num1 ('.':s) = eat '.' $ frac s+ num1 ('e':s) = eat 'e' $ expn s+ num1 s = ret s++ frac (c:s) | isDigit c = eat c $ frac1 s++ frac1 (c:s) | isDigit c = eat c $ frac1 s+ frac1 ('e':s) = eat 'e' $ expn s+ frac1 s = ret s++ expn ('-':s) = eat '-' $ expn1 s+ expn s = expn1 s++ expn1 (c:s) | isDigit c = eat c $ expn2 s+ expn1 _ = bad++ expn2 (c:s) | isDigit c = eat c $ expn2 s+ expn2 s = ret s+ lexPath :: String -> [PathToken] lexPath [] = [] lexPath (c:s) | isAlpha c = TokCmd c : lexPath s- | isNumChar c = case span isNumChar s of- (d, s') -> TokNum (read (c:d)) : lexPath s'+ | isNumChar c =+ case lexNum (c:s) of+ Just (d, s') -> TokNum (read d) : lexPath s'+ Nothing -> error $ "lex error on " ++ show (take 25 (c:s)) ++ "..." | otherwise = lexPath s where- isNumChar c = isDigit c || elem c "-."+ isNumChar c = isDigit c || c == '-' -- | Read a path string. parsePath :: String -> Path@@ -93,6 +128,7 @@ argsN :: Int -> Char -> ([Scalar] -> PathCmd) -> [PathToken] -> Path argsN n c f ts | all isNum xs = f (map getNum xs) : next c ts'+ | otherwise = error $ "Expected " ++ show n ++ " numerical arguments to " ++ show c ++ ". Got: " ++ show xs where (xs, ts') = splitAt n ts
curves.cabal view
@@ -1,5 +1,5 @@ Name: curves-Version: 1.1.0.1+Version: 1.1.0.2 Category: Graphics License: MIT License-file: LICENSE@@ -40,7 +40,7 @@ containers >= 0.4, filepath >= 1.3, JuicyPixels >= 2.0- Exposed-Modules: + Exposed-Modules: Graphics.Curves Graphics.Curves.Attribute Graphics.Curves.Colour@@ -52,7 +52,7 @@ Graphics.Curves.SVG.Path Graphics.Curves.Text Graphics.Curves.Text.Fonts.Liberation- Other-Modules: + Other-Modules: Graphics.Curves.BoundingBox Graphics.Curves.Compile Graphics.Curves.Curve