Skip to content
Browse files

Wrap 'SDL_MapRGB'

  • Loading branch information...
1 parent b606dc7 commit 5d8c8a3019603f2d8383ccdc3ffba9ff82dc52e7 @ocharles ocharles committed
Showing with 9 additions and 3 deletions.
  1. +9 −3 Graphics/UI/SDL/Video.hsc
View
12 Graphics/UI/SDL/Video.hsc
@@ -710,9 +710,6 @@ foreign import ccall unsafe "SDL_GetWindowPixelFormat"
foreign import ccall unsafe "SDL_AllocFormat"
sdlAllocFormat :: Word32 -> IO (Ptr PixelFormatStruct)
-foreign import ccall unsafe "SDL_MapRGBA"
- sdlMapRGBA :: Ptr PixelFormatStruct -> Word8 -> Word8 -> Word8 -> Word8 -> IO Word32
-
getWindowPixelFormat :: Window -> IO Word32
getWindowPixelFormat w = withForeignPtr w sdlGetWindowPixelFormat
@@ -722,6 +719,15 @@ allocFormat pf = sdlAllocFormat pf >>= newForeignPtr sdlFreeFormat_finalizer
foreign import ccall unsafe "&SDL_FreeFormat"
sdlFreeFormat_finalizer :: FunPtr (Ptr PixelFormatStruct -> IO ())
+foreign import ccall unsafe "SDL_MapRGB"
+ sdlMapRGB :: Ptr PixelFormatStruct -> Word8 -> Word8 -> Word8 -> IO Word32
+
+mapRGB :: PixelFormat -> Word8 -> Word8 -> Word8 -> IO Word32
+mapRGB p r g b = withForeignPtr p $ \cp -> sdlMapRGB cp r g b
+
+foreign import ccall unsafe "SDL_MapRGBA"
+ sdlMapRGBA :: Ptr PixelFormatStruct -> Word8 -> Word8 -> Word8 -> Word8 -> IO Word32
+
mapRGBA :: PixelFormat -> Word8 -> Word8 -> Word8 -> Word8 -> IO Word32
mapRGBA p r g b a = withForeignPtr p $ \cp -> sdlMapRGBA cp r g b a

0 comments on commit 5d8c8a3

Please sign in to comment.
Something went wrong with that request. Please try again.