module Graphics.Imlib (
ImlibProgressFunction, ImlibDataDestructorFunction,
ImlibTTFEncoding (..), ImlibLoadError (..), ImlibTextDirection (..),
ImlibOperation (..), ImlibColor (..), ImlibBorder (..), ImlibPolygon,
ImlibFilter, ImlibColorRange, ImlibFont, ImlibUpdates,
ImlibColorModifier, ImlibImage, ImlibContext,
contextSetDitherMask, contextSetAntiAlias, contextSetDither,
contextSetBlend, contextSetColorModifier, contextSetOperation,
contextSetFont, contextSetDirection, contextSetAngle, contextSetColor,
contextSetColorCmya, contextSetColorHsva, contextSetColorHlsa,
contextSetColorRange, contextSetProgressFunction,
contextSetProgressGranularity, contextSetFilter, contextSetImage,
contextGetDitherMask, contextGetAntiAlias, contextGetDither,
contextGetBlend, contextGetColorModifier, contextGetOperation,
contextGetFont, contextGetAngle, contextGetDirection, contextGetColor,
contextGetColorCmya, contextGetColorHsva, contextGetColorHlsa,
contextGetImlibColor, contextGetColorRange, contextGetProgressFunction,
contextGetProgressGranularity, contextGetImage, contextGetFilter,
getCacheSize, setCacheSize, getColorUsage, setColorUsage,
flushLoaders, loadImage, loadImageImmediately, loadImageWithoutCache,
loadImageImmediatelyWithoutCache, loadImageWithErrorReturn, freeImage,
freeImageAndDecache, imageGetWidth, imageGetHeight, imageGetFilename,
imageGetData, imageGetDataForReadingOnly, imagePutBackData,
imageWithData, imageHasAlpha, imageSetChangesOnDisk, imageGetBorder,
imageSetBorder, imageSetFormat, imageSetIrrelevantFormat,
imageSetIrrelevantBorder, imageSetIrrelevantAlpha, imageFormat,
imageSetHasAlpha, blendImageOntoImage, createImage,
createImageUsingData, createImageUsingCopiedData, cloneImage,
createCroppedImage, createCroppedScaledImage, updatesClone,
updateAppendRect, updatesMerge, updatesMergeForRendering,
updatesFree, updatesGetNext, updatesGetCoordinates,
updatesSetCoordinates, updatesInit, updatesAppendUpdates,
imageFlipHorizontal, imageFlipVertical, imageFlipDiagonal,
imageOrientate, imageBlur, imageSharpen, imageTileHorizontal,
imageTileVertical, imageTile, loadFont, freeFont, textDraw,
textDrawWithReturnMetrics, getTextSize, getTextAdvance, getTextInset,
addPathToFontPath, removePathFromFontPath, listFontPath,
textGetIndexAndLocation, textGetLocationAtIndex, listFonts,
getFontCacheSize, setFontCacheSize, flushFontCache, getFontAscent,
getFontDescent, getMaximumFontAscent, getMaximumFontDescent,
createColorModifier, freeColorModifier, modifyColorModifierGamma,
modifyColorModifierBrightness, modifyColorModifierContrast,
setColorModifierTables, getColorModifierTables, resetColorModifier,
applyColorModifier, applyColorModifierToRectangle, imageDrawLine,
imageDrawRectangle, imageFillRectangle, imageCopyAlphaToImage,
imageCopyAlphaRectangleToImage, imageScrollRect, imageCopyRect,
createColorRange, freeColorRange, addColorToColorRange,
imageFillColorRangeRectangle, imageFillHsvaColorRangeRectangle,
imageQueryPixel, imageQueryPixelCmya, imageQueryPixelHsva,
imageQueryPixelHlsa, imageAttachDataValue, imageGetAttachedData,
imageGetAttachedValue, imageRemoveAttachedDataValue,
imageRemoveAndFreeAttachedDataValue, saveImage,
saveImageWithErrorReturn, createRotatedImage,
blendImageOntoImageAtAngle, blendImageOntoImageSkewed,
contextSetCliprect, polygonNew, polygonFree,
polygonAddPoint, imageDrawPolygon, imageFillPolygon, polygonGetBounds,
polygonContainsPoint, imageDrawEllipse, imageFillEllipse, imageFilter,
createFilter, freeFilter, filterSet, filterSetAlpha, filterSetRed,
filterSetGreen, filterSetBlue, filterConstants, filterDivisors,
createImageUsingArray, withImageBits, withImage
)
where
import Foreign
import Foreign.C
import Data.Bits
import Data.Array
import Control.Monad
import Graphics.X11.Types
nmalloc :: Storable a => Int -> IO [Ptr a]
nmalloc n = replicateM n malloc
nmallocArray :: Storable a => Int -> Int -> IO [Ptr a]
nmallocArray n m = replicateM n (mallocArray m)
newtype ImlibContext = ImlibContext (Ptr ImlibContext)
newtype ImlibImage = ImlibImage (Ptr ImlibImage)
newtype ImlibColorModifier = ImlibColorModifier (Ptr ImlibColorModifier)
newtype ImlibUpdates = ImlibUpdates (Ptr ImlibUpdates)
newtype ImlibFont = ImlibFont (Ptr ImlibFont)
newtype ImlibColorRange = ImlibColorRange (Ptr ImlibColorRange)
newtype ImlibFilter = ImlibFilter (Ptr ImlibFilter)
newtype ImlibPolygon = ImlibPolygon (Ptr ImlibPolygon)
data ImlibBorder = ImlibBorder Int Int Int Int deriving (Show, Eq)
instance Storable ImlibBorder where
sizeOf _ = 16
alignment _ = 4
peek p = do
[a,b,c,d] <- peekArray 4 (castPtr p)
return (ImlibBorder a b c d)
poke p (ImlibBorder a b c d) =
pokeArray (castPtr p) [a,b,c,d]
data ImlibColor = ImlibColor Word32 Word32 Word32 Word32 deriving (Show, Eq)
instance Storable ImlibColor where
sizeOf _ = 16
alignment _ = 4
peek p = do
[a,b,c,d] <- peekArray 4 (castPtr p)
return (ImlibColor a b c d)
where
poke p (ImlibColor a b c d) = do
pokeArray (castPtr p) [a,b,c,d]
data ImlibOperation = ImlibOpCopy
| ImlibOpAdd
| ImlibOpSubtract
| ImlibOpReshade
deriving (Enum, Show, Eq)
data ImlibTextDirection = ImlibTextToRight
| ImlibTextToLeft
| ImlibTextToDown
| ImlibTextToUp
| ImlibTextToAngle
deriving (Enum, Show, Eq)
data ImlibLoadError = ImlibLoadErrorNone
| ImlibLoadErrorFileDoesNotExist
| ImlibLoadErrorFileIsDirectory
| ImlibLoadErrorPermissionDeniedToRead
| ImlibLoadErrorNoLoaderForFileFormat
| ImlibLoadErrorPathTooLong
| ImlibLoadErrorPathComponentNonExistant
| ImlibLoadErrorPathComponentNotDirectory
| ImlibLoadErrorPathPointsOutsideAddressSpace
| ImlibLoadErrorTooManySymbolicLinks
| ImlibLoadErrorOutOfMemory
| ImlibLoadErrorOutOfFileDescriptors
| ImlibLoadErrorPermissionDeniedToWrite
| ImlibLoadErrorOutOfDiskSpace
| ImlibLoadErrorUnknown
deriving (Show, Enum, Eq)
data ImlibTTFEncoding = ImlibTTFEncodingISO88591
| ImlibTTFEncodingISO88592
| ImlibTTFEncodingISO88593
| ImlibTTFEncodingISO88594
| ImlibTTFEncodingISO88595
deriving (Enum, Show, Eq)
type ImlibProgressFunction = ImlibImage
-> Word8
-> Int
-> Int
-> Int
-> Int
-> IO Int
foreign import ccall "wrapper" mkProgressFunction :: ImlibProgressFunction -> IO (FunPtr ImlibProgressFunction)
colorToBits :: ImlibColor -> Word32
colorToBits (ImlibColor a r g b) = fromIntegral (b + (g `shift` 8) + (r `shift` 16) + (a `shift` 24))
colorFromBits :: Word32 -> ImlibColor
colorFromBits n = ImlibColor a r g b
where
b = fromIntegral $ n `mod` 256
g = fromIntegral $ (n `shift` (8)) `mod` 256
r = fromIntegral $ (n `shift` (16)) `mod` 256
a = fromIntegral $ (n `shift` (24)) `mod` 256
type ImlibDataDestructorFunction = ImlibImage -> Ptr () -> IO ()
foreign import ccall "wrapper" mkDestructorFunction :: ImlibDataDestructorFunction -> IO (FunPtr ImlibDataDestructorFunction)
foreign import ccall "static Imlib2.h imlib_context_set_dither_mask" imlibContextSetDitherMask :: Bool -> IO ()
contextSetDitherMask :: Bool -> IO ()
contextSetDitherMask = imlibContextSetDitherMask
foreign import ccall "static Imlib2.h imlib_context_set_anti_alias" imlibContextSetAntiAlias :: Bool -> IO ()
contextSetAntiAlias :: Bool -> IO ()
contextSetAntiAlias = imlibContextSetAntiAlias
foreign import ccall "static Imlib2.h imlib_context_set_dither" imlibContextSetDither :: Bool -> IO ()
contextSetDither :: Bool -> IO ()
contextSetDither = imlibContextSetDither
foreign import ccall "static Imlib2.h imlib_context_set_blend" imlibContextSetBlend :: Bool -> IO ()
contextSetBlend :: Bool -> IO ()
contextSetBlend = imlibContextSetBlend
foreign import ccall "static Imlib2.h imlib_context_set_color_modifier" imlibContextSetColorModifier :: ImlibColorModifier -> IO ()
contextSetColorModifier :: ImlibColorModifier -> IO ()
contextSetColorModifier = imlibContextSetColorModifier
foreign import ccall "static Imlib2.h imlib_context_set_operation" imlibContextSetOperation :: Int -> IO ()
contextSetOperation :: ImlibOperation -> IO ()
contextSetOperation op = imlibContextSetOperation (fromEnum op)
foreign import ccall "static Imlib2.h imlib_context_set_font" imlibContextSetFont :: ImlibFont -> IO ()
contextSetFont :: ImlibFont -> IO ()
contextSetFont = imlibContextSetFont
foreign import ccall "static Imlib2.h imlib_context_set_direction" imlibContextSetDirection :: Int -> IO ()
contextSetDirection :: ImlibTextDirection -> IO ()
contextSetDirection dir = imlibContextSetDirection (fromEnum dir)
foreign import ccall "static Imlib2.h imlib_context_set_angle" imlibContextSetAngle :: Double -> IO ()
contextSetAngle :: Double -> IO ()
contextSetAngle = imlibContextSetAngle
foreign import ccall "static Imlib2.h imlib_context_set_color" imlibContextSetColor :: Int -> Int -> Int -> Int -> IO ()
contextSetColor :: Int -> Int -> Int -> Int -> IO ()
contextSetColor = imlibContextSetColor
foreign import ccall "static Imlib2.h imlib_context_set_color_cmya" imlibContextSetColorCmya :: Int -> Int -> Int -> Int -> IO ()
contextSetColorCmya :: Int -> Int -> Int -> Int -> IO ()
contextSetColorCmya = imlibContextSetColorCmya
foreign import ccall "static Imlib2.h imlib_context_set_color_hsva" imlibContextSetColorHsva :: Int -> Int -> Int -> Int -> IO ()
contextSetColorHsva = imlibContextSetColorHsva
foreign import ccall "static Imlib2.h imlib_context_set_color_hlsa" imlibContextSetColorHlsa :: Int -> Int -> Int -> Int -> IO ()
contextSetColorHlsa = imlibContextSetColorHlsa
foreign import ccall "static Imlib2.h imlib_context_set_color_range" imlibContextSetColorRange :: ImlibColorRange -> IO ()
contextSetColorRange :: ImlibColorRange -> IO ()
contextSetColorRange = imlibContextSetColorRange
foreign import ccall "static Imlib2.h imlib_context_set_progress_function" imlibContextSetProgressFunction :: FunPtr(ImlibProgressFunction) -> IO ()
contextSetProgressFunction f = do
fn <- mkProgressFunction f
imlibContextSetProgressFunction fn
foreign import ccall "static Imlib2.h imlib_context_set_progress_granularity" imlibContextSetProgressGranularity :: Word8 -> IO ()
contextSetProgressGranularity :: Word8 -> IO ()
contextSetProgressGranularity = imlibContextSetProgressGranularity
foreign import ccall "static Imlib2.h imlib_context_set_filter" imlibContextSetFilter :: ImlibFilter -> IO ()
contextSetFilter :: ImlibFilter -> IO ()
contextSetFilter = imlibContextSetFilter
foreign import ccall "static Imlib2.h imlib_context_set_image" imlibContextSetImage :: ImlibImage -> IO ()
contextSetImage :: ImlibImage -> IO ()
contextSetImage = imlibContextSetImage
foreign import ccall "static Imlib2.h imlib_context_get_dither_mask" imlibContextGetDitherMask :: IO Bool
contextGetDitherMask :: IO Bool
contextGetDitherMask = imlibContextGetDitherMask
foreign import ccall "static Imlib2.h imlib_context_get_anti_alias" imlibContextGetAntiAlias :: IO Bool
contextGetAntiAlias :: IO Bool
contextGetAntiAlias = imlibContextGetAntiAlias
foreign import ccall "static Imlib2.h imlib_context_get_dither" imlibContextGetDither :: IO Bool
contextGetDither :: IO Bool
contextGetDither = imlibContextGetDither
foreign import ccall "static Imlib2.h imlib_context_get_blend" imlibContextGetBlend :: IO Bool
contextGetBlend :: IO Bool
contextGetBlend = imlibContextGetBlend
foreign import ccall "static Imlib2.h imlib_context_get_color_modifier" imlibContextGetColorModifier :: IO ImlibColorModifier
contextGetColorModifier :: IO ImlibColorModifier
contextGetColorModifier = imlibContextGetColorModifier
foreign import ccall "static Imlib2.h imlib_context_get_operation" imlibContextGetOperation :: IO Int
contextGetOperation :: IO ImlibOperation
contextGetOperation = do
i <- imlibContextGetOperation
return (toEnum i)
foreign import ccall "static Imlib2.h imlib_context_get_font" imlibContextGetFont :: IO ImlibFont
contextGetFont :: IO ImlibFont
contextGetFont = imlibContextGetFont
foreign import ccall "static Imlib2.h imlib_context_get_angle" imlibContextGetAngle :: IO Double
contextGetAngle :: IO Double
contextGetAngle = imlibContextGetAngle
foreign import ccall "static Imlib2.h imlib_context_get_direction" imlibContextGetDirection :: IO Int
contextGetDirection :: IO ImlibTextDirection
contextGetDirection = do
d <- imlibContextGetDirection
return (toEnum d)
foreign import ccall "static Imlib2.h imlib_context_get_color" imlibContextGetColor :: Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()
contextGetColor :: IO (Int, Int, Int, Int)
contextGetColor = do
[r,g,b,a] <- nmalloc 4
imlibContextGetColor r g b a
[rr,gg,bb,aa] <- mapM peek [r,g,b,a]
mapM free [r,g,b,a]
return (rr,gg,bb,aa)
foreign import ccall "static Imlib2.h imlib_context_get_color_cmya" imlibContextGetColorCmya :: Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()
contextGetColorCmya :: IO (Int, Int, Int, Int)
contextGetColorCmya = do
[c,m,y,a] <- nmalloc 4
imlibContextGetColorCmya c m y a
[cc,mm,yy,aa] <- mapM peek [c,m,y,a]
mapM free [c,m,y,a]
return (cc,mm,yy,aa)
foreign import ccall "static Imlib2.h imlib_context_get_color_hsva" imlibContextGetColorHsva :: Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()
contextGetColorHsva :: IO (Int, Int, Int, Int)
contextGetColorHsva = do
[h,s,v,a] <- nmalloc 4
imlibContextGetColorHsva h s v a
[hh,ss,vv,aa] <- mapM peek [h,s,v,a]
mapM free [h,s,v,a]
return (hh,ss,vv,aa)
foreign import ccall "static Imlib2.h imlib_context_get_color_hlsa" imlibContextGetColorHlsa :: Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()
contextGetColorHlsa :: IO (Int, Int, Int, Int)
contextGetColorHlsa = do
[h,l,s,a] <- nmalloc 4
imlibContextGetColorHlsa h l s a
[hh,ll,ss,aa] <- mapM peek [h,l,s,a]
mapM free [h,l,s,a]
return (hh,ll,ss,aa)
foreign import ccall "static Imlib2.h imlib_context_get_imlib_color" imlibContextGetImlibColor :: IO (Ptr ImlibColor)
contextGetImlibColor :: IO ImlibColor
contextGetImlibColor = do
c <- imlibContextGetImlibColor
cc <- peek c
free c
return cc
foreign import ccall "static Imlib2.h imlib_context_get_color_range" imlibContextGetColorRange :: IO ImlibColorRange
contextGetColorRange :: IO ImlibColorRange
contextGetColorRange = imlibContextGetColorRange
foreign import ccall "static Imlib2.h imlib_context_get_progress_function" imlibContextGetProgressFunction :: IO (FunPtr ImlibProgressFunction)
contextGetProgressFunction = imlibContextGetProgressFunction
foreign import ccall "static Imlib2.h imlib_context_get_progress_granularity" imlibContextGetProgressGranularity :: IO Word8
contextGetProgressGranularity :: IO Word8
contextGetProgressGranularity = imlibContextGetProgressGranularity
foreign import ccall "static Imlib2.h imlib_context_get_image" imlibContextGetImage :: IO ImlibImage
contextGetImage :: IO ImlibImage
contextGetImage = imlibContextGetImage
foreign import ccall "static Imlib2.h imlib_context_get_filter" imlibContextGetFilter :: IO ImlibFilter
contextGetFilter :: IO ImlibFilter
contextGetFilter = imlibContextGetFilter
foreign import ccall "static Imlib2.h imlib_get_cache_size" imlibGetCacheSize :: IO Int
getCacheSize :: IO Int
getCacheSize = imlibGetCacheSize
foreign import ccall "static Imlib2.h imlib_set_cache_size" imlibSetCacheSize :: Int -> IO ()
setCacheSize :: Int -> IO ()
setCacheSize = imlibSetCacheSize
foreign import ccall "static Imlib2.h imlib_get_color_usage" imlibGetColorUsage :: IO Int
getColorUsage :: IO Int
getColorUsage = imlibGetColorUsage
foreign import ccall "static Imlib2.h imlib_set_color_usage" imlibSetColorUsage :: Int -> IO ()
setColorUsage :: Int -> IO ()
setColorUsage = imlibSetColorUsage
foreign import ccall "static Imlib2.h imlib_flush_loaders" imlibFlushLoaders :: IO ()
flushLoaders :: IO ()
flushLoaders = imlibFlushLoaders
foreign import ccall "static Imlib2.h imlib_load_image" imlibLoadImage :: CString -> IO ImlibImage
loadImage :: String -> IO ImlibImage
loadImage str = withCString str imlibLoadImage
foreign import ccall "static Imlib2.h imlib_load_image_immediately" imlibLoadImageImmediately :: CString -> IO ImlibImage
loadImageImmediately :: String -> IO ImlibImage
loadImageImmediately str = withCString str imlibLoadImageImmediately
foreign import ccall "static Imlib2.h imlib_load_image_without_cache" imlibLoadImageWithoutCache :: CString -> IO ImlibImage
loadImageWithoutCache :: String -> IO ImlibImage
loadImageWithoutCache str = withCString str imlibLoadImageWithoutCache
foreign import ccall "static Imlib2.h imlib_load_image_immediately_without_cache" imlibLoadImageImmediatelyWithoutCache :: CString -> IO ImlibImage
loadImageImmediatelyWithoutCache str = withCString str imlibLoadImageImmediatelyWithoutCache
foreign import ccall "static Imlib2.h imlib_load_image_with_error_return" imlibLoadImageWithErrorReturn :: CString -> Ptr Int -> IO ImlibImage
loadImageWithErrorReturn :: String -> IO (ImlibImage, ImlibLoadError)
loadImageWithErrorReturn str = do
pe <- malloc
im <- withCString str (\s -> imlibLoadImageWithErrorReturn s pe)
e <- peek pe
free pe
return (im, toEnum e)
foreign import ccall "static Imlib2.h imlib_free_image" imlibFreeImage :: IO ()
freeImage :: IO ()
freeImage = imlibFreeImage
foreign import ccall "static Imlib2.h imlib_free_image_and_decache" imlibFreeImageAndDecache :: IO ()
freeImageAndDecache :: IO ()
freeImageAndDecache = imlibFreeImageAndDecache
foreign import ccall "static Imlib2.h imlib_image_get_width" imlibImageGetWidth :: IO Int
imageGetWidth :: IO Int
imageGetWidth = imlibImageGetWidth
foreign import ccall "static Imlib2.h imlib_image_get_height" imlibImageGetHeight :: IO Int
imageGetHeight :: IO Int
imageGetHeight = imlibImageGetHeight
foreign import ccall "static Imlib2.h imlib_image_get_filename" imlibImageGetFilename :: IO CString
imageGetFilename :: IO String
imageGetFilename = do
b <- imlibImageGetFilename
peekCString b
foreign import ccall "static Imlib2.h imlib_image_get_data" imlibImageGetData :: IO (Ptr Word32)
imageGetData :: IO (Ptr Word32)
imageGetData = imlibImageGetData
foreign import ccall "static Imlib2.h imlib_image_get_data_for_reading_only" imlibImageGetDataForReadingOnly :: IO (Ptr Word32)
imageGetDataForReadingOnly :: IO (Ptr Word32)
imageGetDataForReadingOnly = imlibImageGetDataForReadingOnly
foreign import ccall "static Imlib2.h imlib_image_put_back_data" imlibImagePutBackData :: Ptr Word32 -> IO ()
imagePutBackData :: Ptr Word32 -> IO ()
imagePutBackData = imlibImagePutBackData
imageWithData :: (Ptr Word32 -> IO a) -> IO a
imageWithData f = do
p <- imageGetData
r <- f p
imagePutBackData p
return r
withImageBits :: (Int -> Int -> [Word32] -> [Word32]) -> IO ()
withImageBits f = do
w <- imageGetWidth
h <- imageGetHeight
p <- imageGetData
arr <- peekArray (w*h) p
pokeArray p $ f w h arr
imagePutBackData p
withImage :: (Int -> Int -> [ImlibColor] -> [ImlibColor]) -> IO ()
withImage f = do
w <- imageGetWidth
h <- imageGetHeight
p <- imageGetData
arr <- peekArray (w*h) p
pokeArray p . map colorToBits . f w h . map colorFromBits $ arr
imagePutBackData p
foreign import ccall "static Imlib2.h imlib_image_has_alpha" imlibImageHasAlpha :: IO Bool
imageHasAlpha :: IO Bool
imageHasAlpha = imlibImageHasAlpha
foreign import ccall "static Imlib2.h imlib_image_set_changes_on_disk" imlibImageSetChangesOnDisk :: IO ()
imageSetChangesOnDisk :: IO ()
imageSetChangesOnDisk = imlibImageSetChangesOnDisk
foreign import ccall "static Imlib2.h imlib_image_get_border" imlibImageGetBorder :: Ptr ImlibBorder -> IO ()
imageGetBorder :: IO ImlibBorder
imageGetBorder = do
b <- malloc
imlibImageGetBorder b
bb <- peek b
free b
return bb
foreign import ccall "static Imlib2.h imlib_image_set_border" imlibImageSetBorder :: Ptr ImlibBorder -> IO ()
imageSetBorder :: ImlibBorder -> IO ()
imageSetBorder b = do
p <- malloc
poke p b
imlibImageSetBorder p
free p
foreign import ccall "static Imlib2.h imlib_image_set_format" imlibImageSetFormat :: CString -> IO ()
imageSetFormat :: String -> IO ()
imageSetFormat str = withCString str imlibImageSetFormat
foreign import ccall "static Imlib2.h imlib_image_set_irrelevant_format" imlibImageSetIrrelevantFormat :: Bool -> IO ()
imageSetIrrelevantFormat :: Bool -> IO ()
imageSetIrrelevantFormat = imlibImageSetIrrelevantFormat
foreign import ccall "static Imlib2.h imlib_image_set_irrelevant_border" imlibImageSetIrrelevantBorder :: Bool -> IO ()
imageSetIrrelevantBorder :: Bool -> IO ()
imageSetIrrelevantBorder = imlibImageSetIrrelevantBorder
foreign import ccall "static Imlib2.h imlib_image_set_irrelevant_alpha" imlibImageSetIrrelevantAlpha :: Bool -> IO ()
imageSetIrrelevantAlpha :: Bool -> IO ()
imageSetIrrelevantAlpha = imlibImageSetIrrelevantAlpha
foreign import ccall "static Imlib2.h imlib_image_format" imlibImageFormat :: IO CString
imageFormat :: IO String
imageFormat = imlibImageFormat >>= peekCString
foreign import ccall "static Imlib2.h imlib_image_set_has_alpha" imlibImageSetHasAlpha :: Bool -> IO ()
imageSetHasAlpha :: Bool -> IO ()
imageSetHasAlpha = imlibImageSetHasAlpha
foreign import ccall "static Imlib2.h imlib_blend_image_onto_image" imlibBlendImageOntoImage
:: ImlibImage
-> Bool
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> IO ()
blendImageOntoImage mergeAlpha (sx, sy, sw, sh) (dx, dy, dw, dh) = imlibBlendImageOntoImage mergeAlpha sx sy sw sh dx dy dw dh
foreign import ccall "static Imlib2.h imlib_create_image" imlibCreateImage :: Int -> Int -> IO ImlibImage
createImage :: Int -> Int -> IO ImlibImage
createImage = imlibCreateImage
foreign import ccall "static Imlib2.h imlib_create_image_using_data" imlibCreateImageUsingData :: Int -> Int -> Ptr Word32 -> IO ImlibImage
createImageUsingData :: Int -> Int -> Ptr Word32 -> IO ImlibImage
createImageUsingData = imlibCreateImageUsingData
foreign import ccall "static Imlib2.h imlib_create_image_using_copied_data" imlibCreateImageUsingCopiedData :: Int -> Int -> Ptr(Word32) -> IO ImlibImage
createImageUsingCopiedData = imlibCreateImageUsingCopiedData
createImageUsingList :: Int -> Int -> [ImlibColor] -> IO ImlibImage
createImageUsingList w h xs = withArray (map colorToBits xs) (createImageUsingCopiedData w h)
createImageUsingArray :: Array (Int, Int) ImlibColor -> IO ImlibImage
createImageUsingArray a = createImageUsingList (bt+1) (rl+1) (elems a)
where ((t,l),(b,r)) = bounds a
foreign import ccall "static Imlib2.h imlib_clone_image" imlibCloneImage :: IO ImlibImage
cloneImage :: IO ImlibImage
cloneImage = imlibCloneImage
foreign import ccall "static Imlib2.h imlib_create_cropped_image" imlibCreateCroppedImage :: Int -> Int -> Int -> Int -> IO ImlibImage
createCroppedImage = imlibCreateCroppedImage
foreign import ccall "static Imlib2.h imlib_create_cropped_scaled_image" imlibCreateCroppedScaledImage :: Int -> Int -> Int -> Int -> Int -> Int -> IO ImlibImage
createCroppedScaledImage = imlibCreateCroppedScaledImage
foreign import ccall "static Imlib2.h imlib_updates_clone" imlibUpdatesClone :: ImlibUpdates -> IO ImlibUpdates
updatesClone :: ImlibUpdates -> IO ImlibUpdates
updatesClone = imlibUpdatesClone
foreign import ccall "static Imlib2.h imlib_update_append_rect" imlibUpdateAppendRect :: ImlibUpdates -> Int -> Int -> Int -> Int -> IO ImlibUpdates
updateAppendRect = imlibUpdateAppendRect
foreign import ccall "static Imlib2.h imlib_updates_merge" imlibUpdatesMerge :: ImlibUpdates -> Int -> Int -> IO ImlibUpdates
updatesMerge = imlibUpdatesMerge
foreign import ccall "static Imlib2.h imlib_updates_merge_for_rendering" imlibUpdatesMergeForRendering :: ImlibUpdates -> Int -> Int -> IO ImlibUpdates
updatesMergeForRendering = imlibUpdatesMergeForRendering
foreign import ccall "static Imlib2.h imlib_updates_free" imlibUpdatesFree :: ImlibUpdates -> IO ()
updatesFree :: ImlibUpdates -> IO ()
updatesFree = imlibUpdatesFree
foreign import ccall "static Imlib2.h imlib_updates_get_next" imlibUpdatesGetNext :: ImlibUpdates -> IO ImlibUpdates
updatesGetNext :: ImlibUpdates -> IO ImlibUpdates
updatesGetNext = imlibUpdatesGetNext
foreign import ccall "static Imlib2.h imlib_updates_get_coordinates" imlibUpdatesGetCoordinates :: ImlibUpdates -> Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()
updatesGetCoordinates :: ImlibUpdates -> IO (Int, Int, Int, Int)
updatesGetCoordinates u = do
[x,y,w,h] <- nmalloc 4
imlibUpdatesGetCoordinates u x y w h
[xx,yy,ww,hh] <- mapM peek [x,y,w,h]
mapM free [x,y,w,h]
return (xx,yy,ww,hh)
foreign import ccall "static Imlib2.h imlib_updates_set_coordinates" imlibUpdatesSetCoordinates :: ImlibUpdates -> Int -> Int -> Int -> Int -> IO ()
updatesSetCoordinates = imlibUpdatesSetCoordinates
foreign import ccall "static Imlib2.h imlib_updates_init" imlibUpdatesInit :: IO ImlibUpdates
updatesInit :: IO ImlibUpdates
updatesInit = imlibUpdatesInit
foreign import ccall "static Imlib2.h imlib_updates_append_updates" imlibUpdatesAppendUpdates :: ImlibUpdates -> ImlibUpdates -> IO ImlibUpdates
updatesAppendUpdates = imlibUpdatesAppendUpdates
foreign import ccall "static Imlib2.h imlib_image_flip_horizontal" imlibImageFlipHorizontal :: IO ()
imageFlipHorizontal :: IO ()
imageFlipHorizontal = imlibImageFlipHorizontal
foreign import ccall "static Imlib2.h imlib_image_flip_vertical" imlibImageFlipVertical :: IO ()
imageFlipVertical :: IO ()
imageFlipVertical = imlibImageFlipVertical
foreign import ccall "static Imlib2.h imlib_image_flip_diagonal" imlibImageFlipDiagonal :: IO ()
imageFlipDiagonal :: IO ()
imageFlipDiagonal = imlibImageFlipDiagonal
foreign import ccall "static Imlib2.h imlib_image_orientate" imlibImageOrientate :: Int -> IO ()
imageOrientate :: Int -> IO ()
imageOrientate = imlibImageOrientate
foreign import ccall "static Imlib2.h imlib_image_blur" imlibImageBlur :: Int -> IO ()
imageBlur :: Int -> IO ()
imageBlur = imlibImageBlur
foreign import ccall "static Imlib2.h imlib_image_sharpen" imlibImageSharpen :: Int -> IO ()
imageSharpen :: Int -> IO ()
imageSharpen = imlibImageSharpen
foreign import ccall "static Imlib2.h imlib_image_tile_horizontal" imlibImageTileHorizontal :: IO ()
imageTileHorizontal :: IO ()
imageTileHorizontal = imlibImageTileHorizontal
foreign import ccall "static Imlib2.h imlib_image_tile_vertical" imlibImageTileVertical :: IO ()
imageTileVertical :: IO ()
imageTileVertical = imlibImageTileVertical
foreign import ccall "static Imlib2.h imlib_image_tile" imlibImageTile :: IO ()
imageTile :: IO ()
imageTile = imlibImageTile
foreign import ccall "static Imlib2.h imlib_load_font" imlibLoadFont :: CString -> IO ImlibFont
loadFont :: String -> IO ImlibFont
loadFont str = withCString str imlibLoadFont
foreign import ccall "static Imlib2.h imlib_free_font" imlibFreeFont :: IO ()
freeFont :: forall t. t -> IO ()
freeFont _ = imlibFreeFont
foreign import ccall "static Imlib2.h imlib_text_draw" imlibTextDraw :: Int -> Int -> CString -> IO ()
textDraw :: Int -> Int -> String -> IO ()
textDraw x y str = withCString str (imlibTextDraw x y)
foreign import ccall "static Imlib2.h imlib_text_draw_with_return_metrics" imlibTextDrawWithReturnMetrics :: Int -> Int -> CString -> Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()
textDrawWithReturnMetrics x y str = do
[w,h,ah,av] <- nmalloc 4
withCString str (\s -> imlibTextDrawWithReturnMetrics x y s w h ah av)
[rw,rh,rah,rav] <- mapM peek [w,h,ah,av]
mapM free [w,h,ah,av]
return (rw,rh,rah,rav)
foreign import ccall "static Imlib2.h imlib_get_text_size" imlibGetTextSize :: CString -> Ptr Int -> Ptr Int -> IO ()
getTextSize :: String -> IO (Int, Int)
getTextSize str = do
[w,h] <- nmalloc 4
withCString str (\s -> imlibGetTextSize s w h)
[rw,rh] <- mapM peek [w,h]
mapM free [w,h]
return (rw,rh)
foreign import ccall "static Imlib2.h imlib_get_text_advance" imlibGetTextAdvance :: CString -> Ptr Int -> Ptr Int -> IO ()
getTextAdvance :: String -> IO (Int, Int)
getTextAdvance str = do
[h,v] <- nmalloc 4
withCString str (\s -> imlibGetTextAdvance s h v)
[rh,rv] <- mapM peek [h,v]
mapM free [h,v]
return (rh,rv)
foreign import ccall "static Imlib2.h imlib_get_text_inset" imlibGetTextInset :: CString -> IO Int
getTextInset :: String -> IO Int
getTextInset str = withCString str imlibGetTextInset
foreign import ccall "static Imlib2.h imlib_add_path_to_font_path" imlibAddPathToFontPath :: CString -> IO ()
addPathToFontPath :: String -> IO ()
addPathToFontPath str = withCString str imlibAddPathToFontPath
foreign import ccall "static Imlib2.h imlib_remove_path_from_font_path" imlibRemovePathFromFontPath :: CString -> IO ()
removePathFromFontPath :: String -> IO ()
removePathFromFontPath str = withCString str imlibRemovePathFromFontPath
foreign import ccall "static Imlib2.h imlib_list_font_path" imlibListFontPath :: Ptr Int -> IO (Ptr CString)
listFontPath :: IO [String]
listFontPath = do
pn <- malloc
pxs <- imlibListFontPath pn
n <- peek pn
free pn
xs <- peekArray n pxs
ys <- mapM peekCString xs
return ys
foreign import ccall "static Imlib2.h imlib_text_get_index_and_location" imlibTextGetIndexAndLocation :: CString -> Int -> Int -> Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO Int
textGetIndexAndLocation str x y = do
[xp,yp,wp,hp] <- nmalloc 4
n <- withCString str (\s -> imlibTextGetIndexAndLocation s x y xp yp wp hp)
[xr,yr,wr,hr] <- mapM peek [xp,yp,wp,hp]
mapM free [xp,yp,wp,hp]
return (n,xr,yr,wr,hr)
foreign import ccall "static Imlib2.h imlib_text_get_location_at_index" imlibTextGetLocationAtIndex :: CString -> Int -> Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()
textGetLocationAtIndex str k = do
[xp,yp,wp,hp] <- nmalloc 4
withCString str (\s -> imlibTextGetLocationAtIndex s k xp yp wp hp)
[xr,yr,wr,hr] <- mapM peek [xp,yp,wp,hp]
mapM free [xp,yp,wp,hp]
return (xr,yr,wr,hr)
foreign import ccall "static Imlib2.h imlib_list_fonts" imlibListFonts :: Ptr Int -> IO (Ptr CString)
foreign import ccall "static Imlib2.h imlib_free_font_list" imlibFreeFontList :: Ptr (CString) -> Int -> IO ()
listFonts :: IO [String]
listFonts = do
pn <- malloc
pxs <- imlibListFonts pn
n <- peek pn
free pn
xs <- peekArray n pxs
ys <- mapM peekCString xs
imlibFreeFontList pxs n
return ys
foreign import ccall "static Imlib2.h imlib_get_font_cache_size" imlibGetFontCacheSize :: IO Int
getFontCacheSize :: IO Int
getFontCacheSize = imlibGetFontCacheSize
foreign import ccall "static Imlib2.h imlib_set_font_cache_size" imlibSetFontCacheSize :: Int -> IO ()
setFontCacheSize :: Int -> IO ()
setFontCacheSize = imlibSetFontCacheSize
foreign import ccall "static Imlib2.h imlib_flush_font_cache" imlibFlushFontCache :: IO ()
flushFontCache :: IO ()
flushFontCache = imlibFlushFontCache
foreign import ccall "static Imlib2.h imlib_get_font_ascent" imlibGetFontAscent :: IO Int
getFontAscent :: IO Int
getFontAscent = imlibGetFontAscent
foreign import ccall "static Imlib2.h imlib_get_font_descent" imlibGetFontDescent :: IO Int
getFontDescent :: IO Int
getFontDescent = imlibGetFontDescent
foreign import ccall "static Imlib2.h imlib_get_maximum_font_ascent" imlibGetMaximumFontAscent :: IO Int
getMaximumFontAscent :: IO Int
getMaximumFontAscent = imlibGetMaximumFontAscent
foreign import ccall "static Imlib2.h imlib_get_maximum_font_descent" imlibGetMaximumFontDescent :: IO Int
getMaximumFontDescent :: IO Int
getMaximumFontDescent = imlibGetMaximumFontDescent
foreign import ccall "static Imlib2.h imlib_create_color_modifier" imlibCreateColorModifier :: IO ImlibColorModifier
createColorModifier :: IO ImlibColorModifier
createColorModifier = imlibCreateColorModifier
foreign import ccall "static Imlib2.h imlib_free_color_modifier" imlibFreeColorModifier :: IO ()
freeColorModifier :: IO ()
freeColorModifier = imlibFreeColorModifier
foreign import ccall "static Imlib2.h imlib_modify_color_modifier_gamma" imlibModifyColorModifierGamma :: Double -> IO ()
modifyColorModifierGamma :: Double -> IO ()
modifyColorModifierGamma = imlibModifyColorModifierGamma
foreign import ccall "static Imlib2.h imlib_modify_color_modifier_brightness" imlibModifyColorModifierBrightness :: Double -> IO ()
modifyColorModifierBrightness :: Double -> IO ()
modifyColorModifierBrightness = imlibModifyColorModifierBrightness
foreign import ccall "static Imlib2.h imlib_modify_color_modifier_contrast" imlibModifyColorModifierContrast :: Double -> IO ()
modifyColorModifierContrast :: Double -> IO ()
modifyColorModifierContrast = imlibModifyColorModifierContrast
foreign import ccall "static Imlib2.h imlib_set_color_modifier_tables" imlibSetColorModifierTables :: (Ptr Word8) -> (Ptr Word8) -> (Ptr Word8) -> (Ptr Word8) -> IO ()
setColorModifierTables r g b a = do
withArray rs (\ra ->
withArray gs (\ga ->
withArray bs (\ba ->
withArray as (\aa -> imlibSetColorModifierTables ra ga ba aa))))
where
padLeft n b xs | l > n = take n xs
| l < n = (replicate (nl) b) ++ xs
| otherwise = xs
where l = length xs
rs = padLeft 256 0 r
gs = padLeft 256 0 g
bs = padLeft 256 0 b
as = padLeft 256 0 a
foreign import ccall "static Imlib2.h imlib_get_color_modifier_tables" imlibGetColorModifierTables :: (Ptr Word8) -> (Ptr Word8) -> (Ptr Word8) -> (Ptr Word8) -> IO ()
getColorModifierTables = do
[ra,ga,ba,aa] <- nmallocArray 4 256
imlibGetColorModifierTables ra ga ba aa
[rs,gs,bs,as] <- mapM (peekArray 256) [ra,ga,ba,aa]
mapM free [ra,ga,ba,aa]
return (rs,gs,bs,as)
foreign import ccall "static Imlib2.h imlib_reset_color_modifier" imlibResetColorModifier :: IO ()
resetColorModifier :: IO ()
resetColorModifier = imlibResetColorModifier
foreign import ccall "static Imlib2.h imlib_apply_color_modifier" imlibApplyColorModifier :: IO ()
applyColorModifier :: IO ()
applyColorModifier = imlibApplyColorModifier
foreign import ccall "static Imlib2.h imlib_apply_color_modifier_to_rectangle" imlibApplyColorModifierToRectangle :: Int -> Int -> Int -> Int -> IO ()
applyColorModifierToRectangle = imlibApplyColorModifierToRectangle
foreign import ccall "static Imlib2.h imlib_image_draw_line" imlibImageDrawLine :: Int -> Int -> Int -> Int -> Bool -> IO ImlibUpdates
imageDrawLine = imlibImageDrawLine
foreign import ccall "static Imlib2.h imlib_image_draw_rectangle" imlibImageDrawRectangle :: Int -> Int -> Int -> Int -> IO ()
imageDrawRectangle = imlibImageDrawRectangle
foreign import ccall "static Imlib2.h imlib_image_fill_rectangle" imlibImageFillRectangle :: Int -> Int -> Int -> Int -> IO ()
imageFillRectangle = imlibImageFillRectangle
foreign import ccall "static Imlib2.h imlib_image_copy_alpha_to_image" imlibImageCopyAlphaToImage :: ImlibImage -> Int -> Int -> IO ()
imageCopyAlphaToImage = imlibImageCopyAlphaToImage
foreign import ccall "static Imlib2.h imlib_image_copy_alpha_rectangle_to_image" imlibImageCopyAlphaRectangleToImage :: ImlibImage -> Int -> Int -> Int -> Int -> Int -> Int -> IO ()
imageCopyAlphaRectangleToImage = imlibImageCopyAlphaRectangleToImage
foreign import ccall "static Imlib2.h imlib_image_scroll_rect" imlibImageScrollRect :: Int -> Int -> Int -> Int -> Int -> Int -> IO ()
imageScrollRect = imlibImageScrollRect
foreign import ccall "static Imlib2.h imlib_image_copy_rect" imlibImageCopyRect :: Int -> Int -> Int -> Int -> Int -> Int -> IO ()
imageCopyRect = imlibImageCopyRect
foreign import ccall "static Imlib2.h imlib_create_color_range" imlibCreateColorRange :: IO ImlibColorRange
createColorRange :: IO ImlibColorRange
createColorRange = imlibCreateColorRange
foreign import ccall "static Imlib2.h imlib_free_color_range" imlibFreeColorRange :: IO ()
freeColorRange :: IO ()
freeColorRange = imlibFreeColorRange
foreign import ccall "static Imlib2.h imlib_add_color_to_color_range" imlibAddColorToColorRange :: Int -> IO ()
addColorToColorRange :: Int -> IO ()
addColorToColorRange = imlibAddColorToColorRange
foreign import ccall "static Imlib2.h imlib_image_fill_color_range_rectangle" imlibImageFillColorRangeRectangle :: Int -> Int -> Int -> Int -> Double -> IO ()
imageFillColorRangeRectangle = imlibImageFillColorRangeRectangle
foreign import ccall "static Imlib2.h imlib_image_fill_hsva_color_range_rectangle" imlibImageFillHsvaColorRangeRectangle :: Int -> Int -> Int -> Int -> Double -> IO ()
imageFillHsvaColorRangeRectangle = imlibImageFillHsvaColorRangeRectangle
foreign import ccall "static Imlib2.h imlib_image_query_pixel" imlibImageQueryPixel :: Int -> Int -> Ptr ImlibColor -> IO ()
imageQueryPixel :: Int -> Int -> IO ImlibColor
imageQueryPixel x y = do
c <- malloc
imlibImageQueryPixel x y c
r <- peek c
free c
return r
foreign import ccall "static Imlib2.h imlib_image_query_pixel_cmya" imlibImageQueryPixelCmya :: Int -> Int -> Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()
imageQueryPixelCmya :: Int -> Int -> IO (Int, Int, Int, Int)
imageQueryPixelCmya cx cy = do
[c,m,y,a] <- nmalloc 4
imlibImageQueryPixelCmya cx cy c m y a
[cc,mm,yy,aa] <- mapM peek [c,m,y,a]
mapM free [c,m,y,a]
return (cc,mm,yy,aa)
foreign import ccall "static Imlib2.h imlib_image_query_pixel_hsva" imlibImageQueryPixelHsva :: Int -> Int -> Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()
imageQueryPixelHsva :: Int -> Int -> IO (Int, Int, Int, Int)
imageQueryPixelHsva cx cy = do
[h,s,v,a] <- nmalloc 4
imlibImageQueryPixelHsva cx cy h s v a
[hh,ss,vv,aa] <- mapM peek [h,s,v,a]
mapM free [h,s,v,a]
return (hh,ss,vv,aa)
foreign import ccall "static Imlib2.h imlib_image_query_pixel_hlsa" imlibImageQueryPixelHlsa :: Int -> Int -> Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()
imageQueryPixelHlsa :: Int -> Int -> IO (Int, Int, Int, Int)
imageQueryPixelHlsa cx cy = do
[h,l,s,a] <- nmalloc 4
imlibImageQueryPixelHlsa cx cy h l s a
[hh,ll,ss,aa] <- mapM peek [h,l,s,a]
mapM free [h,l,s,a]
return (hh,ll,ss,aa)
foreign import ccall "static Imlib2.h imlib_image_attach_data_value" imlibImageAttachDataValue :: CString -> Ptr () -> Int -> FunPtr ImlibDataDestructorFunction -> IO ()
imageAttachDataValue key d v dest = do
df <- mkDestructorFunction dest
withCString key (\k -> imlibImageAttachDataValue k d v df)
foreign import ccall "static Imlib2.h imlib_image_get_attached_data" imlibImageGetAttachedData :: CString -> IO (Ptr ())
imageGetAttachedData :: String -> IO (Ptr ())
imageGetAttachedData key = withCString key imlibImageGetAttachedData
foreign import ccall "static Imlib2.h imlib_image_get_attached_value" imlibImageGetAttachedValue :: CString -> IO Int
imageGetAttachedValue :: String -> IO Int
imageGetAttachedValue key = withCString key imlibImageGetAttachedValue
foreign import ccall "static Imlib2.h imlib_image_remove_attached_data_value" imlibImageRemoveAttachedDataValue :: CString -> IO ()
imageRemoveAttachedDataValue :: String -> IO ()
imageRemoveAttachedDataValue key = withCString key imlibImageRemoveAttachedDataValue
foreign import ccall "static Imlib2.h imlib_image_remove_and_free_attached_data_value" imlibImageRemoveAndFreeAttachedDataValue :: CString -> IO ()
imageRemoveAndFreeAttachedDataValue key = withCString key imlibImageRemoveAndFreeAttachedDataValue
foreign import ccall "static Imlib2.h imlib_save_image" imlibSaveImage :: CString -> IO ()
saveImage :: String -> IO ()
saveImage str = withCString str imlibSaveImage
foreign import ccall "static Imlib2.h imlib_save_image_with_error_return" imlibSaveImageWithErrorReturn :: CString -> Ptr Int -> IO ()
saveImageWithErrorReturn :: String -> IO ImlibLoadError
saveImageWithErrorReturn str = do
pe <- malloc
im <- withCString str (\s -> imlibSaveImageWithErrorReturn s pe)
e <- peek pe
free pe
return (toEnum e)
foreign import ccall "static Imlib2.h imlib_create_rotated_image" imlibCreateRotatedImage :: Double -> IO ImlibImage
createRotatedImage :: Double -> IO ImlibImage
createRotatedImage = imlibCreateRotatedImage
foreign import ccall "static Imlib2.h imlib_blend_image_onto_image_at_angle" imlibBlendImageOntoImageAtAngle :: Ptr(ImlibImage)
-> Bool
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> IO ()
blendImageOntoImageAtAngle = imlibBlendImageOntoImageAtAngle
foreign import ccall "static Imlib2.h imlib_blend_image_onto_image_skewed" imlibBlendImageOntoImageSkewed :: Ptr(ImlibImage)
-> Bool
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> IO ()
blendImageOntoImageSkewed = imlibBlendImageOntoImageSkewed
foreign import ccall "static Imlib2.h imlib_context_set_cliprect" imlibContextSetCliprect :: Int -> Int -> Int -> Int -> IO ()
contextSetCliprect = imlibContextSetCliprect
foreign import ccall "static Imlib2.h imlib_polygon_new" imlibPolygonNew :: IO ()
polygonNew :: IO ()
polygonNew = imlibPolygonNew
foreign import ccall "static Imlib2.h imlib_polygon_free" imlibPolygonFree :: ImlibPolygon -> IO ()
polygonFree :: ImlibPolygon -> IO ()
polygonFree = imlibPolygonFree
foreign import ccall "static Imlib2.h imlib_polygon_add_point" imlibPolygonAddPoint :: ImlibPolygon -> Int -> Int -> IO ()
polygonAddPoint = imlibPolygonAddPoint
foreign import ccall "static Imlib2.h imlib_image_draw_polygon" imlibImageDrawPolygon :: ImlibPolygon -> Bool -> IO ()
imageDrawPolygon :: ImlibPolygon -> Bool -> IO ()
imageDrawPolygon = imlibImageDrawPolygon
foreign import ccall "static Imlib2.h imlib_image_fill_polygon" imlibImageFillPolygon :: ImlibPolygon -> IO ()
imageFillPolygon :: ImlibPolygon -> IO ()
imageFillPolygon = imlibImageFillPolygon
foreign import ccall "static Imlib2.h imlib_polygon_get_bounds" imlibPolygonGetBounds :: ImlibPolygon -> Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()
polygonGetBounds poly = do
[x1,y1,x2,y2] <- nmalloc 4
imlibPolygonGetBounds poly x1 y1 x2 y2
[rx1,ry1,rx2,ry2] <- mapM peek [x1,y1,x2,y2]
mapM free [x1,y1,x2,y2]
return (rx1,ry1,rx2,ry2)
foreign import ccall "static Imlib2.h imlib_polygon_contains_point" imlibPolygonContainsPoint :: ImlibPolygon -> Int -> Int -> IO Bool
polygonContainsPoint = imlibPolygonContainsPoint
foreign import ccall "static Imlib2.h imlib_image_draw_ellipse" imlibImageDrawEllipse :: Int -> Int -> Int -> Int -> IO ()
imageDrawEllipse = imlibImageDrawEllipse
foreign import ccall "static Imlib2.h imlib_image_fill_ellipse" imlibImageFillEllipse :: Int -> Int -> Int -> Int -> IO ()
imageFillEllipse = imlibImageFillEllipse
foreign import ccall "static Imlib2.h imlib_image_filter" imlibImageFilter :: IO ()
imageFilter :: IO ()
imageFilter = imlibImageFilter
foreign import ccall "static Imlib2.h imlib_create_filter" imlibCreateFilter :: Int -> IO ImlibFilter
createFilter :: Int -> IO ImlibFilter
createFilter = imlibCreateFilter
foreign import ccall "static Imlib2.h imlib_free_filter" imlibFreeFilter :: IO ()
freeFilter :: IO ()
freeFilter = imlibFreeFilter
foreign import ccall "static Imlib2.h imlib_filter_set" imlibFilterSet :: Int -> Int -> Int -> Int -> Int -> Int -> IO ()
filterSet = imlibFilterSet
foreign import ccall "static Imlib2.h imlib_filter_set_alpha" imlibFilterSetAlpha :: Int -> Int -> Int -> Int -> Int -> Int -> IO ()
filterSetAlpha = imlibFilterSetAlpha
foreign import ccall "static Imlib2.h imlib_filter_set_red" imlibFilterSetRed :: Int -> Int -> Int -> Int -> Int -> Int -> IO ()
filterSetRed = imlibFilterSetRed
foreign import ccall "static Imlib2.h imlib_filter_set_green" imlibFilterSetGreen :: Int -> Int -> Int -> Int -> Int -> Int -> IO ()
filterSetGreen = imlibFilterSetGreen
foreign import ccall "static Imlib2.h imlib_filter_set_blue" imlibFilterSetBlue :: Int -> Int -> Int -> Int -> Int -> Int -> IO ()
filterSetBlue = imlibFilterSetBlue
foreign import ccall "static Imlib2.h imlib_filter_constants" imlibFilterConstants :: Int -> Int -> Int -> Int -> IO ()
filterConstants :: Int -> Int -> Int -> Int -> IO ()
filterConstants = imlibFilterConstants
foreign import ccall "static Imlib2.h imlib_filter_divisors" imlibFilterDivisors :: Int -> Int -> Int -> Int -> IO ()
filterDivisors :: Int -> Int -> Int -> Int -> IO ()
filterDivisors = imlibFilterDivisors