Rasterific 0.4 → 0.4.1
raw patch · 38 files changed
+278/−62 lines, 38 filesdep ~basedep ~criterion
Dependency ranges changed: base, criterion
Files
- Rasterific.cabal +4/−3
- changelog +4/−1
- docimages/cap_straight.png binary
- docimages/fill_evenodd.png binary
- docimages/fill_winding.png binary
- docimages/geometry_on_path.png binary
- docimages/linear_gradient.png binary
- docimages/module_example.png binary
- docimages/radial_gradient_focus.png binary
- docimages/sampled_texture_reflect.png binary
- docimages/sampled_texture_rotate.png binary
- docimages/sampled_texture_scaled.png binary
- docimages/sampler_pad.png binary
- docimages/sampler_reflect.png binary
- docimages/sampler_repeat.png binary
- docimages/stroke_line.png binary
- docimages/stroke_polyline.png binary
- docimages/strokize_dashed_path.png binary
- docimages/text_on_path.png binary
- exec-src/rastertest.hs +7/−10
- src/Graphics/Rasterific.hs +7/−1
- src/Graphics/Rasterific/Command.hs +5/−1
- src/Graphics/Rasterific/Compositor.hs +1/−0
- src/Graphics/Rasterific/CubicBezier.hs +9/−5
- src/Graphics/Rasterific/Immediate.hs +12/−13
- src/Graphics/Rasterific/Lenses.hs +147/−0
- src/Graphics/Rasterific/Line.hs +9/−2
- src/Graphics/Rasterific/Linear.hs +2/−0
- src/Graphics/Rasterific/Operators.hs +5/−2
- src/Graphics/Rasterific/PathWalker.hs +9/−2
- src/Graphics/Rasterific/PlaneBoundable.hs +9/−2
- src/Graphics/Rasterific/QuadraticBezier.hs +6/−1
- src/Graphics/Rasterific/QuadraticFormula.hs +3/−0
- src/Graphics/Rasterific/Rasterize.hs +5/−1
- src/Graphics/Rasterific/Shading.hs +12/−12
- src/Graphics/Rasterific/StrokeInternal.hs +11/−4
- src/Graphics/Rasterific/Transformations.hs +5/−1
- src/Graphics/Rasterific/Types.hs +6/−1
@@ -1,7 +1,7 @@ -- Initial Rasterific.cabal generated by cabal init. For further -- documentation, see http://haskell.org/cabal/users-guide/ name: Rasterific -version: 0.4 +version: 0.4.1 synopsis: A pure haskell drawing engine. -- A longer description of the package. description: @@ -34,7 +34,7 @@ Source-Repository this Type: git Location: git://github.com/Twinside/Rasterific.git - Tag: v0.4 + Tag: v0.4.1 flag embed_linear description: Embed a reduced version of Linear avoiding a (huge) dep @@ -46,6 +46,7 @@ , Graphics.Rasterific.Outline , Graphics.Rasterific.Texture , Graphics.Rasterific.Linear + , Graphics.Rasterific.Lenses , Graphics.Rasterific.Transformations , Graphics.Rasterific.Immediate , Graphics.Rasterific.PathWalker @@ -98,7 +99,7 @@ , binary , QuickCheck , deepseq - , criterion + , criterion >= 1.0 , statistics --, groom
@@ -1,6 +1,9 @@ -*-change-log-*- -v0.4 2014 +v0.4.1 January 2015 + * Fix: GHC 7.10 compilation + +v0.4 December 2014 * Breaking change: Changed the original position scheme for text, allowing to specify baseline or upper left corner
binary file changed (1785 → 1786 bytes)
binary file changed (6039 → 6040 bytes)
binary file changed (4454 → 4454 bytes)
binary file changed (5067 → 5068 bytes)
binary file changed (4401 → 4870 bytes)
binary file changed (2331 → 2335 bytes)
binary file changed (19019 → 19023 bytes)
binary file changed (64727 → 64691 bytes)
binary file changed (109884 → 109884 bytes)
binary file changed (102643 → 102643 bytes)
binary file changed (1819 → 2650 bytes)
binary file changed (2980 → 5931 bytes)
binary file changed (2374 → 4896 bytes)
binary file changed (3022 → 3023 bytes)
binary file changed (2830 → 2849 bytes)
binary file changed (10013 → 10017 bytes)
binary file changed (6313 → 6314 bytes)
@@ -20,11 +20,10 @@ import Codec.Picture import Arbitrary import System.Environment( getArgs ) -import Criterion.Config( defaultConfig ) -import Criterion.Main( parseArgs - , defaultOptions - , defaultMainWith +import Criterion.Main.Options( defaultConfig ) +import Criterion.Main( defaultMainWith , bench + , nfIO ) {-import Text.Groom( groom )-} import qualified Sample as Sample @@ -714,12 +713,10 @@ -- -} benchTest :: [String] -> IO () -benchTest args = do - (config, _) <- - parseArgs defaultConfig defaultOptions args - defaultMainWith config (return ()) - [bench "testsuite" testSuite, - bench "Triangles" Sample.triangles] +benchTest _args = do + defaultMainWith defaultConfig + [bench "testsuite" $ nfIO testSuite, + bench "Triangles" $ nfIO Sample.triangles] main :: IO () main = do
@@ -5,6 +5,7 @@ {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE CPP #-} -- | Main module of Rasterific, an Haskell rasterization engine. -- -- Creating an image is rather simple, here is a simple example @@ -112,13 +113,18 @@ ) where +#if !MIN_VERSION_base(4,8,0) +import Data.Monoid( Monoid( .. ) ) +#endif + +import Data.Monoid( (<>) ) + import Control.Applicative( (<$>) ) import Control.Monad.Free( Free( .. ), liftF ) import Control.Monad.Free.Church( fromF ) import Control.Monad.ST( runST ) import Control.Monad.State( modify, execState ) import Data.Maybe( fromMaybe ) -import Data.Monoid( Monoid( .. ), (<>) ) import Codec.Picture.Types( Image( .. ), Pixel( .. ) ) import qualified Data.Vector.Unboxed as VU
@@ -3,15 +3,19 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE CPP #-} module Graphics.Rasterific.Command ( Drawing , DrawCommand( .. ) , TextRange( .. ) , dumpDrawing ) where +#if !MIN_VERSION_base(4,8,0) +import Data.Monoid( Monoid( .. ) ) +#endif + import Control.Monad.Free( Free( .. ), liftF ) import Control.Monad.Free.Church( F, fromF ) -import Data.Monoid( Monoid( .. ) ) import Codec.Picture.Types( Pixel( .. ), Pixel8 ) import Graphics.Rasterific.Types
@@ -1,5 +1,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE TypeFamilies #-} -- | Compositor handle the pixel composition, which -- leads to texture composition. -- Very much a work in progress
@@ -1,6 +1,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE BangPatterns #-} +{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.Rasterific.CubicBezier ( cubicBezierCircle @@ -16,10 +17,14 @@ ) where import Prelude hiding( or ) -import Control.Applicative( liftA2 - , (<$>) - , pure - ) + +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative( pure ) +import Data.Monoid( mempty ) +#endif + +import Data.Monoid( (<>) ) +import Control.Applicative( liftA2, (<$>)) import Graphics.Rasterific.Linear ( V2( .. ) , (^-^) @@ -29,7 +34,6 @@ , lerp ) import Data.List( nub ) -import Data.Monoid( mempty, (<>) ) import Graphics.Rasterific.Operators import Graphics.Rasterific.Types import Graphics.Rasterific.QuadraticFormula
@@ -28,12 +28,10 @@ import qualified Data.Foldable as F import Control.Monad.Free( liftF ) -import Control.Monad.ST( ST ) import Control.Monad.State( StateT, execStateT, get, lift ) +import Control.Monad.State.Class(MonadState) import Codec.Picture.Types( Image( .. ) , Pixel( .. ) - , Pixel8 - , PixelRGBA8 , MutableImage( .. ) , unsafeFreezeImage , fillImageWith ) @@ -49,8 +47,8 @@ import Graphics.Rasterific.Command -- | Monad used to describe the drawing context. -type DrawContext m px a = - StateT (MutableImage (PrimState m) px) m a +type DrawContext m px = + StateT (MutableImage (PrimState m) px) m -- | Reify a filling function call, to be able to manipulate -- them in a simpler fashion. @@ -127,17 +125,14 @@ -- -- <<docimages/immediate_fill.png>> -- -fillWithTexture :: (PrimMonad m, RenderablePixel px) +fillWithTexture :: (PrimMonad m, RenderablePixel px, + MonadState (MutableImage (PrimState m) px) + (DrawContext m px) + ) => FillMethod -> Texture px -- ^ Color/Texture used for the filling -> [Primitive] -- ^ Primitives to fill -> DrawContext m px () -{-# SPECIALIZE fillWithTexture - :: FillMethod -> Texture PixelRGBA8 -> [Primitive] - -> DrawContext (ST s) PixelRGBA8 () #-} -{-# SPECIALIZE fillWithTexture - :: FillMethod -> Texture Pixel8 -> [Primitive] - -> DrawContext (ST s) Pixel8 () #-} fillWithTexture fillMethod texture els = do img@(MutableImage width height _) <- get let !mini = V2 0 0 @@ -168,7 +163,11 @@ -- <<docimages/immediate_mask.png>> -- fillWithTextureAndMask - :: (PrimMonad m, RenderablePixel px) + :: ( PrimMonad m + , RenderablePixel px + , MonadState (MutableImage (PrimState m) px) + (DrawContext m px) + ) => FillMethod -> Texture px -- ^ Color/Texture used for the filling of the geometry -> Texture (PixelBaseComponent px) -- ^ Texture used for the mask.
@@ -0,0 +1,147 @@+{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE CPP #-} +-- | This module provide lenses compatible with the `lens` +-- module but without the dependency to it. +module Graphics.Rasterific.Lenses + ( -- * Line lenses + lineX0 + , lineX1 + , linePoints + + -- * Quadratic bezier curve + , bezX0 + , bezX1 + , bezX2 + , bezierPoints + + -- * Cubic bezier lenses + , cbezX0 + , cbezX1 + , cbezX2 + , cbezX3 + , cubicBezierPoints + + -- * Primitive lenses + , primitivePoints + + -- * Path oriented lenses + , pathCommandPoints + , pathPoints + + -- * Type definition to match Lens + , Lens + , Lens' + , Traversal + , Traversal' + ) where + +#if !MIN_VERSION_base(4,8,0) +import Data.Traversable( traverse ) +import Control.Applicative( Applicative, (<*>), pure ) +#endif + +import Control.Applicative( (<$>) ) +import Graphics.Rasterific.Types + +-- | Does it look familiar? yes it's the official +-- Lens type. +type Lens s t a b = + forall f. Functor f => (a -> f b) -> s -> f t + +-- | Try to match the Lens' type alias. +type Lens' s a = Lens s s a a + +-- | Traversal type, matched to the one of the lens +-- package. +type Traversal s t a b = + forall f. Applicative f => (a -> f b) -> s -> f t + +type Traversal' s a = Traversal s s a a + +-- | Create a full lens out of setter and getter +lens :: (s -> a) + -> (s -> b -> t) + -> Lens s t a b +{-# INLINE lens #-} +lens accessor setter = \f src -> + fmap (setter src) $ f (accessor src) + +-- | Traverse all the points of a line. +linePoints :: Traversal' Line Point +linePoints f (Line p0 p1) = Line <$> f p0 <*> f p1 + +-- | Line origin point. +lineX0 :: Lens' Line Point +lineX0 = lens _lineX0 setter where + setter a b = a { _lineX0 = b } + +-- | Line end point. +lineX1 :: Lens' Line Point +lineX1 = lens _lineX1 setter where + setter a b = a { _lineX1 = b } + +-- | Quadratic bezier starting point. +bezX0 :: Lens' Bezier Point +bezX0 = lens _bezierX0 setter where + setter a b = a { _bezierX0 = b } + +-- | bezier control point. +bezX1 :: Lens' Bezier Point +bezX1 = lens _bezierX1 setter where + setter a b = a { _bezierX1 = b } + +-- | bezier end point. +bezX2 :: Lens' Bezier Point +bezX2 = lens _bezierX2 setter where + setter a b = a { _bezierX2 = b } + +-- | Traversal of all the bezier's points. +bezierPoints :: Traversal' Bezier Point +bezierPoints f (Bezier p0 p1 p2) = + Bezier <$> f p0 <*> f p1 <*> f p2 + +-- | Cubic bezier first point +cbezX0 :: Lens' CubicBezier Point +cbezX0 = lens _cBezierX0 setter where + setter a b = a { _cBezierX0 = b } + +-- | Cubic bezier first control point. +cbezX1 :: Lens' CubicBezier Point +cbezX1 = lens _cBezierX1 setter where + setter a b = a { _cBezierX1 = b } + +-- | Cubic bezier second control point. +cbezX2 :: Lens' CubicBezier Point +cbezX2 = lens _cBezierX2 setter where + setter a b = a { _cBezierX2 = b } + +-- | Cubic bezier last point. +cbezX3 :: Lens' CubicBezier Point +cbezX3 = lens _cBezierX2 setter where + setter a b = a { _cBezierX3 = b } + +-- | Traversal of all the points of the cubic bezier. +cubicBezierPoints :: Traversal' CubicBezier Point +cubicBezierPoints f (CubicBezier p0 p1 p2 p3) = + CubicBezier <$> f p0 <*> f p1 <*> f p2 <*> f p3 + +-- | Traverse all the points defined in the primitive. +primitivePoints :: Traversal' Primitive Point +primitivePoints f (LinePrim l) = LinePrim <$> linePoints f l +primitivePoints f (BezierPrim b) = BezierPrim <$> bezierPoints f b +primitivePoints f (CubicBezierPrim c) = + CubicBezierPrim <$> cubicBezierPoints f c + +-- | Traversal of all the points of a path +pathCommandPoints :: Traversal' PathCommand Point +pathCommandPoints f (PathLineTo p) = PathLineTo <$> f p +pathCommandPoints f (PathQuadraticBezierCurveTo p1 p2) = + PathQuadraticBezierCurveTo <$> f p1 <*> f p2 +pathCommandPoints f (PathCubicBezierCurveTo p1 p2 p3) = + PathCubicBezierCurveTo <$> f p1 <*> f p2 <*> f p3 + +-- | Traversal of all the points in a path. +pathPoints :: Traversal' Path Point +pathPoints f (Path p0 yn comms) = + Path <$> f p0 <*> pure yn <*> traverse (pathCommandPoints f) comms +
@@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns #-} +{-# LANGUAGE CPP #-} -- | Handle straight lines polygon. module Graphics.Rasterific.Line ( lineFromPath @@ -11,8 +12,14 @@ , offsetLine ) where -import Control.Applicative( (<$>), pure ) -import Data.Monoid( (<>), mempty ) +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative( pure ) +import Data.Monoid( mempty ) +#endif + +import Data.Monoid( (<>) ) +import Control.Applicative( (<$>) ) + import Graphics.Rasterific.Linear ( V2( .. ) , (^-^)
@@ -21,7 +21,9 @@ import Linear #else +#if !MIN_VERSION_base(4,8,0) import Control.Applicative( Applicative, pure, (<*>) ) +#endif infixl 6 ^+^, ^-^ infixl 7 ^*, ^/
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- | Module providing basic helper functions to help -- build vector/point calculations. module Graphics.Rasterific.Operators @@ -26,8 +27,10 @@ , isDistingableFrom ) where -import Control.Applicative( Applicative - , liftA2 +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative( Applicative ) +#endif +import Control.Applicative( liftA2 , liftA3 , (<$>) )
@@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE CPP #-} -- | This module help the walking of path of any shape, -- being able to return the current position and the -- actual orientation. @@ -13,8 +14,15 @@ , drawOrdersOnPath ) where +#if !MIN_VERSION_base(4,8,0) import Data.Foldable( foldMap ) -import Control.Applicative( Applicative, (<$>), (<*>) ) +import Data.Monoid( mempty ) +import Control.Applicative( Applicative, (<*>) ) +#endif + +import Data.Monoid( (<>) ) +import Control.Applicative( (<$>) ) + import Control.Monad.Identity( Identity ) import Control.Monad.State( StateT , MonadTrans @@ -22,7 +30,6 @@ , evalStateT , modify , gets ) -import Data.Monoid( mempty, (<>) ) import Data.Maybe( fromMaybe ) import Graphics.Rasterific.Types
@@ -1,5 +1,6 @@ {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE CPP #-} -- | Module implementing types used for geometry -- bound calculations. module Graphics.Rasterific.PlaneBoundable ( PlaneBound( .. ) @@ -9,9 +10,15 @@ , boundLowerLeftCorner ) where -import Control.Applicative( (<$>), (<*>) ) -import Data.Monoid( Monoid( .. ), (<>) ) +#if !MIN_VERSION_base(4,8,0) +-- to be removed with GHC 7.12 ? +import Control.Applicative( (<*>) ) +import Data.Monoid( Monoid( .. ) ) import Data.Foldable( foldMap ) +#endif + +import Control.Applicative( (<$>) ) +import Data.Monoid( (<>) ) import Graphics.Rasterific.Linear( V2( .. ) ) import Graphics.Rasterific.Types
@@ -1,6 +1,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE BangPatterns #-} +{-# LANGUAGE CPP #-} -- | Module handling math regarding the handling of quadratic -- and cubic bezier curve. module Graphics.Rasterific.QuadraticBezier @@ -16,7 +17,10 @@ , bezierLengthApproximation ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative( pure ) +import Data.Monoid( Monoid( mempty ) ) +#endif import Graphics.Rasterific.Linear ( V2( .. ) , (^-^) @@ -26,7 +30,8 @@ , norm , lerp ) -import Data.Monoid( Monoid( mempty ), (<>) ) + +import Data.Monoid( (<>) ) import Graphics.Rasterific.Operators import Graphics.Rasterific.Types
@@ -1,9 +1,12 @@+{-# LANGUAGE CPP #-} module Graphics.Rasterific.QuadraticFormula( QuadraticFormula( .. ) , discriminant , formulaRoots ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative( Applicative( .. ) ) +#endif -- | Represent an equation `a * x^2 + b * x + c = 0` data QuadraticFormula a = QuadraticFormula
@@ -1,13 +1,17 @@ {-# LANGUAGE BangPatterns #-} +{-# LANGUAGE CPP #-} module Graphics.Rasterific.Rasterize ( CoverageSpan( .. ) , rasterize , clip ) where +#if !MIN_VERSION_base(4,8,0) +import Data.Foldable( foldMap ) +#endif + import Control.Monad.ST( runST ) import Data.Fixed( mod' ) -import Data.Foldable( foldMap ) import Data.Monoid( Endo( Endo, appEndo ) ) import Graphics.Rasterific.Types import Graphics.Rasterific.QuadraticBezier
@@ -285,9 +285,9 @@ gradientColorAt :: ModulablePixel px => GradientArray px -> Float -> px {-# SPECIALIZE - gradientColorAt :: GradientArray PixelRGBA8 -> Float -> PixelRGBA8 #-} + gradientColorAt :: GradientArray PixelRGBA8 -> Float -> PixelRGBA8 #-} {-# SPECIALIZE - gradientColorAt :: GradientArray Pixel8 -> Float -> Pixel8 #-} + gradientColorAt :: GradientArray Pixel8 -> Float -> Pixel8 #-} gradientColorAt grad at | at <= 0 = snd $ V.head grad | at >= 1.0 = snd $ V.last grad @@ -305,11 +305,11 @@ gradientColorAtRepeat :: ModulablePixel px => SamplerRepeat -> GradientArray px -> Float -> px {-# SPECIALIZE INLINE - gradientColorAtRepeat :: - SamplerRepeat -> GradientArray PixelRGBA8 -> Float -> PixelRGBA8 #-} + gradientColorAtRepeat :: + SamplerRepeat -> GradientArray PixelRGBA8 -> Float -> PixelRGBA8 #-} {-# SPECIALIZE INLINE - gradientColorAtRepeat :: - SamplerRepeat -> GradientArray Pixel8 -> Float -> Pixel8 #-} + gradientColorAtRepeat :: + SamplerRepeat -> GradientArray Pixel8 -> Float -> Pixel8 #-} gradientColorAtRepeat SamplerPad grad = gradientColorAt grad gradientColorAtRepeat SamplerRepeat grad = gradientColorAt grad . repeatGradient @@ -344,11 +344,11 @@ sampledImageShader :: forall px. ModulablePixel px => Image px -> SamplerRepeat -> ShaderFunction px {-# SPECIALIZE - sampledImageShader :: Image Pixel8 -> SamplerRepeat - -> ShaderFunction Pixel8 #-} + sampledImageShader :: Image Pixel8 -> SamplerRepeat + -> ShaderFunction Pixel8 #-} {-# SPECIALIZE - sampledImageShader :: Image PixelRGBA8 -> SamplerRepeat - -> ShaderFunction PixelRGBA8 #-} + sampledImageShader :: Image PixelRGBA8 -> SamplerRepeat + -> ShaderFunction PixelRGBA8 #-} sampledImageShader img sampling x y = (at px py `interpX` at pxn py) `interpY` @@ -394,9 +394,9 @@ -- filtering at all. imageShader :: forall px. (Pixel px) => Image px -> ShaderFunction px {-# SPECIALIZE - imageShader :: Image PixelRGBA8 -> ShaderFunction PixelRGBA8 #-} + imageShader :: Image PixelRGBA8 -> ShaderFunction PixelRGBA8 #-} {-# SPECIALIZE - imageShader :: Image Pixel8 -> ShaderFunction Pixel8 #-} + imageShader :: Image Pixel8 -> ShaderFunction Pixel8 #-} imageShader img x y = unsafePixelAt rawData $ (clampedY * w + clampedX) * compCount where
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Graphics.Rasterific.StrokeInternal ( flatten , dashize @@ -7,9 +8,15 @@ , approximatePathLength ) where -import Control.Applicative( (<$>), pure ) -import Data.Monoid( (<>), mempty ) +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative( pure ) +import Data.Monoid( mempty ) import Data.Foldable( foldMap ) +#endif + +import Control.Applicative( (<$>) ) +import Data.Monoid( (<>) ) + import Graphics.Rasterific.Linear ( V2( .. ) , (^-^) @@ -61,7 +68,7 @@ -- Xp -- ^ / \ ^ -- u\/ \/v - -- / \ + -- / \ . a = p ^+^ u ^* offset c = p ^+^ v ^* offset @@ -130,7 +137,7 @@ -- Xp -- ^ / \ ^ -- u\/ \/v - -- / \ + -- / \ . a = point ^+^ u ^* offset c = point ^+^ v ^* offset w = (a `normal` c) `ifZero` u
@@ -4,6 +4,7 @@ -- -- You can combine the transformation is `mappend` or -- the `(\<\>)` operator from "Data.Monoid" . +{-# LANGUAGE CPP #-} module Graphics.Rasterific.Transformations ( Transformation( .. ) , applyTransformation @@ -18,7 +19,10 @@ , inverseTransformation ) where -import Data.Monoid( Monoid( .. ), (<>) ) +#if !MIN_VERSION_base(4,8,0) +import Data.Monoid( Monoid( .. ) ) +#endif +import Data.Monoid( (<>) ) import Graphics.Rasterific.Types import Graphics.Rasterific.Linear( V2( .. ), (^+^), normalize )
@@ -2,6 +2,7 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE CPP #-} -- | Gather all the types used in the rasterization engine. module Graphics.Rasterific.Types ( -- * Geometry description @@ -35,7 +36,11 @@ ) where import Data.DList( DList, fromList, toList ) -import Data.Foldable( Foldable, foldl' ) + +#if !MIN_VERSION_base(4,8,0) +import Data.Foldable( Foldable ) +#endif +import Data.Foldable( foldl' ) import Graphics.Rasterific.Linear( V2( .. ) ) import Foreign.Ptr( castPtr )