1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
module Graphics.Gloss.Rendering
( -- * Picture data type
Picture (..)
, Point, Vector, Path
-- * Colors
, Color
, makeColor
, makeColorI
, makeRawColor
, makeRawColorI
, rgbaOfColor
, clampColor
-- * Bitmaps
, Rectangle(..)
, BitmapData, bitmapSize
, BitmapFormat(..), PixelFormat(..), RowOrder(..)
, bitmapOfForeignPtr
, bitmapDataOfForeignPtr
, bitmapOfByteString
, bitmapDataOfByteString
, bitmapOfBMP
, bitmapDataOfBMP
, loadBMP
-- * Rendering
, displayPicture
, renderPicture
, withModelview
, withClearBuffer
, RS.initState
, RS.State)
where
import Graphics.Gloss.Internals.Rendering.Common
import Graphics.Gloss.Internals.Rendering.Picture
import Graphics.Gloss.Internals.Data.Picture
import Graphics.Gloss.Internals.Data.Color
import qualified Graphics.Gloss.Internals.Rendering.State as RS
-- | Set up the OpenGL context, clear the buffer, and render the given picture
-- into it.
--
-- This is the same as `renderPicture` composed with `withModelview`
-- and `withClearBuffer`. If you want to manage your own OpenGL context then
-- you can just call `renderPicture`.
--
-- Using this function assumes that you've already opened a window
-- and set that to the active context. If you don't want to do your own window
-- management then use the @gloss@ package instead.
displayPicture
:: (Int, Int) -- ^ Window width and height.
-> Color -- ^ Color to clear the window with.
-> RS.State -- ^ Current rendering state.
-> Float -- ^ View port scale, which controls the level of detail.
-- Use 1.0 to start with.
-> Picture -- ^ Picture to draw.
-> IO ()
displayPicture windowSize colorClear state scale picture
= withModelview windowSize
$ withClearBuffer colorClear
$ renderPicture state scale picture
|