gloss-raster-accelerate-1.8.15.0: Parallel rendering of raster images using Accelerate

Safe HaskellNone
LanguageHaskell2010

Graphics.Gloss.Accelerate.Raster.Field

Contents

Description

Rendering of 2D functions as raster fields

Synopsis

Display functions

type Render = forall a b. (Arrays a, Arrays b) => (Acc a -> Acc b) -> a -> b Source

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 :: *

Constructors

InWindow String (Int, Int) (Int, Int) 
FullScreen (Int, Int) 

animateField Source

Arguments

:: Display

Display mode

-> (Int, Int)

Number of pixels to draw per point

-> (Exp Float -> Exp Point -> Exp Color)

A function to compute the colour 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 () 

Animate a continuous 2D function using the default backend

animateFieldWith Source

Arguments

:: Render

Method to render the field

-> Display

Display mode

-> (Int, Int)

Number of pixels to draw per point

-> (Exp Float -> Exp Point -> Exp Color)

A function to compute the colour 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 () 

Animate a continuous 2D function, specifying the backend used to render the field.

animateFieldIO Source

Arguments

:: Arrays world 
=> 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 -> Exp Point -> Exp Color)

A function to compute the colour at a particular point.

It is passed the world, and a point between (-1,1) and (+1,1).

-> IO () 

Animate a continuous 2D function using IO actions and the default backend

animateFieldIOWith Source

Arguments

:: Arrays world 
=> Render

Method to render the field

-> 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 -> Exp Point -> Exp Color)

A function to compute the colour at a particular point.

It is passed the world, and a point between (-1,1) and (+1,1).

-> IO () 

Animate a continuous 2D function using IO actions, specifying the backend used to render the field.

playField Source

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 -> Exp Point -> Exp Color)

Compute the colour of the world at a given point

-> (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 a game with a continuous 2D function using the default backend.

playFieldWith Source

Arguments

:: Arrays world 
=> Render

Method to render the field

-> 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 -> Exp Point -> Exp Color)

Compute the colour of the world at a given point

-> (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 a game with a continuous 2D function, specifying the method used to render the field.

playFieldIO Source

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 -> IO world)

Extract the world state

-> (Acc world -> Exp Point -> Exp Color)

Compute the colour of the world at a given point

-> (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 a game with a continuous 2D function using IO actions, and the default backend.

playFieldIOWith Source

Arguments

:: Arrays world 
=> Render

Method to render the field

-> 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 -> Exp Point -> Exp Color)

Compute the colour of the world at a given point

-> (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 a game with a continuous 2D function using IO actions, specifying the method used to render the field.

Field creation

makeField Source

Arguments

:: Int

image width

-> Int

image height

-> (world -> Exp Point -> Exp Color)

function to apply at each point

-> world -> Acc (Array DIM2 Color)

new function that generates the field

Lift a point-wise colouring function into an image creation function.

The parameter world at this point can be arbitrary. However if you use this function standalone, you will probably at some point want the result of this function to plug into makePicture and thus Render, and thus be a unary function from Arrays to Arrays.