{-# LINE 2 "./Graphics/UI/Gtk/OpenGL/Pixmap.chs" #-}
-- -*-haskell-*-
-- GIMP Toolkit (GTK) OpenGL Extension: GLPixmap
--
-- Author : Duncan Coutts
--
-- Created: 9 June 2005
--
-- Copyright (C) 2005 Duncan Coutts
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- |
-- Maintainer : gtk2hs-users@lists.sourceforge.net
-- Stability : provisional
-- Portability : portable (depends on GHC)
--
-- OpenGL pixmap which is maintained off-screen
--
module Graphics.UI.Gtk.OpenGL.Pixmap (

-- * Class Hierarchy
-- |
-- @
-- | 'GObject'
-- | +----'Drawable'
-- | +----GLPixmap
-- @

-- * Types
  GLPixmap,
  GLPixmapClass,
  castToGLPixmap,

-- * Constructors
  glPixmapNew,

-- * Methods
  glPixmapGetPixmap,
  ) where

import Control.Monad (liftM)

import System.Glib.FFI
import System.Glib.GObject (makeNewGObject)
import Graphics.UI.Gtk.OpenGL.Types
{-# LINE 55 "./Graphics/UI/Gtk/OpenGL/Pixmap.chs" #-}


{-# LINE 57 "./Graphics/UI/Gtk/OpenGL/Pixmap.chs" #-}

instance GLDrawableClass GLPixmap

--------------------
-- Constructors

-- | Creates an off-screen rendering area.
--
glPixmapNew ::
    GLConfig
 -> Pixmap -- ^ @pixmap@ - the 'Pixmap' to be used as the rendering area.
 -> IO GLPixmap
glPixmapNew glconfig pixmap =
  makeNewGObject mkGLPixmap $
  (\(GLConfig arg1) (Pixmap arg2) arg3 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gdk_gl_pixmap_new argPtr1 argPtr2 arg3)
{-# LINE 72 "./Graphics/UI/Gtk/OpenGL/Pixmap.chs" #-}
    (toGLConfig glconfig)
    (toPixmap pixmap)
    nullPtr

--------------------
-- Methods

-- | Returns the 'Pixmap' associated with a 'GLPixmap'.
--
glPixmapGetPixmap :: GLPixmap -> IO Pixmap
glPixmapGetPixmap self =
  makeNewGObject mkPixmap $
  (\(GLPixmap arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_pixmap_get_pixmap argPtr1)
{-# LINE 85 "./Graphics/UI/Gtk/OpenGL/Pixmap.chs" #-}
    (toGLPixmap self)

foreign import ccall safe "gdk_gl_pixmap_new"
  gdk_gl_pixmap_new :: ((Ptr GLConfig) -> ((Ptr Pixmap) -> ((Ptr CInt) -> (IO (Ptr GLPixmap)))))

foreign import ccall safe "gdk_gl_pixmap_get_pixmap"
  gdk_gl_pixmap_get_pixmap :: ((Ptr GLPixmap) -> (IO (Ptr Pixmap)))