Imlib 0.1 → 0.1.1
raw patch · 2 files changed
+195/−87 lines, 2 filesdep +X11dep +array
Dependencies added: X11, array
Files
- Graphics/Imlib.hs +190/−84
- Imlib.cabal +5/−3
Graphics/Imlib.hs view
@@ -1,8 +1,8 @@ {-# OPTIONS -fffi -fglasgow-exts #-} -{- +{- * Haskell Binding for Imlib 2-* Copyright (c) 2004-2007, Cale Gibbard+* Copyright (c) 2004-2008, Cale Gibbard * All rights reserved. * * Redistribution and use in source and binary forms, with or without@@ -57,9 +57,9 @@ {- -- List of what is not imported -- -- This list contains anything that interfaces with X (i.e. uses Display/Visual/Drawable/Colormap/Pixmap)- + -- Apart from that, the only thing that is in this list is imlib_apply_filter (which is rather unfortunate,- -- since it's a cool feature). It uses va_args, so perhaps some Template Haskell is in order.+ -- since it's a cool feature). It uses va_args. int imlib_get_visual_depth(Display *display, Visual *visual); Visual *imlib_get_best_visual(Display *display, int screen, int *depth_return);@@ -96,46 +96,46 @@ -} module Graphics.Imlib (- ImlibProgressFunction, ImlibDataDestructorFunction, + ImlibProgressFunction, ImlibDataDestructorFunction, ImlibTTFEncoding (..), ImlibLoadError (..), ImlibTextDirection (..),- ImlibOperation (..), ImlibColor (..), ImlibBorder (..), ImlibPolygon, - ImlibFilter, ImlibColorRange, ImlibFont, ImlibUpdates, + ImlibOperation (..), ImlibColor (..), ImlibBorder (..), ImlibPolygon,+ ImlibFilter, ImlibColorRange, ImlibFont, ImlibUpdates, ImlibColorModifier, ImlibImage, ImlibContext,- contextSetDitherMask, contextSetAntiAlias, contextSetDither, + 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, + 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, + contextGetProgressGranularity, contextGetImage, contextGetFilter,+ getCacheSize, setCacheSize, getColorUsage, setColorUsage, flushLoaders, loadImage, loadImageImmediately, loadImageWithoutCache, loadImageImmediatelyWithoutCache, loadImageWithErrorReturn, freeImage,- freeImageAndDecache, imageGetWidth, imageGetHeight, imageGetFilename, - imageGetData, imageGetDataForReadingOnly, imagePutBackData, + freeImageAndDecache, imageGetWidth, imageGetHeight, imageGetFilename,+ imageGetData, imageGetDataForReadingOnly, imagePutBackData, imageWithData, imageHasAlpha, imageSetChangesOnDisk, imageGetBorder,- imageSetBorder, imageSetFormat, imageSetIrrelevantFormat, - imageSetIrrelevantBorder, imageSetIrrelevantAlpha, imageFormat, - imageSetHasAlpha, blendImageOntoImage, createImage, + imageSetBorder, imageSetFormat, imageSetIrrelevantFormat,+ imageSetIrrelevantBorder, imageSetIrrelevantAlpha, imageFormat,+ imageSetHasAlpha, blendImageOntoImage, createImage, createImageUsingData, createImageUsingCopiedData, cloneImage,- createCroppedImage, createCroppedScaledImage, updatesClone, + createCroppedImage, createCroppedScaledImage, updatesClone, updateAppendRect, updatesMerge, updatesMergeForRendering,- updatesFree, updatesGetNext, updatesGetCoordinates, - updatesSetCoordinates, updatesInit, updatesAppendUpdates, - imageFlipHorizontal, imageFlipVertical, imageFlipDiagonal, - imageOrientate, imageBlur, imageSharpen, imageTileHorizontal, - imageTileVertical, imageTile, loadFont, freeFont, textDraw, + 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, + addPathToFontPath, removePathFromFontPath, listFontPath, textGetIndexAndLocation, textGetLocationAtIndex, listFonts,- getFontCacheSize, setFontCacheSize, flushFontCache, getFontAscent, + getFontCacheSize, setFontCacheSize, flushFontCache, getFontAscent, getFontDescent, getMaximumFontAscent, getMaximumFontDescent,- createColorModifier, freeColorModifier, modifyColorModifierGamma, + createColorModifier, freeColorModifier, modifyColorModifierGamma, modifyColorModifierBrightness, modifyColorModifierContrast, setColorModifierTables, getColorModifierTables, resetColorModifier, applyColorModifier, applyColorModifierToRectangle, imageDrawLine, @@ -149,7 +149,7 @@ imageRemoveAndFreeAttachedDataValue, saveImage, saveImageWithErrorReturn, createRotatedImage, blendImageOntoImageAtAngle, blendImageOntoImageSkewed, - contextSetCliprect, {-clipLine,-} polygonNew, polygonFree, + contextSetCliprect, polygonNew, polygonFree, polygonAddPoint, imageDrawPolygon, imageFillPolygon, polygonGetBounds, polygonContainsPoint, imageDrawEllipse, imageFillEllipse, imageFilter, createFilter, freeFilter, filterSet, filterSetAlpha, filterSetRed, @@ -164,6 +164,8 @@ import Data.Array import Control.Monad +import Graphics.X11.Types+ {- Types from the Imlib 2 header typedef void *ImlibContext; typedef void *ImlibImage;@@ -198,19 +200,18 @@ data ImlibBorder = ImlibBorder Int Int Int Int deriving (Show, Eq) -- left, right, top, bottom instance Storable ImlibBorder where- sizeOf x = 16 - alignment x = 4+ sizeOf _ = 16+ alignment _ = 4 peek p = do [a,b,c,d] <- peekArray 4 (castPtr p) return (ImlibBorder a b c d)- where- poke p (ImlibBorder a b c d) = do+ poke p (ImlibBorder a b c d) = pokeArray (castPtr p) [a,b,c,d] data ImlibColor = ImlibColor Word32 Word32 Word32 Word32 deriving (Show, Eq) -- alpha, red, green, blue instance Storable ImlibColor where- sizeOf x = 16- alignment x = 4+ sizeOf _ = 16+ alignment _ = 4 peek p = do [a,b,c,d] <- peekArray 4 (castPtr p) return (ImlibColor a b c d)@@ -223,14 +224,14 @@ | ImlibOpSubtract -- 2 | ImlibOpReshade -- 3 deriving (Enum, Show, Eq)- + data ImlibTextDirection = ImlibTextToRight -- 0 | ImlibTextToLeft -- 1 | ImlibTextToDown -- 2 | ImlibTextToUp -- 3 | ImlibTextToAngle -- 4 deriving (Enum, Show, Eq)- + data ImlibLoadError = ImlibLoadErrorNone -- 0 | ImlibLoadErrorFileDoesNotExist -- 1 | ImlibLoadErrorFileIsDirectory -- 2@@ -281,22 +282,27 @@ --void imlib_context_set_dither_mask(char dither_mask); foreign import ccall "static Imlib2.h imlib_context_set_dither_mask" imlibContextSetDitherMask :: Bool -> IO ()+contextSetDitherMask :: Bool -> IO () contextSetDitherMask = imlibContextSetDitherMask --void imlib_context_set_anti_alias(char anti_alias); foreign import ccall "static Imlib2.h imlib_context_set_anti_alias" imlibContextSetAntiAlias :: Bool -> IO ()+contextSetAntiAlias :: Bool -> IO () contextSetAntiAlias = imlibContextSetAntiAlias --void imlib_context_set_dither(char dither); foreign import ccall "static Imlib2.h imlib_context_set_dither" imlibContextSetDither :: Bool -> IO ()+contextSetDither :: Bool -> IO () contextSetDither = imlibContextSetDither --void imlib_context_set_blend(char blend); foreign import ccall "static Imlib2.h imlib_context_set_blend" imlibContextSetBlend :: Bool -> IO ()+contextSetBlend :: Bool -> IO () contextSetBlend = imlibContextSetBlend --void imlib_context_set_color_modifier(Imlib_Color_Modifier color_modifier); foreign import ccall "static Imlib2.h imlib_context_set_color_modifier" imlibContextSetColorModifier :: ImlibColorModifier -> IO ()+contextSetColorModifier :: ImlibColorModifier -> IO () contextSetColorModifier = imlibContextSetColorModifier --void imlib_context_set_operation(Imlib_Operation operation);@@ -306,6 +312,7 @@ --void imlib_context_set_font(Imlib_Font font); foreign import ccall "static Imlib2.h imlib_context_set_font" imlibContextSetFont :: ImlibFont -> IO ()+contextSetFont :: ImlibFont -> IO () contextSetFont = imlibContextSetFont --void imlib_context_set_direction(Imlib_Text_Direction direction);@@ -315,14 +322,17 @@ --void imlib_context_set_angle(double angle); foreign import ccall "static Imlib2.h imlib_context_set_angle" imlibContextSetAngle :: Double -> IO ()+contextSetAngle :: Double -> IO () contextSetAngle = imlibContextSetAngle --void imlib_context_set_color(int red, int green, int blue, int alpha); foreign import ccall "static Imlib2.h imlib_context_set_color" imlibContextSetColor :: Int -> Int -> Int -> Int -> IO ()+contextSetColor :: Int -> Int -> Int -> Int -> IO () contextSetColor = imlibContextSetColor --void imlib_context_set_color_cmya(int cyan, magenta, int yellow, int alpha); 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 --void imlib_context_set_color_hsva(float hue, float saturation, float value, int alpha);@@ -335,6 +345,7 @@ --void imlib_context_set_color_range(Imlib_Color_Range color_range); foreign import ccall "static Imlib2.h imlib_context_set_color_range" imlibContextSetColorRange :: ImlibColorRange -> IO ()+contextSetColorRange :: ImlibColorRange -> IO () contextSetColorRange = imlibContextSetColorRange --void imlib_context_set_progress_function(Imlib_Progress_Function progress_function);@@ -345,53 +356,63 @@ --void imlib_context_set_progress_granularity(char progress_granularity); foreign import ccall "static Imlib2.h imlib_context_set_progress_granularity" imlibContextSetProgressGranularity :: Word8 -> IO ()+contextSetProgressGranularity :: Word8 -> IO () contextSetProgressGranularity = imlibContextSetProgressGranularity --void imlib_context_set_filter(Imlib_Filter filter); foreign import ccall "static Imlib2.h imlib_context_set_filter" imlibContextSetFilter :: ImlibFilter -> IO ()+contextSetFilter :: ImlibFilter -> IO () contextSetFilter = imlibContextSetFilter -- void imlib_context_set_image(Imlib_Image image); foreign import ccall "static Imlib2.h imlib_context_set_image" imlibContextSetImage :: ImlibImage -> IO ()+contextSetImage :: ImlibImage -> IO () contextSetImage = imlibContextSetImage -- char imlib_context_get_dither_mask(void);-foreign import ccall "static Imlib2.h imlib_context_get_dither_mask" imlibContextGetDitherMask :: IO Bool +foreign import ccall "static Imlib2.h imlib_context_get_dither_mask" imlibContextGetDitherMask :: IO Bool+contextGetDitherMask :: IO Bool contextGetDitherMask = imlibContextGetDitherMask -- char imlib_context_get_anti_alias(void);-foreign import ccall "static Imlib2.h imlib_context_get_anti_alias" imlibContextGetAntiAlias :: IO Bool +foreign import ccall "static Imlib2.h imlib_context_get_anti_alias" imlibContextGetAntiAlias :: IO Bool+contextGetAntiAlias :: IO Bool contextGetAntiAlias = imlibContextGetAntiAlias -- char imlib_context_get_dither(void);-foreign import ccall "static Imlib2.h imlib_context_get_dither" imlibContextGetDither :: IO Bool +foreign import ccall "static Imlib2.h imlib_context_get_dither" imlibContextGetDither :: IO Bool+contextGetDither :: IO Bool contextGetDither = imlibContextGetDither -- char imlib_context_get_blend(void);-foreign import ccall "static Imlib2.h imlib_context_get_blend" imlibContextGetBlend :: IO Bool +foreign import ccall "static Imlib2.h imlib_context_get_blend" imlibContextGetBlend :: IO Bool+contextGetBlend :: IO Bool contextGetBlend = imlibContextGetBlend -- Imlib_Color_Modifier imlib_context_get_color_modifier(void); foreign import ccall "static Imlib2.h imlib_context_get_color_modifier" imlibContextGetColorModifier :: IO ImlibColorModifier+contextGetColorModifier :: IO ImlibColorModifier contextGetColorModifier = imlibContextGetColorModifier -- Imlib_Operation imlib_context_get_operation(void);-foreign import ccall "static Imlib2.h imlib_context_get_operation" imlibContextGetOperation :: IO Int -contextGetOperation :: IO ImlibOperation +foreign import ccall "static Imlib2.h imlib_context_get_operation" imlibContextGetOperation :: IO Int+contextGetOperation :: IO ImlibOperation contextGetOperation = do i <- imlibContextGetOperation return (toEnum i) -- Imlib_Font imlib_context_get_font(void); foreign import ccall "static Imlib2.h imlib_context_get_font" imlibContextGetFont :: IO ImlibFont+contextGetFont :: IO ImlibFont contextGetFont = imlibContextGetFont -- double imlib_context_get_angle(void);-foreign import ccall "static Imlib2.h imlib_context_get_angle" imlibContextGetAngle :: IO Double +foreign import ccall "static Imlib2.h imlib_context_get_angle" imlibContextGetAngle :: IO Double+contextGetAngle :: IO Double contextGetAngle = imlibContextGetAngle -- Imlib_Text_Direction imlib_context_get_direction(void);-foreign import ccall "static Imlib2.h imlib_context_get_direction" imlibContextGetDirection :: IO Int +foreign import ccall "static Imlib2.h imlib_context_get_direction" imlibContextGetDirection :: IO Int contextGetDirection :: IO ImlibTextDirection contextGetDirection = do d <- imlibContextGetDirection@@ -405,7 +426,7 @@ 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) + return (rr,gg,bb,aa) -- void imlib_context_get_color_cmya(int *cyan, int *magenta, int *yellow, int *alpha); foreign import ccall "static Imlib2.h imlib_context_get_color_cmya" imlibContextGetColorCmya :: Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()@@ -415,7 +436,7 @@ 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) + return (cc,mm,yy,aa) -- void imlib_context_get_color_hsva(float *hue, float *saturation, float *value, int *alpha); foreign import ccall "static Imlib2.h imlib_context_get_color_hsva" imlibContextGetColorHsva :: Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()@@ -425,7 +446,7 @@ 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) + return (hh,ss,vv,aa) -- void imlib_context_get_color_hlsa(float *hue, float * lightness, float *saturation, int *alpha); foreign import ccall "static Imlib2.h imlib_context_get_color_hlsa" imlibContextGetColorHlsa :: Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()@@ -435,7 +456,7 @@ 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) + return (hh,ll,ss,aa) -- Imlib_Color *imlib_context_get_imlib_color(void); foreign import ccall "static Imlib2.h imlib_context_get_imlib_color" imlibContextGetImlibColor :: IO (Ptr ImlibColor)@@ -448,54 +469,66 @@ -- Imlib_Color_Range imlib_context_get_color_range(void); foreign import ccall "static Imlib2.h imlib_context_get_color_range" imlibContextGetColorRange :: IO ImlibColorRange+contextGetColorRange :: IO ImlibColorRange contextGetColorRange = imlibContextGetColorRange -- Imlib_Progress_Function imlib_context_get_progress_function(void); foreign import ccall "static Imlib2.h imlib_context_get_progress_function" imlibContextGetProgressFunction :: IO (FunPtr ImlibProgressFunction)-contextGetProgressFunction = imlibContextGetProgressFunction - +contextGetProgressFunction = imlibContextGetProgressFunction+ -- char imlib_context_get_progress_granularity(void);-foreign import ccall "static Imlib2.h imlib_context_get_progress_granularity" imlibContextGetProgressGranularity :: IO Word8 +foreign import ccall "static Imlib2.h imlib_context_get_progress_granularity" imlibContextGetProgressGranularity :: IO Word8+contextGetProgressGranularity :: IO Word8 contextGetProgressGranularity = imlibContextGetProgressGranularity -- Imlib_Image imlib_context_get_image(void); foreign import ccall "static Imlib2.h imlib_context_get_image" imlibContextGetImage :: IO ImlibImage+contextGetImage :: IO ImlibImage contextGetImage = imlibContextGetImage -- Imlib_Filter imlib_context_get_filter(void); foreign import ccall "static Imlib2.h imlib_context_get_filter" imlibContextGetFilter :: IO ImlibFilter+contextGetFilter :: IO ImlibFilter contextGetFilter = imlibContextGetFilter -- int imlib_get_cache_size(void); foreign import ccall "static Imlib2.h imlib_get_cache_size" imlibGetCacheSize :: IO Int+getCacheSize :: IO Int getCacheSize = imlibGetCacheSize -- void imlib_set_cache_size(int bytes); foreign import ccall "static Imlib2.h imlib_set_cache_size" imlibSetCacheSize :: Int -> IO ()+setCacheSize :: Int -> IO () setCacheSize = imlibSetCacheSize -- int imlib_get_color_usage(void); foreign import ccall "static Imlib2.h imlib_get_color_usage" imlibGetColorUsage :: IO Int+getColorUsage :: IO Int getColorUsage = imlibGetColorUsage -- void imlib_set_color_usage(int max); foreign import ccall "static Imlib2.h imlib_set_color_usage" imlibSetColorUsage :: Int -> IO ()+setColorUsage :: Int -> IO () setColorUsage = imlibSetColorUsage -- void imlib_flush_loaders(void); foreign import ccall "static Imlib2.h imlib_flush_loaders" imlibFlushLoaders :: IO ()+flushLoaders :: IO () flushLoaders = imlibFlushLoaders -- Imlib_Image imlib_load_image(const char *file); foreign import ccall "static Imlib2.h imlib_load_image" imlibLoadImage :: CString -> IO ImlibImage+loadImage :: String -> IO ImlibImage loadImage str = withCString str imlibLoadImage --Imlib_Image imlib_load_image_immediately(const char *file); foreign import ccall "static Imlib2.h imlib_load_image_immediately" imlibLoadImageImmediately :: CString -> IO ImlibImage+loadImageImmediately :: String -> IO ImlibImage loadImageImmediately str = withCString str imlibLoadImageImmediately --Imlib_Image imlib_load_image_without_cache(const char *file); foreign import ccall "static Imlib2.h imlib_load_image_without_cache" imlibLoadImageWithoutCache :: CString -> IO ImlibImage+loadImageWithoutCache :: String -> IO ImlibImage loadImageWithoutCache str = withCString str imlibLoadImageWithoutCache --Imlib_Image imlib_load_image_immediately_without_cache(const char *file);@@ -514,36 +547,44 @@ --void imlib_free_image(void); foreign import ccall "static Imlib2.h imlib_free_image" imlibFreeImage :: IO ()+freeImage :: IO () freeImage = imlibFreeImage --void imlib_free_image_and_decache(void); foreign import ccall "static Imlib2.h imlib_free_image_and_decache" imlibFreeImageAndDecache :: IO ()+freeImageAndDecache :: IO () freeImageAndDecache = imlibFreeImageAndDecache --int imlib_image_get_width(void); foreign import ccall "static Imlib2.h imlib_image_get_width" imlibImageGetWidth :: IO Int+imageGetWidth :: IO Int imageGetWidth = imlibImageGetWidth --int imlib_image_get_height(void); foreign import ccall "static Imlib2.h imlib_image_get_height" imlibImageGetHeight :: IO Int+imageGetHeight :: IO Int imageGetHeight = imlibImageGetHeight --const char *imlib_image_get_filename(void); foreign import ccall "static Imlib2.h imlib_image_get_filename" imlibImageGetFilename :: IO CString+imageGetFilename :: IO String imageGetFilename = do b <- imlibImageGetFilename peekCString b --DATA32 *imlib_image_get_data(void); foreign import ccall "static Imlib2.h imlib_image_get_data" imlibImageGetData :: IO (Ptr Word32)+imageGetData :: IO (Ptr Word32) imageGetData = imlibImageGetData --DATA32 *imlib_image_get_data_for_reading_only(void); foreign import ccall "static Imlib2.h imlib_image_get_data_for_reading_only" imlibImageGetDataForReadingOnly :: IO (Ptr Word32)+imageGetDataForReadingOnly :: IO (Ptr Word32) imageGetDataForReadingOnly = imlibImageGetDataForReadingOnly --void imlib_image_put_back_data(DATA32 *data); foreign import ccall "static Imlib2.h imlib_image_put_back_data" imlibImagePutBackData :: Ptr Word32 -> IO ()+imagePutBackData :: Ptr Word32 -> IO () imagePutBackData = imlibImagePutBackData -- Convenience "control structure" for working with getting and putting image data back, since you must always return the data that you get.@@ -580,10 +621,12 @@ --char imlib_image_has_alpha(void); foreign import ccall "static Imlib2.h imlib_image_has_alpha" imlibImageHasAlpha :: IO Bool+imageHasAlpha :: IO Bool imageHasAlpha = imlibImageHasAlpha --void imlib_image_set_changes_on_disk(void); foreign import ccall "static Imlib2.h imlib_image_set_changes_on_disk" imlibImageSetChangesOnDisk :: IO ()+imageSetChangesOnDisk :: IO () imageSetChangesOnDisk = imlibImageSetChangesOnDisk --void imlib_image_get_border(Imlib_Border *border);@@ -595,7 +638,7 @@ bb <- peek b free b return bb- + --void imlib_image_set_border(Imlib_Border *border); foreign import ccall "static Imlib2.h imlib_image_set_border" imlibImageSetBorder :: Ptr ImlibBorder -> IO () imageSetBorder :: ImlibBorder -> IO ()@@ -607,18 +650,22 @@ --void imlib_image_set_format(const char *format); foreign import ccall "static Imlib2.h imlib_image_set_format" imlibImageSetFormat :: CString -> IO ()+imageSetFormat :: String -> IO () imageSetFormat str = withCString str imlibImageSetFormat --void imlib_image_set_irrelevant_format(char irrelevant); foreign import ccall "static Imlib2.h imlib_image_set_irrelevant_format" imlibImageSetIrrelevantFormat :: Bool -> IO ()+imageSetIrrelevantFormat :: Bool -> IO () imageSetIrrelevantFormat = imlibImageSetIrrelevantFormat --void imlib_image_set_irrelevant_border(char irrelevant); foreign import ccall "static Imlib2.h imlib_image_set_irrelevant_border" imlibImageSetIrrelevantBorder :: Bool -> IO ()+imageSetIrrelevantBorder :: Bool -> IO () imageSetIrrelevantBorder = imlibImageSetIrrelevantBorder --void imlib_image_set_irrelevant_alpha(char irrelevant); foreign import ccall "static Imlib2.h imlib_image_set_irrelevant_alpha" imlibImageSetIrrelevantAlpha :: Bool -> IO ()+imageSetIrrelevantAlpha :: Bool -> IO () imageSetIrrelevantAlpha = imlibImageSetIrrelevantAlpha --char *imlib_image_format(void);@@ -628,11 +675,12 @@ --void imlib_image_set_has_alpha(char has_alpha); foreign import ccall "static Imlib2.h imlib_image_set_has_alpha" imlibImageSetHasAlpha :: Bool -> IO ()+imageSetHasAlpha :: Bool -> IO () imageSetHasAlpha = imlibImageSetHasAlpha --void imlib_blend_image_onto_image(Imlib_Image source_image, char merge_alpha, int source_x, int source_y, int source_width, int source_height, int destination_x, int destination_y, int destination_width, int destination_height);-foreign import ccall "static Imlib2.h imlib_blend_image_onto_image" imlibBlendImageOntoImage +foreign import ccall "static Imlib2.h imlib_blend_image_onto_image" imlibBlendImageOntoImage :: ImlibImage -> Bool -- merge alpha -> Int -- source x@@ -648,10 +696,12 @@ --Imlib_Image imlib_create_image(int width, int height); foreign import ccall "static Imlib2.h imlib_create_image" imlibCreateImage :: Int -> Int -> IO ImlibImage+createImage :: Int -> Int -> IO ImlibImage createImage = imlibCreateImage --Imlib_Image imlib_create_image_using_data(int width, int height, DATA32 *data); 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 --Imlib_Image imlib_create_image_using_copied_data(int width, int height, DATA32 *data);@@ -667,6 +717,7 @@ --Imlib_Image imlib_clone_image(void); foreign import ccall "static Imlib2.h imlib_clone_image" imlibCloneImage :: IO ImlibImage+cloneImage :: IO ImlibImage cloneImage = imlibCloneImage --Imlib_Image imlib_create_cropped_image(int x, int y, int width, int height);@@ -679,6 +730,7 @@ --Imlib_Updates imlib_updates_clone(Imlib_Updates updates); foreign import ccall "static Imlib2.h imlib_updates_clone" imlibUpdatesClone :: ImlibUpdates -> IO ImlibUpdates+updatesClone :: ImlibUpdates -> IO ImlibUpdates updatesClone = imlibUpdatesClone --Imlib_Updates imlib_update_append_rect(Imlib_Updates updates, int x, int y, int w, int h);@@ -695,10 +747,12 @@ --void imlib_updates_free(Imlib_Updates updates); foreign import ccall "static Imlib2.h imlib_updates_free" imlibUpdatesFree :: ImlibUpdates -> IO ()+updatesFree :: ImlibUpdates -> IO () updatesFree = imlibUpdatesFree --Imlib_Updates imlib_updates_get_next(Imlib_Updates updates); foreign import ccall "static Imlib2.h imlib_updates_get_next" imlibUpdatesGetNext :: ImlibUpdates -> IO ImlibUpdates+updatesGetNext :: ImlibUpdates -> IO ImlibUpdates updatesGetNext = imlibUpdatesGetNext --void imlib_updates_get_coordinates(Imlib_Updates updates, int *x_return, int *y_return, int *width_return, int *height_return);@@ -709,7 +763,7 @@ 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) + return (xx,yy,ww,hh) --void imlib_updates_set_coordinates(Imlib_Updates updates, int x, int y, int width, int height); foreign import ccall "static Imlib2.h imlib_updates_set_coordinates" imlibUpdatesSetCoordinates :: ImlibUpdates -> Int -> Int -> Int -> Int -> IO ()@@ -717,6 +771,7 @@ --Imlib_Updates imlib_updates_init(void); foreign import ccall "static Imlib2.h imlib_updates_init" imlibUpdatesInit :: IO ImlibUpdates+updatesInit :: IO ImlibUpdates updatesInit = imlibUpdatesInit --Imlib_Updates imlib_updates_append_updates(Imlib_Updates updates, Imlib_Updates appended_updates);@@ -725,51 +780,63 @@ --void imlib_image_flip_horizontal(void); foreign import ccall "static Imlib2.h imlib_image_flip_horizontal" imlibImageFlipHorizontal :: IO ()+imageFlipHorizontal :: IO () imageFlipHorizontal = imlibImageFlipHorizontal --void imlib_image_flip_vertical(void); foreign import ccall "static Imlib2.h imlib_image_flip_vertical" imlibImageFlipVertical :: IO ()+imageFlipVertical :: IO () imageFlipVertical = imlibImageFlipVertical --void imlib_image_flip_diagonal(void); foreign import ccall "static Imlib2.h imlib_image_flip_diagonal" imlibImageFlipDiagonal :: IO ()+imageFlipDiagonal :: IO () imageFlipDiagonal = imlibImageFlipDiagonal --void imlib_image_orientate(int orientation); foreign import ccall "static Imlib2.h imlib_image_orientate" imlibImageOrientate :: Int -> IO ()+imageOrientate :: Int -> IO () imageOrientate = imlibImageOrientate --void imlib_image_blur(int radius); foreign import ccall "static Imlib2.h imlib_image_blur" imlibImageBlur :: Int -> IO ()+imageBlur :: Int -> IO () imageBlur = imlibImageBlur --void imlib_image_sharpen(int radius); foreign import ccall "static Imlib2.h imlib_image_sharpen" imlibImageSharpen :: Int -> IO ()+imageSharpen :: Int -> IO () imageSharpen = imlibImageSharpen --void imlib_image_tile_horizontal(void); foreign import ccall "static Imlib2.h imlib_image_tile_horizontal" imlibImageTileHorizontal :: IO ()+imageTileHorizontal :: IO () imageTileHorizontal = imlibImageTileHorizontal --void imlib_image_tile_vertical(void); foreign import ccall "static Imlib2.h imlib_image_tile_vertical" imlibImageTileVertical :: IO ()+imageTileVertical :: IO () imageTileVertical = imlibImageTileVertical --void imlib_image_tile(void); foreign import ccall "static Imlib2.h imlib_image_tile" imlibImageTile :: IO ()+imageTile :: IO () imageTile = imlibImageTile --Imlib_Font imlib_load_font(const char *font_name); foreign import ccall "static Imlib2.h imlib_load_font" imlibLoadFont :: CString -> IO ImlibFont+loadFont :: String -> IO ImlibFont loadFont str = withCString str imlibLoadFont --void imlib_free_font(void); foreign import ccall "static Imlib2.h imlib_free_font" imlibFreeFont :: IO ()-freeFont str = imlibFreeFont+freeFont :: forall t. t -> IO ()+freeFont _ = imlibFreeFont --void imlib_text_draw(int x, int y, const char *text); 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) --void imlib_text_draw_with_return_metrics(int x, int y, const char *text, int *width_return, int *height_return, int *horizontal_advance_return, int *vertical_advance_return);@@ -779,48 +846,54 @@ 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) + return (rw,rh,rah,rav) --void imlib_get_text_size(const char *text, int *width_return, int *height_return); 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) + return (rw,rh) --void imlib_get_text_advance(const char *text, int *horizontal_advance_return, int *vertical_advance_return); 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) + return (rh,rv) --int imlib_get_text_inset(const char *text); foreign import ccall "static Imlib2.h imlib_get_text_inset" imlibGetTextInset :: CString -> IO Int+getTextInset :: String -> IO Int getTextInset str = withCString str imlibGetTextInset --void imlib_add_path_to_font_path(const char *path); foreign import ccall "static Imlib2.h imlib_add_path_to_font_path" imlibAddPathToFontPath :: CString -> IO ()+addPathToFontPath :: String -> IO () addPathToFontPath str = withCString str imlibAddPathToFontPath --void imlib_remove_path_from_font_path(const char *path); foreign import ccall "static Imlib2.h imlib_remove_path_from_font_path" imlibRemovePathFromFontPath :: CString -> IO ()+removePathFromFontPath :: String -> IO () removePathFromFontPath str = withCString str imlibRemovePathFromFontPath --char **imlib_list_font_path(int *number_return); 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- xs <- mapM peekCString xs- return xs+ ys <- mapM peekCString xs+ return ys --int imlib_text_get_index_and_location(const char *text, int x, int y, int *char_x_return, int *char_y_return, int *char_width_return, int *char_height_return); 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@@ -829,7 +902,7 @@ 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) + return (n,xr,yr,wr,hr) --void imlib_text_get_location_at_index(const char *text, int index, int *char_x_return, int *char_y_return, int *char_width_return, int *char_height_return);@@ -839,68 +912,81 @@ 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) + return (xr,yr,wr,hr) --char **imlib_list_fonts(int *number_return); --void imlib_free_font_list(char **font_list, int number); 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- xs <- mapM peekCString xs+ ys <- mapM peekCString xs imlibFreeFontList pxs n- return xs+ return ys --int imlib_get_font_cache_size(void); foreign import ccall "static Imlib2.h imlib_get_font_cache_size" imlibGetFontCacheSize :: IO Int+getFontCacheSize :: IO Int getFontCacheSize = imlibGetFontCacheSize --void imlib_set_font_cache_size(int bytes); foreign import ccall "static Imlib2.h imlib_set_font_cache_size" imlibSetFontCacheSize :: Int -> IO ()+setFontCacheSize :: Int -> IO () setFontCacheSize = imlibSetFontCacheSize --void imlib_flush_font_cache(void); foreign import ccall "static Imlib2.h imlib_flush_font_cache" imlibFlushFontCache :: IO ()+flushFontCache :: IO () flushFontCache = imlibFlushFontCache --int imlib_get_font_ascent(void); foreign import ccall "static Imlib2.h imlib_get_font_ascent" imlibGetFontAscent :: IO Int+getFontAscent :: IO Int getFontAscent = imlibGetFontAscent --int imlib_get_font_descent(void); foreign import ccall "static Imlib2.h imlib_get_font_descent" imlibGetFontDescent :: IO Int+getFontDescent :: IO Int getFontDescent = imlibGetFontDescent --int imlib_get_maximum_font_ascent(void); foreign import ccall "static Imlib2.h imlib_get_maximum_font_ascent" imlibGetMaximumFontAscent :: IO Int+getMaximumFontAscent :: IO Int getMaximumFontAscent = imlibGetMaximumFontAscent --int imlib_get_maximum_font_descent(void); foreign import ccall "static Imlib2.h imlib_get_maximum_font_descent" imlibGetMaximumFontDescent :: IO Int+getMaximumFontDescent :: IO Int getMaximumFontDescent = imlibGetMaximumFontDescent --Imlib_Color_Modifier imlib_create_color_modifier(void); foreign import ccall "static Imlib2.h imlib_create_color_modifier" imlibCreateColorModifier :: IO ImlibColorModifier+createColorModifier :: IO ImlibColorModifier createColorModifier = imlibCreateColorModifier --void imlib_free_color_modifier(void); foreign import ccall "static Imlib2.h imlib_free_color_modifier" imlibFreeColorModifier :: IO ()+freeColorModifier :: IO () freeColorModifier = imlibFreeColorModifier --void imlib_modify_color_modifier_gamma(double gamma_value); foreign import ccall "static Imlib2.h imlib_modify_color_modifier_gamma" imlibModifyColorModifierGamma :: Double -> IO ()+modifyColorModifierGamma :: Double -> IO () modifyColorModifierGamma = imlibModifyColorModifierGamma --void imlib_modify_color_modifier_brightness(double brightness_value); foreign import ccall "static Imlib2.h imlib_modify_color_modifier_brightness" imlibModifyColorModifierBrightness :: Double -> IO ()+modifyColorModifierBrightness :: Double -> IO () modifyColorModifierBrightness = imlibModifyColorModifierBrightness --void imlib_modify_color_modifier_contrast(double contrast_value); foreign import ccall "static Imlib2.h imlib_modify_color_modifier_contrast" imlibModifyColorModifierContrast :: Double -> IO ()+modifyColorModifierContrast :: Double -> IO () modifyColorModifierContrast = imlibModifyColorModifierContrast --void imlib_set_color_modifier_tables(DATA8 *red_table, DATA8 *green_table, DATA8 *blue_table, DATA8 *alpha_table);@@ -911,9 +997,9 @@ withArray bs (\ba -> withArray as (\aa -> imlibSetColorModifierTables ra ga ba aa)))) where- padLeft n a xs | l > n = take n xs- | l < n = (replicate (n-l) a) ++ xs- | l == n = xs+ padLeft n b xs | l > n = take n xs+ | l < n = (replicate (n-l) b) ++ xs+ | otherwise = xs -- l == n where l = length xs rs = padLeft 256 0 r gs = padLeft 256 0 g@@ -931,10 +1017,12 @@ --void imlib_reset_color_modifier(void); foreign import ccall "static Imlib2.h imlib_reset_color_modifier" imlibResetColorModifier :: IO ()+resetColorModifier :: IO () resetColorModifier = imlibResetColorModifier --void imlib_apply_color_modifier(void); foreign import ccall "static Imlib2.h imlib_apply_color_modifier" imlibApplyColorModifier :: IO ()+applyColorModifier :: IO () applyColorModifier = imlibApplyColorModifier --void imlib_apply_color_modifier_to_rectangle(int x, int y, int width, int height);@@ -971,14 +1059,17 @@ --Imlib_Color_Range imlib_create_color_range(void); foreign import ccall "static Imlib2.h imlib_create_color_range" imlibCreateColorRange :: IO ImlibColorRange+createColorRange :: IO ImlibColorRange createColorRange = imlibCreateColorRange --void imlib_free_color_range(void); foreign import ccall "static Imlib2.h imlib_free_color_range" imlibFreeColorRange :: IO ()+freeColorRange :: IO () freeColorRange = imlibFreeColorRange --void imlib_add_color_to_color_range(int distance_away); foreign import ccall "static Imlib2.h imlib_add_color_to_color_range" imlibAddColorToColorRange :: Int -> IO ()+addColorToColorRange :: Int -> IO () addColorToColorRange = imlibAddColorToColorRange --void imlib_image_fill_color_range_rectangle(int x, int y, int width, int height, double angle);@@ -991,6 +1082,7 @@ --void imlib_image_query_pixel(int x, int y, Imlib_Color *color_return); 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@@ -1006,17 +1098,17 @@ 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) + return (cc,mm,yy,aa) --void imlib_image_query_pixel_hsva(int x, int y, float *hue, float *saturation, float *value, int *alpha); 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- imlibImageQueryPixelCmya cx cy h s v a+ 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) + return (hh,ss,vv,aa) --void imlib_image_query_pixel_hlsa(int x, int y, float *hue, float *lightness, float *saturation, int *alpha); foreign import ccall "static Imlib2.h imlib_image_query_pixel_hlsa" imlibImageQueryPixelHlsa :: Int -> Int -> Ptr Int -> Ptr Int -> Ptr Int -> Ptr Int -> IO ()@@ -1026,32 +1118,36 @@ 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) + return (hh,ll,ss,aa) --void imlib_image_attach_data_value(const char *key, void *data, int value, Imlib_Data_Destructor_Function destructor_function);-foreign import ccall "static Imlib2.h imlib_image_attach_data_value" imlibImageAttachDataValue :: CString -> Ptr () -> Int -> FunPtr ImlibDataDestructorFunction -> IO () +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) --void *imlib_image_get_attached_data(const char *key);-foreign import ccall "static Imlib2.h imlib_image_get_attached_data" imlibImageGetAttachedData :: CString -> IO (Ptr ()) +foreign import ccall "static Imlib2.h imlib_image_get_attached_data" imlibImageGetAttachedData :: CString -> IO (Ptr ())+imageGetAttachedData :: String -> IO (Ptr ()) imageGetAttachedData key = withCString key imlibImageGetAttachedData --int imlib_image_get_attached_value(const char *key);-foreign import ccall "static Imlib2.h imlib_image_get_attached_value" imlibImageGetAttachedValue :: CString -> IO Int +foreign import ccall "static Imlib2.h imlib_image_get_attached_value" imlibImageGetAttachedValue :: CString -> IO Int+imageGetAttachedValue :: String -> IO Int imageGetAttachedValue key = withCString key imlibImageGetAttachedValue --void imlib_image_remove_attached_data_value(const char *key);-foreign import ccall "static Imlib2.h imlib_image_remove_attached_data_value" imlibImageRemoveAttachedDataValue :: CString -> IO () +foreign import ccall "static Imlib2.h imlib_image_remove_attached_data_value" imlibImageRemoveAttachedDataValue :: CString -> IO ()+imageRemoveAttachedDataValue :: String -> IO () imageRemoveAttachedDataValue key = withCString key imlibImageRemoveAttachedDataValue --void imlib_image_remove_and_free_attached_data_value(const char *key);-foreign import ccall "static Imlib2.h imlib_image_remove_and_free_attached_data_value" imlibImageRemoveAndFreeAttachedDataValue :: CString -> IO () +foreign import ccall "static Imlib2.h imlib_image_remove_and_free_attached_data_value" imlibImageRemoveAndFreeAttachedDataValue :: CString -> IO () imageRemoveAndFreeAttachedDataValue key = withCString key imlibImageRemoveAndFreeAttachedDataValue --void imlib_save_image(const char *filename); foreign import ccall "static Imlib2.h imlib_save_image" imlibSaveImage :: CString -> IO ()+saveImage :: String -> IO () saveImage str = withCString str imlibSaveImage --void imlib_save_image_with_error_return(const char *filename, Imlib_Load_Error *error_return);@@ -1059,13 +1155,14 @@ saveImageWithErrorReturn :: String -> IO ImlibLoadError saveImageWithErrorReturn str = do pe <- malloc- im <- withCString str (\s -> imlibSaveImageWithErrorReturn s pe)+ im <- withCString str (\s -> imlibSaveImageWithErrorReturn s pe) -- Unused? e <- peek pe free pe- return (toEnum e) + return (toEnum e) --Imlib_Image imlib_create_rotated_image(double angle); foreign import ccall "static Imlib2.h imlib_create_rotated_image" imlibCreateRotatedImage :: Double -> IO ImlibImage+createRotatedImage :: Double -> IO ImlibImage createRotatedImage = imlibCreateRotatedImage --void imlib_blend_image_onto_image_at_angle(Imlib_Image source_image, char merge_alpha, int source_x, int source_y, int source_width, int source_height, int destination_x, int destination_y, int angle_x, int angle_y);@@ -1115,10 +1212,12 @@ --void imlib_polygon_new(void); foreign import ccall "static Imlib2.h imlib_polygon_new" imlibPolygonNew :: IO ()+polygonNew :: IO () polygonNew = imlibPolygonNew --void imlib_polygon_free(ImlibPolygon poly); foreign import ccall "static Imlib2.h imlib_polygon_free" imlibPolygonFree :: ImlibPolygon -> IO ()+polygonFree :: ImlibPolygon -> IO () polygonFree = imlibPolygonFree --void imlib_polygon_add_point(ImlibPolygon poly, int x, int y);@@ -1127,10 +1226,12 @@ --void imlib_image_draw_polygon(ImlibPolygon poly, unsigned char closed); foreign import ccall "static Imlib2.h imlib_image_draw_polygon" imlibImageDrawPolygon :: ImlibPolygon -> Bool -> IO ()+imageDrawPolygon :: ImlibPolygon -> Bool -> IO () imageDrawPolygon = imlibImageDrawPolygon --void imlib_image_fill_polygon(ImlibPolygon poly); foreign import ccall "static Imlib2.h imlib_image_fill_polygon" imlibImageFillPolygon :: ImlibPolygon -> IO ()+imageFillPolygon :: ImlibPolygon -> IO () imageFillPolygon = imlibImageFillPolygon --void imlib_polygon_get_bounds(ImlibPolygon poly, int *px1, int *py1, int *px2, int *py2);@@ -1156,14 +1257,17 @@ --void imlib_image_filter(void); foreign import ccall "static Imlib2.h imlib_image_filter" imlibImageFilter :: IO ()+imageFilter :: IO () imageFilter = imlibImageFilter --Imlib_Filter imlib_create_filter(int initsize); foreign import ccall "static Imlib2.h imlib_create_filter" imlibCreateFilter :: Int -> IO ImlibFilter+createFilter :: Int -> IO ImlibFilter createFilter = imlibCreateFilter --void imlib_free_filter(void); foreign import ccall "static Imlib2.h imlib_free_filter" imlibFreeFilter :: IO ()+freeFilter :: IO () freeFilter = imlibFreeFilter --void imlib_filter_set(int xoff, int yoff, int a, int r, int g, int b);@@ -1180,7 +1284,7 @@ --void imlib_filter_set_green(int xoff, int yoff, int a, int r, int g, int b); foreign import ccall "static Imlib2.h imlib_filter_set_green" imlibFilterSetGreen :: Int -> Int -> Int -> Int -> Int -> Int -> IO ()-filterSetGreen = imlibFilterSetGreen +filterSetGreen = imlibFilterSetGreen --void imlib_filter_set_blue(int xoff, int yoff, int a, int r, int g, int b); foreign import ccall "static Imlib2.h imlib_filter_set_blue" imlibFilterSetBlue :: Int -> Int -> Int -> Int -> Int -> Int -> IO ()@@ -1188,10 +1292,12 @@ --void imlib_filter_constants(int a, int r, int g, int b); foreign import ccall "static Imlib2.h imlib_filter_constants" imlibFilterConstants :: Int -> Int -> Int -> Int -> IO ()+filterConstants :: Int -> Int -> Int -> Int -> IO () filterConstants = imlibFilterConstants --void imlib_filter_divisors(int a, int r, int g, int b); foreign import ccall "static Imlib2.h imlib_filter_divisors" imlibFilterDivisors :: Int -> Int -> Int -> Int -> IO ()+filterDivisors :: Int -> Int -> Int -> Int -> IO () filterDivisors = imlibFilterDivisors
Imlib.cabal view
@@ -1,13 +1,15 @@ Name: Imlib-Version: 0.1+Version: 0.1.1 Description: Haskell binding for Imlib 2 Category: Graphics License: BSD3 License-file: LICENSE Author: Cale Gibbard Maintainer: cgibbard@gmail.com-Build-Depends: base+Build-Depends: base, array, X11+Build-Type: Simple Exposed-Modules: Graphics.Imlib Extra-Libraries: Imlib2 Extra-Source-Files: examples/value2alpha.hs examples/circle-inversion.hs-ghc-options: -O2+ghc-options: -O2 -optl-Wl,-s+ghc-prof-options: -prof -auto-all