Safe Haskell | None |
---|
Graphics.Gloss.Accelerate.Raster.Array
Contents
Description
Rendering of Accelerate arrays as raster images
- module Graphics.Gloss.Accelerate.Data.Point
- module Graphics.Gloss.Accelerate.Data.Color
- type Render = forall a b. (Arrays a, Arrays b) => (Acc a -> Acc b) -> a -> b
- data Display
- animateArray :: Display -> (Int, Int) -> (Exp Float -> Acc (Array DIM2 Color)) -> IO ()
- animateArrayWith :: Render -> Display -> (Int, Int) -> (Exp Float -> Acc (Array DIM2 Color)) -> IO ()
- playArray :: Arrays world => Display -> (Int, Int) -> Int -> state -> (state -> world) -> (Acc world -> Acc (Array DIM2 Color)) -> (Event -> state -> state) -> (Float -> state -> state) -> IO ()
- playArrayWith :: Arrays world => Render -> Display -> (Int, Int) -> Int -> state -> (state -> world) -> (Acc world -> Acc (Array DIM2 Color)) -> (Event -> state -> state) -> (Float -> state -> state) -> IO ()
- makePicture :: Arrays world => Render -> Int -> Int -> (Acc world -> Acc (Array DIM2 Color)) -> world -> Picture
Documentation
Display functions
type Render = forall a b. (Arrays a, Arrays b) => (Acc a -> Acc b) -> a -> bSource
The type of executing Accelerate computations. The CUDA and Interpreter
backends both provide a function run1
that can be used.
Some variants of the display functions take an argument of this type, which determine how computations are executed.
data Display
Describes how Gloss should display its output.
Arguments
:: Display | Display mode |
-> (Int, Int) | Number of pixels to draw per point |
-> (Exp Float -> Acc (Array DIM2 Color)) | 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, using the default backend.
Arguments
:: Render | Method to render the array |
-> Display | Display mode |
-> (Int, Int) | Number of pixels to draw per point |
-> (Exp Float -> Acc (Array DIM2 Color)) | 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.
Arguments
:: Arrays world | |
=> 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 Color)) | 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, using the default backend.
Arguments
:: Arrays world | |
=> Render | Method to render the world |
-> 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 Color)) | 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.
Picture creation
Arguments
:: Arrays world | |
=> Render | method to compute the image |
-> Int | pixel width |
-> Int | pixel height |
-> (Acc world -> Acc (Array DIM2 Color)) | 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.