    --------------------------------------------------------------------------------
    -- |
    -- Module      :  Graphics.Rendering.OpenGL.GL.PixelRectangles.Rasterization
    -- Copyright   :  (c) Sven Panne 2002-2019
    -- License     :  BSD3
    --
    -- Maintainer  :  Sven Panne <svenpanne@gmail.com>
    -- Stability   :  stable
    -- Portability :  portable
    --
    -- This module corresponds to a part of section 3.6.4 (Rasterization of Pixel
    -- Rectangles) of the OpenGL 2.1 specs.
    --
    --------------------------------------------------------------------------------

    module Graphics.Rendering.OpenGL.GL.PixelRectangles.Rasterization (
       PixelData(..), PixelFormat(..), drawPixels, pixelZoom
    ) where

    import Control.Monad
    import Data.StateVar
    import Graphics.Rendering.OpenGL.GL.CoordTrans
    import Graphics.Rendering.OpenGL.GL.PixelData
    import Graphics.Rendering.OpenGL.GL.PixelFormat
    import Graphics.Rendering.OpenGL.GL.QueryUtils
    import Graphics.GL

    --------------------------------------------------------------------------------

    drawPixels :: Size -> PixelData a -> IO ()
    drawPixels :: forall a. Size -> PixelData a -> IO ()
    drawPixels (Size GLsizei
    w GLsizei
    h) PixelData a
    pd = PixelData a -> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
    forall a b. PixelData a -> (GLenum -> GLenum -> Ptr a -> b) -> b
    withPixelData PixelData a
    pd ((GLenum -> GLenum -> Ptr a -> IO ()) -> IO ())
    -> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ GLsizei -> GLsizei -> GLenum -> GLenum -> Ptr a -> IO ()
    forall (m :: * -> *) a.
    MonadIO m =>
    GLsizei -> GLsizei -> GLenum -> GLenum -> Ptr a -> m ()
    glDrawPixels GLsizei
    w GLsizei
    h

    --------------------------------------------------------------------------------

    pixelZoom :: StateVar (GLfloat, GLfloat)
    pixelZoom :: StateVar (GLfloat, GLfloat)
    pixelZoom =
       IO (GLfloat, GLfloat)
    -> ((GLfloat, GLfloat) -> IO ()) -> StateVar (GLfloat, GLfloat)
    forall a. IO a -> (a -> IO ()) -> StateVar a
    makeStateVar
          ((GLfloat -> GLfloat -> (GLfloat, GLfloat))
    -> IO GLfloat -> IO GLfloat -> IO (GLfloat, GLfloat)
    forall (m :: * -> *) a1 a2 r.
    Monad m =>
    (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
    liftM2 (,) ((GLfloat -> GLfloat) -> PName1F -> IO GLfloat
    forall p a. GetPName1F p => (GLfloat -> a) -> p -> IO a
    forall a. (GLfloat -> a) -> PName1F -> IO a
    getFloat1 GLfloat -> GLfloat
    forall a. a -> a
    id PName1F
    GetZoomX) ((GLfloat -> GLfloat) -> PName1F -> IO GLfloat
    forall p a. GetPName1F p => (GLfloat -> a) -> p -> IO a
    forall a. (GLfloat -> a) -> PName1F -> IO a
    getFloat1 GLfloat -> GLfloat
    forall a. a -> a
    id PName1F
    GetZoomY))
          ((GLfloat -> GLfloat -> IO ()) -> (GLfloat, GLfloat) -> IO ()
    forall a b c. (a -> b -> c) -> (a, b) -> c
    uncurry GLfloat -> GLfloat -> IO ()
    forall (m :: * -> *). MonadIO m => GLfloat -> GLfloat -> m ()
    glPixelZoom)