-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Draw and update graphs in real time with OpenGL -- -- Draw and update graphs in real time with OpenGL. Suitable for -- displaying large amounts of frequently changing data. Line graphs and -- waterfall plots are supported, as well as axis drawing. @package dynamic-graph @version 0.1.0.5 module Graphics.DynamicGraph.ColorMaps -- | The matlab / octave "jet" color map jet :: [GLfloat] -- | "jet" modified so that low values are a darker blue jet_mod :: [GLfloat] -- | The matlab / octave "hot" color map hot :: [GLfloat] -- | Ranges from black to white bw :: [GLfloat] -- | Ranges from white to black wb :: [GLfloat] module Graphics.DynamicGraph.Util -- | Utility function to setup GLFW for graph drawing setupGLFW :: EitherT String IO () -- | tryTakeMVar then putMVar replaceMVar :: MVar a -> a -> IO () -- | Draw and update waterfall plots with OpenGL. Useful for spectrograms. -- -- Example usage: -- --
--   import Control.Monad
--   import Control.Monad.Trans.Either
--   import Control.Concurrent
--   import Pipes
--   import qualified Pipes.Prelude as P
--   import System.Random
--   import Graphics.Rendering.OpenGL
--   
--   import Graphics.DynamicGraph.Waterfall
--   
--   randomVect :: Producer [GLfloat] IO ()
--   randomVect =  P.repeatM $ do
--       res <- replicateM 1000 randomIO
--       threadDelay 10000
--       return res
--   
--   main = eitherT putStrLn return $ do
--       setupGLFW
--       waterfall <- waterfallWindow 1024 480 1000 1000 jet_mod
--   
--       lift $ runEffect $ randomVect >-> waterfall
--   
module Graphics.DynamicGraph.Waterfall -- | (waterfallWindow windowWidth windowHeight width height -- colormap) creates a window of width windowWidth and -- height windowHeight for displaying a waterfall plot. -- -- A Consumer is returned for updating the waterfall plot. Feeding an -- instance of IsPixelData of length width shifts all rows of -- the waterfall down and updates the top row with the data. -- -- The waterfall is height rows of data high. colorMap -- is used to map values to display color. waterfallWindow :: IsPixelData a => Int -> Int -> Int -> Int -> [GLfloat] -> EitherT String IO (Consumer a IO ()) -- | (renderWaterfallLine width height colorMap) returns a -- Consumer that renders a waterfall plot into the current OpenGL -- context. The Consumer takes data that is an instance of IsPixelData -- and of length width. The waterfall is height rows of -- data high. -- -- The fill is drawn with a vertical gradient defined by -- colorMap. -- -- All OpenGL based initialization of the rendering function (loading of -- shaders, etc) is performed before the pipe is returned. renderWaterfall :: IsPixelData a => Int -> Int -> [GLfloat] -> IO (Consumer a IO ()) -- | Utility function to setup GLFW for graph drawing setupGLFW :: EitherT String IO () -- | Draw and update filled in line graphs with OpenGL. -- -- Example usage: -- --
--   import Control.Monad
--   import Control.Monad.Trans.Either
--   import Control.Concurrent
--   import Pipes
--   import qualified Pipes.Prelude as P
--   import System.Random
--   import Graphics.Rendering.OpenGL
--   
--   import Graphics.DynamicGraph.FillLine
--   
--   randomVect :: Producer [GLfloat] IO ()
--   randomVect =  P.repeatM $ do
--       res <- replicateM 1000 randomIO
--       threadDelay 10000
--       return res
--   
--   main = eitherT putStrLn return $ do
--       setupGLFW
--       lineGraph <- filledLineWindow 1024 480 1000 jet_mod
--   
--       lift $ runEffect $ randomVect >-> lineGraph
--   
module Graphics.DynamicGraph.FillLine -- | (filledLineWindow windowWidth windowHeight samples colorMap) -- creates a window of width windowWidth and height -- windowHeight for displaying a line graph. -- -- A function is returned for dynamically updating the line graph. It -- takes an instance of IsPixelData of length samples as the y -- values. -- -- The fill is drawn with a vertical gradient defined by -- colorMap. filledLineWindow :: IsPixelData a => Int -> Int -> Int -> [GLfloat] -> EitherT String IO (Consumer a IO ()) -- | (renderFilledLine samples colorMap) returns a function that -- renders a filled in line graph into the current OpenGL context. The -- function takes an instance of IsPixelData of length samples. -- -- The fill is drawn with a vertical gradient defined by -- colorMap. -- -- All OpenGL based initialization of the rendering function (loading of -- shaders, etc) is performed before the function is returned. renderFilledLine :: IsPixelData a => Int -> [GLfloat] -> IO (a -> IO ()) -- | Utility function to setup GLFW for graph drawing setupGLFW :: EitherT String IO () -- | Various utilities for drawing axes with Cairo that will be later -- rendered using Graphics.DynamicGraph.RenderCairo module Graphics.DynamicGraph.Axis blankCanvas :: Colour Double -> Double -> Double -> Render () blankCanvasAlpha :: Colour Double -> Double -> Double -> Double -> Render () drawAxes :: Double -> Double -> Double -> Double -> Double -> Double -> Colour Double -> Double -> Render () gridXCoords :: Double -> Double -> Double -> Double -> Double -> [Double] gridYCoords :: Double -> Double -> Double -> Double -> Double -> [Double] xAxisLabels :: PangoContext -> Colour Double -> [String] -> [Double] -> Double -> Render () yAxisLabels :: PangoContext -> Colour Double -> [String] -> [Double] -> Double -> Render () xAxisGrid :: Colour Double -> Double -> [Double] -> Double -> Double -> [Double] -> Render () yAxisGrid :: Colour Double -> Double -> [Double] -> Double -> Double -> [Double] -> Render () -- | Render Cairo drawings with OpenGL. Useful for drawing axes. module Graphics.DynamicGraph.RenderCairo -- | (renderCairo rm width height) returns a function that renders -- the cairo drawing rm into the current OpenGL context. The -- drawing is rendered with x resolution width and y resolution -- height. -- -- All OpenGL based initialization of the rendering function (loading of -- shaders, rendering the cairo drawing to a texture, etc) is performed -- before the function is returned. renderCairo :: Render a -> Int -> Int -> IO (IO ()) -- | Draw and update line graphs with OpenGL. -- -- Based on: -- https://en.wikibooks.org/wiki/OpenGL_Programming/Scientific_OpenGL_Tutorial_02 -- -- Example usage: -- --
--   import Control.Monad
--   import Control.Monad.Trans.Either
--   import Control.Concurrent
--   import Pipes
--   import qualified Pipes.Prelude as P
--   import System.Random
--   import Graphics.Rendering.OpenGL
--   
--   import Graphics.DynamicGraph.TextureLine
--   
--   randomVect :: Producer [GLfloat] IO ()
--   randomVect =  P.repeatM $ do
--       res <- replicateM 1000 randomIO
--       threadDelay 10000
--       return res
--   
--   main = eitherT putStrLn return $ do
--       setupGLFW
--       lineGraph <- textureLineWindow 1024 480 1000 1024 
--   
--       lift $ runEffect $ randomVect >-> lineGraph
--   
module Graphics.DynamicGraph.TextureLine -- | (textureLineWindow windowWidth windowHeight samples -- xResolution) creates a window of width windowWidth and -- height windowHeight for displaying a line graph. -- -- A function is returned for dynamically updating the line graph. It -- takes an instance of IsPixelData of length samples as the y -- values and draws a line graph with xResolution vertices. textureLineWindow :: IsPixelData a => Int -> Int -> Int -> Int -> EitherT String IO (Consumer a IO ()) -- | (renderTextureLine samples xResolution) returns a function -- that renders a line graph into the current OpenGL context. The -- function takes an instance of IsPixelData of length samples -- and draws a line graph with xResolution vertices. -- -- All OpenGL based initialization of the rendering function (loading of -- shaders, etc) is performed before the function is returned. renderTextureLine :: IsPixelData a => Int -> Int -> IO (a -> IO ()) -- | Utility function to setup GLFW for graph drawing setupGLFW :: EitherT String IO ()