packages feed

gloss-raster 1.11.1.1 → 1.12.0.0

raw patch · 3 files changed

+85/−72 lines, 3 filesdep ~basedep ~ghc-primdep ~glossnew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, ghc-prim, gloss, gloss-rendering

API changes (from Hackage documentation)

Files

Graphics/Gloss/Raster/Array.hs view
@@ -1,4 +1,7 @@-{-# LANGUAGE BangPatterns, MagicHash, PatternGuards, ScopedTypeVariables #-}+{-# LANGUAGE BangPatterns        #-}+{-# LANGUAGE MagicHash           #-}+{-# LANGUAGE PatternGuards       #-}+{-# LANGUAGE ScopedTypeVariables #-} -- | Rendering of Repa arrays as raster images. -- --  Gloss programs should be compiled with @-threaded@, otherwise the GHC runtime@@ -7,12 +10,12 @@ --  The performance of programs using this interface is sensitive to how much --  boxing and unboxing the GHC simplifier manages to eliminate. For the best --  result add INLINE pragmas to all of your numeric functions and use the following---  compile options.  +--  compile options. -----  @-threaded -Odph -fno-liberate-case -funfolding-use-threshold1000 +--  @-threaded -Odph -fno-liberate-case -funfolding-use-threshold1000 --   -funfolding-keeness-factor1000 -fllvm -optlo-O3@ -----  See the examples the @raster@ directory of the @gloss-examples@ package +--  See the examples the @raster@ directory of the @gloss-examples@ package --  for more details. -- module Graphics.Gloss.Raster.Array@@ -49,7 +52,7 @@  -- Color ---------------------------------------------------------------------- -- | Construct a color from red, green, blue components.---  +-- --   Each component is clamped to the range [0..1] rgb  :: Float -> Float -> Float -> Color rgb r g b   = makeColor r g b 1.0@@ -72,7 +75,7 @@  -- | Like `rgb`, but take pre-clamped components for speed. -----   If you're building a new color for every pixel then use this version, +--   If you're building a new color for every pixel then use this version, --   however if your components are out of range then the picture you get will --   be implementation dependent. rgb' :: Float -> Float -> Float -> Color@@ -82,7 +85,7 @@  -- | Like `rgbI`, but take pre-clamped components for speed. -----   If you're building a new color for every pixel then use this version, +--   If you're building a new color for every pixel then use this version, --   however if your components are out of range then the picture you get will --   be implementation dependent. rgbI' :: Int -> Int -> Int -> Color@@ -93,18 +96,18 @@ -- Animate -------------------------------------------------------------------- -- | Animate a bitmap generated from a Repa array. animateArray-        :: Display                      +        :: Display                 -- ^ Display mode.         -> (Int, Int)                 -- ^ Number of pixels to draw per element.         -> (Float -> Array D DIM2 Color)                 -- ^ A function to construct a delayed array for the given time.-                --   The function should return an array of the same extent each +                --   The function should return an array of the same extent each                 --   time it is applied.                 --                 --   It is passed the time in seconds since the program started.         -> IO ()-        + animateArray display scale@(scaleX, scaleY) makeArray  = scaleX `seq` scaleY `seq`  if scaleX < 1 || scaleY < 1@@ -120,18 +123,18 @@ -- AnimateIO -------------------------------------------------------------------- -- | Animate a bitmap generated from a Repa array, via the IO monad. animateArrayIO-        :: Display                      +        :: Display                 -- ^ Display mode.         -> (Int, Int)                 -- ^ Number of pixels to draw per element.         -> (Float -> IO (Array D DIM2 Color))                 -- ^ A function to construct a delayed array for the given time.-                --   The function should return an array of the same extent each +                --   The function should return an array of the same extent each                 --   time it is applied.                 --                 --   It is passed the time in seconds since the program started.         -> IO ()-        + animateArrayIO display scale@(scaleX, scaleY) makeArray  = scaleX `seq` scaleY `seq`  if scaleX < 1 || scaleY < 1@@ -147,19 +150,19 @@ -- Play ----------------------------------------------------------------------- -- | Play with a bitmap generated from a Repa array. playArray-        :: Display                      +        :: Display                 -- ^ Display mode.-        -> (Int, Int)   +        -> (Int, Int)                 -- ^ Number of pixels to draw per element.         -> Int  -- ^ Number of simulation steps to take                 --   for each second of real time-        -> world +        -> world                 -- ^ The initial world.         -> (world -> Array D DIM2 Color)                 -- ^ Function to convert the world to an array.-        -> (Event -> world -> world)    +        -> (Event -> world -> world)                 -- ^ Function to handle input events.-        -> (Float -> world -> world)    +        -> (Float -> world -> world)                 -- ^ Function to step the world one iteration.                 --   It is passed the time in seconds since the program started.         -> IO ()@@ -167,13 +170,13 @@           !initWorld !makeArray !handleEvent !stepWorld  = scaleX `seq` scaleY `seq`    if scaleX < 1 || scaleY < 1-     then  error $ "Graphics.Gloss.Raster.Array: invalid pixel scale factor " +     then  error $ "Graphics.Gloss.Raster.Array: invalid pixel scale factor "                  P.++ show scale      else  let  {-# INLINE frame #-}                 frame !world    = makeFrame scale (makeArray world)             in   play display black-                        stepRate +                        stepRate                         initWorld                         frame                         handleEvent@@ -184,19 +187,19 @@ -- PlayIO ----------------------------------------------------------------------- -- | Play with a bitmap generated from a Repa array, via the IO monad. playArrayIO-        :: Display                      +        :: Display                 -- ^ Display mode.-        -> (Int, Int)   +        -> (Int, Int)                 -- ^ Number of pixels to draw per element.         -> Int  -- ^ Number of simulation steps to take                 --   for each second of real time-        -> world +        -> world                 -- ^ The initial world.         -> (world -> IO (Array D DIM2 Color))                 -- ^ Function to convert the world to an array.-        -> (Event -> world -> IO world)    +        -> (Event -> world -> IO world)                 -- ^ Function to handle input events.-        -> (Float -> world -> IO world)    +        -> (Float -> world -> IO world)                 -- ^ Function to step the world one iteration.                 --   It is passed the time in seconds since the program started.         -> IO ()@@ -204,13 +207,13 @@             !initWorld !makeArray !handleEvent !stepWorld  = scaleX `seq` scaleY `seq`    if scaleX < 1 || scaleY < 1-     then  error $ "Graphics.Gloss.Raster.Array: invalid pixel scale factor " +     then  error $ "Graphics.Gloss.Raster.Array: invalid pixel scale factor "                  P.++ show scale      else  let  {-# INLINE frame #-}                 frame !world    = fmap (makeFrame scale) (makeArray world)             in  playIO display black-                        stepRate +                        stepRate                         initWorld                         frame                         handleEvent@@ -222,7 +225,7 @@ makeFrame :: (Int, Int) -> Array D DIM2 Color -> Picture makeFrame (scaleX, scaleY) !array  = let  -- Size of the array-        _ :. sizeY :. sizeX +        _ :. sizeY :. sizeX                          = R.extent array          convColor :: Color -> Word32@@ -231,14 +234,14 @@                 r'        = fromIntegral r                 g'        = fromIntegral g                 b'        = fromIntegral b-                a         = 255 +                a         = 255                  !w        =  unsafeShiftL r' 24                          .|. unsafeShiftL g' 16                          .|. unsafeShiftL b' 8                          .|. a            in   w-        {-# INLINE convColor #-} +        {-# INLINE convColor #-}     in unsafePerformIO $ do @@ -250,7 +253,7 @@         traceEventIO "Gloss.Raster[makeFrame]: done, returning picture."          -- Wrap the ForeignPtr from the Array as a gloss picture.-        let picture     +        let picture                 = Scale (fromIntegral scaleX) (fromIntegral scaleY)                 $ bitmapOfForeignPtr                         sizeX sizeY     -- raw image size@@ -267,7 +270,7 @@ --   doesn't have enout specialisations and goes via Integer. word8OfFloat :: Float -> Word8 word8OfFloat f-        = fromIntegral (truncate f :: Int) +        = fromIntegral (truncate f :: Int) {-# INLINE word8OfFloat #-}  
Graphics/Gloss/Raster/Field.hs view
@@ -1,4 +1,7 @@-{-# LANGUAGE BangPatterns, MagicHash, PatternGuards, ScopedTypeVariables #-}+{-# LANGUAGE BangPatterns        #-}+{-# LANGUAGE MagicHash           #-}+{-# LANGUAGE PatternGuards       #-}+{-# LANGUAGE ScopedTypeVariables #-}  -- | Rendering of continuous 2D functions as raster fields. --@@ -8,11 +11,11 @@ --  The performance of programs using this interface is sensitive to how much --  boxing and unboxing the GHC simplifier manages to eliminate. For the best --  result add INLINE pragmas to all of your numeric functions and use the following---  compile options.  +--  compile options. -- --  @-threaded -Odph -fno-liberate-case -funfolding-use-threshold1000 -funfolding-keeness-factor1000 -fllvm -optlo-O3@ -----  See the examples the @raster@ directory of the @gloss-examples@ package +--  See the examples the @raster@ directory of the @gloss-examples@ package --  for more details. -- module Graphics.Gloss.Raster.Field@@ -50,7 +53,7 @@  -- Color ---------------------------------------------------------------------- -- | Construct a color from red, green, blue components.---  +-- --   Each component is clamped to the range [0..1] rgb  :: Float -> Float -> Float -> Color rgb r g b   = makeColor r g b 1.0@@ -73,7 +76,7 @@  -- | Like `rgb`, but take pre-clamped components for speed. -----   If you're building a new color for every pixel then use this version, +--   If you're building a new color for every pixel then use this version, --   however if your components are out of range then the picture you get will --   be implementation dependent. rgb' :: Float -> Float -> Float -> Color@@ -83,7 +86,7 @@  -- | Like `rgbI`, but take pre-clamped components for speed. -----   If you're building a new color for every pixel then use this version, +--   If you're building a new color for every pixel then use this version, --   however if your components are out of range then the picture you get will --   be implementation dependent. rgbI' :: Int -> Int -> Int -> Color@@ -94,50 +97,50 @@ -- Animate -------------------------------------------------------------------- -- | Animate a continuous 2D function. animateField-        :: Display                      +        :: Display                 -- ^ Display mode.-        -> (Int, Int)                   +        -> (Int, Int)                 -- ^ Number of pixels to draw per point.-        -> (Float -> Point -> Color)    +        -> (Float -> Point -> Color)                 -- ^ Function to compute the color at a particular point.                 --                 --   It is passed the time in seconds since the program started,                 --   and a point between (-1, -1) and (+1, +1).         -> IO ()-        + animateField display (zoomX, zoomY) makePixel  = zoomX `seq` zoomY `seq`  if zoomX < 1 || zoomY < 1    then error $ "Graphics.Gloss.Raster.Field: invalid pixel scale factor "                 P.++ show (zoomX, zoomY)-   else +   else     do (winSizeX, winSizeY) <- sizeOfDisplay display-       +        let  frame !time               = return                 $ makePicture winSizeX winSizeY zoomX zoomY (makePixel time)         animateFixedIO display black frame (const $ return ())-    + {-# INLINE animateField #-} --  INLINE so the repa functions fuse with the users client functions.  -- Play ----------------------------------------------------------------------- -- | Play a game with a continous 2D function.-playField -        :: Display                      +playField+        :: Display                 -- ^ Display mode.-        -> (Int, Int)   +        -> (Int, Int)                 -- ^ Number of pixels to draw per point.         -> Int  -- ^ Number of simulation steps to take                 --   for each second of real time-        -> world +        -> world                 -- ^ The initial world.-        -> (world -> Point -> Color)    +        -> (world -> Point -> Color)                 -- ^ Function to compute the color of the world at the given point.-        -> (Event -> world -> world)    +        -> (Event -> world -> world)                 -- ^ Function to handle input events.-        -> (Float -> world -> world)    +        -> (Float -> world -> world)                 -- ^ Function to step the world one iteration.                 --   It is passed the time in seconds since the program started.         -> IO ()@@ -145,14 +148,14 @@           !initWorld !makePixel !handleEvent !stepWorld  = zoomX `seq` zoomY `seq`    if zoomX < 1 || zoomY < 1-     then  error $ "Graphics.Gloss.Raster.Field: invalid pixel scale factor " +     then  error $ "Graphics.Gloss.Raster.Field: invalid pixel scale factor "                  P.++ show (zoomX, zoomY)      else  do (winSizeX, winSizeY) <- sizeOfDisplay display               winSizeX `seq` winSizeY `seq`-                play display black stepRate +                play display black stepRate                    initWorld-                   (\world -> -                      world `seq` +                   (\world ->+                      world `seq`                       makePicture winSizeX winSizeY zoomX zoomY (makePixel world))                    handleEvent                    stepWorld@@ -180,12 +183,12 @@         sizeX = winSizeX `div` zoomX         sizeY = winSizeY `div` zoomY -        {-# INLINE conv #-} +        {-# INLINE conv #-}         conv (r, g, b)          = let  r'      = fromIntegral r                 g'      = fromIntegral g                 b'      = fromIntegral b-                a       = 255 +                a       = 255                  !w      =   unsafeShiftL r' 24                         .|. unsafeShiftL g' 16@@ -199,7 +202,7 @@         -- We don't need the alpha because we're only drawing one image.         traceEventIO "Gloss.Raster[makePicture]: start frame evaluation."         (arrRGB :: Array F DIM2 Word32)-                <- R.computeP  +                <- R.computeP                 $  R.map conv                 $  makeFrame sizeX sizeY makePixel         traceEventIO "Gloss.Raster[makePicture]: done, returning picture."@@ -247,7 +250,7 @@            in   makePixel (x', y')     in   R.hintInterleave-         $ R.map unpackColor +         $ R.map unpackColor          $ R.fromFunction (Z :. sizeY  :. sizeX)          $ pixelOfIndex {-# INLINE makeFrame #-}@@ -258,7 +261,7 @@ --   doesn't have enout specialisations and goes via Integer. word8OfFloat :: Float -> Word8 word8OfFloat f-        = fromIntegral (truncate f :: Int) +        = fromIntegral (truncate f :: Int) {-# INLINE word8OfFloat #-}  
gloss-raster.cabal view
@@ -1,5 +1,5 @@ Name:                gloss-raster-Version:             1.11.1.1+Version:             1.12.0.0 License:             MIT License-file:        LICENSE Author:              Ben Lippmeier@@ -17,28 +17,35 @@         Parallel rendering of raster images.  Flag llvm-  Description:  Compile via LLVM. This produces much better object code,+  Description:  Compile via LLVM. This produces much better object code                 but your GHC needs to have been built against the LLVM compiler.    Default:      False  source-repository head-        type:           git-        location:       https://github.com/benl23x5/gloss+  type:         git+  location:     https://github.com/benl23x5/gloss +source-repository this+  type:         git+  tag:          v1.12.0.0+  location:     https://github.com/benl23x5/gloss+ Library   Build-Depends:-        base            >= 4.8 && < 4.10,-        ghc-prim        >= 0.4 && < 0.6,-        containers      == 0.5.*,-        repa            == 3.4.*,-        gloss           == 1.11.*,-        gloss-rendering == 1.11.*+          base                          >= 4.8 && < 4.12+        , containers                    == 0.5.*+        , ghc-prim+        , gloss                         == 1.12.*+        , gloss-rendering               == 1.12.*+        , repa                          == 3.4.*    ghc-options:-        -Odph -fno-liberate-case+        -Odph+        -fno-liberate-case    Exposed-modules:         Graphics.Gloss.Raster.Field         Graphics.Gloss.Raster.Array +-- vim: nospell