Copyright | [2013..2020] Trevor L. McDonell |
---|---|
License | BSD3 |
Maintainer | Trevor L. McDonell <trevor.mcdonell@gmail.com> |
Stability | experimental |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Rendering of Accelerate arrays as raster images
Synopsis
- module Graphics.Gloss.Accelerate.Data.Point
- module Data.Array.Accelerate.Data.Colour.RGBA
- type Render = forall a b. (Arrays a, Arrays b) => (Acc a -> Acc b) -> a -> b
- data Display
- animateArrayWith :: Render -> Display -> (Int, Int) -> (Exp Float -> Acc (Array DIM2 Colour)) -> IO ()
- animateArrayIOWith :: Arrays world => Render -> Display -> (Int, Int) -> (Float -> IO world) -> (Acc world -> Acc (Array DIM2 Colour)) -> IO ()
- playArrayWith :: Arrays world => Render -> Display -> (Int, Int) -> Int -> state -> (state -> world) -> (Acc world -> Acc (Array DIM2 Colour)) -> (Event -> state -> state) -> (Float -> state -> state) -> IO ()
- playArrayIOWith :: Arrays world => Render -> Display -> (Int, Int) -> Int -> state -> (state -> IO world) -> (Acc world -> Acc (Array DIM2 Colour)) -> (Event -> state -> IO state) -> (Float -> state -> IO state) -> IO ()
- makePicture :: Arrays world => Render -> Int -> Int -> (Acc world -> Acc (Array DIM2 Colour)) -> world -> Picture
Documentation
Display functions
type Render = forall a b. (Arrays a, Arrays b) => (Acc a -> Acc b) -> a -> b Source #
The type for executing Accelerate computations. This matches the run1
style of executing programs.
Some variants of the display functions take an argument of this type, which determine how computations are executed.
Describes how Gloss should display its output.
InWindow String (Int, Int) (Int, Int) | Display in a window with the given name, size and position. |
FullScreen | Display full screen. |
:: Render | Method to render the array (backend |
-> Display | Display mode |
-> (Int, Int) | Number of pixels to draw per point |
-> (Exp Float -> Acc (Array DIM2 Colour)) | A function to construct an array of colours. The function should return an array of the same extent every time it is applied. It is passed the time in seconds since the program started. |
-> IO () |
Animate a bitmap generated by an Accelerate computation, specifying the backend used to render the image.
:: Arrays world | |
=> Render | Method to render the array (backend |
-> Display | Display mode |
-> (Int, Int) | Number of pixels to draw per point |
-> (Float -> IO world) | Extract world from time in seconds since the program started |
-> (Acc world -> Acc (Array DIM2 Colour)) | A function to construct an array of colours. The function should return an array of the same extent every time it is applied. It is passed the world |
-> IO () |
Animate a bitmap generated by an Accelerate computation and IO actions, specifying the backend used to render the image.
:: Arrays world | |
=> Render | Method to render the world (backend |
-> Display | Display mode |
-> (Int, Int) | Number of pixels to draw per point |
-> Int | Number of simulation steps to take for each second of real time |
-> state | The initial state |
-> (state -> world) | Extract the world state |
-> (Acc world -> Acc (Array DIM2 Colour)) | Compute the colour of the world |
-> (Event -> state -> state) | Handle input events |
-> (Float -> state -> state) | Step the world one iteration. It is passed the time in seconds since the program started. |
-> IO () |
Play with a bitmap generated by an Accelerate computation, specifying the method used to render the world.
:: Arrays world | |
=> Render | Method to render the world (backend |
-> Display | Display mode |
-> (Int, Int) | Number of pixels to draw per point |
-> Int | Number of simulation steps to take for each second of real time |
-> state | The initial state |
-> (state -> IO world) | Extract the world state |
-> (Acc world -> Acc (Array DIM2 Colour)) | Compute the colour of the world |
-> (Event -> state -> IO state) | Handle input events |
-> (Float -> state -> IO state) | Step the world one iteration. It is passed the time in seconds since the program started. |
-> IO () |
Play with a bitmap generated by an Accelerate computation and IO actions, specifying the method used to render the world.
Picture creation
:: Arrays world | |
=> Render | method to compute the image |
-> Int | pixel width |
-> Int | pixel height |
-> (Acc world -> Acc (Array DIM2 Colour)) | function to create the image |
-> world -> Picture | new function that generates the picture |
Lift an Accelerate computation from a world
to an image into a real
Haskell-land function that executes the computation of the image and wraps
it as a Gloss picture ready for display.