Safe Haskell | None |
---|---|
Language | Haskell2010 |
Rendering of Repa arrays as raster images.
Gloss programs should be compiled with -threaded
, otherwise the GHC runtime
will limit the frame-rate to around 20Hz.
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.
-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
for more details.
Synopsis
- module Graphics.Gloss.Data.Color
- rgb :: Float -> Float -> Float -> Color
- rgbI :: Int -> Int -> Int -> Color
- rgb8w :: Word8 -> Word8 -> Word8 -> Color
- rgb' :: Float -> Float -> Float -> Color
- rgbI' :: Int -> Int -> Int -> Color
- data Display
- animateArray :: Display -> (Int, Int) -> (Float -> Array D DIM2 Color) -> IO ()
- playArray :: Display -> (Int, Int) -> Int -> world -> (world -> Array D DIM2 Color) -> (Event -> world -> world) -> (Float -> world -> world) -> IO ()
- animateArrayIO :: Display -> (Int, Int) -> (Float -> IO (Array D DIM2 Color)) -> IO ()
- playArrayIO :: Display -> (Int, Int) -> Int -> world -> (world -> IO (Array D DIM2 Color)) -> (Event -> world -> IO world) -> (Float -> world -> IO world) -> IO ()
Color
module Graphics.Gloss.Data.Color
rgb :: Float -> Float -> Float -> Color Source #
Construct a color from red, green, blue components.
Each component is clamped to the range [0..1]
rgbI :: Int -> Int -> Int -> Color Source #
Construct a color from red, green, blue components.
Each component is clamped to the range [0..255]
rgb8w :: Word8 -> Word8 -> Word8 -> Color Source #
Construct a color from red, green, blue components.
rgb' :: Float -> Float -> Float -> Color Source #
Like rgb
, but take pre-clamped components for speed.
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 Source #
Like rgbI
, but take pre-clamped components for speed.
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.
Display functions
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. |
:: 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 time it is applied. It is passed the time in seconds since the program started. |
-> IO () |
Animate a bitmap generated from a Repa array.
:: Display | Display mode. |
-> (Int, Int) | Number of pixels to draw per element. |
-> Int | Number of simulation steps to take for each second of real time |
-> world | The initial world. |
-> (world -> Array D DIM2 Color) | Function to convert the world to an array. |
-> (Event -> world -> world) | Function to handle input events. |
-> (Float -> world -> world) | Function to step the world one iteration. It is passed the time in seconds since the program started. |
-> IO () |
Play with a bitmap generated from a Repa array.
:: 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 time it is applied. It is passed the time in seconds since the program started. |
-> IO () |
Animate a bitmap generated from a Repa array, via the IO monad.
:: Display | Display mode. |
-> (Int, Int) | Number of pixels to draw per element. |
-> Int | Number of simulation steps to take for each second of real time |
-> world | The initial world. |
-> (world -> IO (Array D DIM2 Color)) | Function to convert the world to an array. |
-> (Event -> world -> IO world) | Function to handle input events. |
-> (Float -> world -> IO world) | Function to step the world one iteration. It is passed the time in seconds since the program started. |
-> IO () |
Play with a bitmap generated from a Repa array, via the IO monad.