diff --git a/Graphics/UI/SDL/Framerate.hs b/Graphics/UI/SDL/Framerate.hs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/SDL/Framerate.hs
@@ -0,0 +1,64 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.SDL.Framerate
+-- Copyright   :  (c) David Himmelstrup 2005
+-- License     :  BSD-like
+--
+-- Maintainer  :  lemmih@gmail.com
+-- Stability   :  provisional
+-- Portability :  portable
+--
+-----------------------------------------------------------------------------
+module Graphics.UI.SDL.Framerate
+    ( new
+    , init
+    , set
+    , get
+    , delay
+    , FPSManager
+    ) where
+
+import Foreign as Foreign hiding (new)
+import Foreign.C
+
+import Prelude hiding (init)
+
+data FPSManagerStruct
+type FPSManager = ForeignPtr FPSManagerStruct
+
+sizeOfManager :: Int
+sizeOfManager = 16
+
+new :: IO FPSManager
+new  = do manager <- Foreign.mallocBytes sizeOfManager >>= newForeignPtr finalizerFree
+          init manager
+          return manager
+
+-- void SDL_initFramerate(FPSmanager * manager);
+foreign import ccall unsafe "SDL_initFramerate" sdlInitFramerate :: Ptr FPSManagerStruct -> IO ()
+init :: FPSManager -> IO ()
+init manager
+    = withForeignPtr manager sdlInitFramerate
+
+
+-- int SDL_setFramerate(FPSmanager * manager, int rate);
+foreign import ccall unsafe "SDL_setFramerate" sdlSetFramerate :: Ptr FPSManagerStruct -> Int -> IO Int
+set :: FPSManager -> Int -> IO Bool
+set manager hz
+    = withForeignPtr manager $ \fpsPtr ->
+      do ret <- sdlSetFramerate fpsPtr hz
+         case ret of
+           (-1) -> return False
+           _    -> return True
+
+-- int SDL_getFramerate(FPSmanager * manager);
+foreign import ccall unsafe "SDL_getFramerate" sdlGetFramerate :: Ptr FPSManagerStruct -> IO Int
+get :: FPSManager -> IO Int
+get manager = withForeignPtr manager sdlGetFramerate
+
+-- void SDL_framerateDelay(FPSmanager * manager);
+foreign import ccall unsafe "SDL_framerateDelay" sdlFramerateDelay :: Ptr FPSManagerStruct -> IO ()
+delay :: FPSManager -> IO ()
+delay manager = withForeignPtr manager sdlFramerateDelay
+
+
diff --git a/Graphics/UI/SDL/Primitives.hs b/Graphics/UI/SDL/Primitives.hs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/SDL/Primitives.hs
@@ -0,0 +1,25 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.SDL.Primitives
+-- Copyright   :  (c) David Himmelstrup 2005
+-- License     :  BSD-like
+--
+-- Maintainer  :  lemmih@gmail.com
+-- Stability   :  provisional
+-- Portability :  portable
+--
+-----------------------------------------------------------------------------
+module Graphics.UI.SDL.Primitives where
+
+import Foreign
+
+import Graphics.UI.SDL.General
+import Graphics.UI.SDL.Types
+import Graphics.UI.SDL.Color
+import Graphics.UI.SDL.Rect
+
+
+
+-- int pixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+-- foregin import
+
diff --git a/Graphics/UI/SDL/Rotozoomer.hs b/Graphics/UI/SDL/Rotozoomer.hs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/SDL/Rotozoomer.hs
@@ -0,0 +1,55 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.SDL.Rotozoomer
+-- Copyright   :  (c) David Himmelstrup 2005
+-- License     :  BSD-like
+--
+-- Maintainer  :  lemmih@gmail.com
+-- Stability   :  provisional
+-- Portability :  portable
+--
+-----------------------------------------------------------------------------
+module Graphics.UI.SDL.Rotozoomer where
+
+import Foreign
+import Foreign.C
+
+import Graphics.UI.SDL.Video
+import Graphics.UI.SDL.General
+import Graphics.UI.SDL.Types
+
+finalizeWhenNotNull :: String -> Ptr SurfaceStruct -> IO Surface
+finalizeWhenNotNull errMsg image
+    = if image == nullPtr
+         then failWithError errMsg
+         else mkFinalizedSurface image
+
+
+
+-- SDL_Surface * rotozoomSurface (SDL_Surface *src, double angle, double zoom, int smooth);
+foreign import ccall unsafe "rotozoomSurface" sdlRotozoom
+    :: Ptr SurfaceStruct -> Double -> Double -> Int -> IO (Ptr SurfaceStruct)
+rotozoom :: Surface -> Double -> Double -> Bool -> IO Surface
+rotozoom src angle zoom smooth
+    = withForeignPtr src $ \imgSrc ->
+      sdlRotozoom imgSrc angle zoom (fromBool smooth) >>= finalizeWhenNotNull "rotozoomSurface"
+
+{-
+-- SDL_Surface * rotozoomSurfaceXY (SDL_Surface *src, double angle, double zoomx, double zoomy, int smooth);
+foreign import ccall unsafe "rotozoomSurfaceXY" sdlRotozoomXY
+    :: Ptr SurfaceStruct -> Double -> Double -> Double -> Int -> IO (Ptr SurfaceStruct)
+rotozoomXY :: Surface -> Double -> Double -> Double -> Bool -> IO Surface
+rotozoomXY src angle zoomx zoomy smooth
+    = withForeignPtr src $ \imgSrc ->
+      sdlRotozoomXY imgSrc angle zoomx zoomy (fromBool smooth) >>= finalizeWhenNotNull "rotozoomSurfaceXY"
+-}
+
+-- SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx, double zoomy, int smooth);
+foreign import ccall unsafe "zoomSurface" sdlZoom
+    :: Ptr SurfaceStruct -> Double -> Double -> Int -> IO (Ptr SurfaceStruct)
+zoom :: Surface -> Double -> Double -> Bool -> IO Surface
+zoom src zoomx zoomy smooth
+    = withForeignPtr src $ \imgSrc ->
+      sdlZoom imgSrc zoomx zoomy (fromBool smooth) >>= finalizeWhenNotNull "zoomSurface"
+
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,35 @@
+Copyright (c) 2004-2006, David Himmelstrup
+All rights reserved.
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+    * Redistributions of source code must retain
+      the above copyright notice, this list of
+      conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce
+      the above copyright notice, this list of
+      conditions and the following disclaimer in the
+      documentation and/or other materials provided
+      with the distribution.
+    * Neither the name of David Himmelstrup nor the
+      names of other contributors may be used to
+      endorse or promote products derived from this
+      software without specific prior written permission.
+
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGE.
diff --git a/SDL-gfx.cabal b/SDL-gfx.cabal
new file mode 100644
--- /dev/null
+++ b/SDL-gfx.cabal
@@ -0,0 +1,16 @@
+Name: SDL-gfx
+Version: 0.4.0
+Maintainer: Lemmih (lemmih@gmail.com)
+Author: Lemmih (lemmih@gmail.com)
+Copyright: 2004-2005, Lemmih
+License-File: LICENSE
+Build-Depends: base, SDL
+Category: Foreign binding
+Synopsis: Binding to libSDL_gfx
+Extensions: CPP, ForeignFunctionInterface
+Exposed-Modules:
+  Graphics.UI.SDL.Rotozoomer,
+  Graphics.UI.SDL.Primitives,
+  Graphics.UI.SDL.Framerate
+Includes: SDL.h SDL_framerate.h SDL_gfxPrimitives.h SDL_rotozoom.h
+GHC-Options: -fglasgow-exts -O2 -fvia-c
diff --git a/Setup.lhs b/Setup.lhs
new file mode 100644
--- /dev/null
+++ b/Setup.lhs
@@ -0,0 +1,5 @@
+#!/usr/bin/env runhaskell
+> module Main where
+> import Distribution.Simple
+> main :: IO ()
+> main = defaultMainWithHooks defaultUserHooks
