{-# LINE 1 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}{-# LANGUAGE CPP #-}{- | Module : Graphics.Win32.GDI.AlphaBlend Copyright : 2013 shelarcy License : BSD-style Maintainer : shelarcy@gmail.com Stability : Provisional Portability : Non-portable (Win32 API) Provides alpha blending functionality. -}moduleGraphics.Win32.GDI.AlphaBlendwhereimportForeign.Storable(Storable(..))importForeign.Ptr(Ptr)importGraphics.Win32.GDI.Types(HDC)importSystem.Win32.Types(BOOL,BYTE,UINT) #include "windows_cconv.h" foreignimportccallunsafe"alphablend.h"c_AlphaBlend::HDC->Int->Int->Int->Int->HDC->Int->Int->Int->Int->PBLENDFUNCTION->IOBOOL{- We use C wrapper function to call this API. Because foreign stacall/ccall/capi doesn't work with non-pointer user defined type. We think that capi should support that when user defined type has Storable class instance and using CTYPE pragma in the scope. {-# LANGUAGE CApiFFI #-} data {-# CTYPE "windows.h" "BLENDFUNCTION" #-} BLENDFUNCTION = foreign import capi unsafe "windows.h AlphaBlend" c_AlphaBlend :: HDC -> Int -> Int -> Int -> Int -> HDC -> Int -> Int -> Int -> Int -> BLENDFUNCTION -> IO BOOL -}foreignimportWINDOWS_CCONVunsafe"windows.h TransparentBlt"c_TransparentBlt::HDC->Int->Int->Int->Int->HDC->Int->Int->Int->Int->UINT->IOBOOLaC_SRC_OVER::BYTEaC_SRC_OVER=0{-# LINE 45 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}aC_SRC_ALPHA::BYTEaC_SRC_ALPHA=1{-# LINE 48 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}typePBLENDFUNCTION=PtrBLENDFUNCTIONtypeLPBLENDFUNCTION=PtrBLENDFUNCTIONdataBLENDFUNCTION=BLENDFUNCTION{blendOp::BYTE,blendFlags::BYTE,sourceConstantAlpha::BYTE,alphaFormat::BYTE}deriving(Show)instanceStorableBLENDFUNCTIONwheresizeOf=const(4){-# LINE 61 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}alignment_=1{-# LINE 62 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}pokebuffunc=do((\hsc_ptr->pokeByteOffhsc_ptr0))buf(blendOpfunc){-# LINE 64 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}((\hsc_ptr->pokeByteOffhsc_ptr1))buf(blendFlagsfunc){-# LINE 65 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}((\hsc_ptr->pokeByteOffhsc_ptr2))buf(sourceConstantAlphafunc){-# LINE 66 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}((\hsc_ptr->pokeByteOffhsc_ptr3))buf(alphaFormatfunc){-# LINE 67 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}peekbuf=doblendOp'<-((\hsc_ptr->peekByteOffhsc_ptr0))buf{-# LINE 70 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}blendFlags'<-((\hsc_ptr->peekByteOffhsc_ptr1))buf{-# LINE 71 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}sourceConstantAlpha'<-((\hsc_ptr->peekByteOffhsc_ptr2))buf{-# LINE 73 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}alphaFormat'<-((\hsc_ptr->peekByteOffhsc_ptr3))buf{-# LINE 74 "Graphics\\Win32\\GDI\\AlphaBlend.hsc" #-}return$BLENDFUNCTIONblendOp'blendFlags'sourceConstantAlpha'alphaFormat'