gd 3000.0.1 → 3000.1.0
raw patch · 2 files changed
+36/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Graphics.GD: drawArc :: Point -> Size -> Int -> Int -> Color -> Image -> IO ()
+ Graphics.GD: drawLine :: Point -> Point -> Color -> Image -> IO ()
+ Graphics.GD: setPixel :: Point -> Color -> Image -> IO ()
Files
- Graphics/GD.hsc +35/−1
- gd.cabal +1/−1
Graphics/GD.hsc view
@@ -24,8 +24,11 @@ -- * Drawing fillImage, drawFilledRectangle,- drawFilledEllipse, + drawFilledEllipse,+ drawLine,+ drawArc, antiAliased,+ setPixel, -- * Colors rgb, rgba ) where@@ -138,12 +141,22 @@ foreign import ccall "gd.h gdImageFilledEllipse" gdImageFilledEllipse :: Ptr GDImage -> CInt -> CInt -> CInt -> CInt -> CInt -> IO () +foreign import ccall "gd.h gdImageLine" gdImageLine+ :: Ptr GDImage -> CInt -> CInt -> CInt -> CInt -> CInt -> IO ()++foreign import ccall "gd.h gdImageArc" gdImageArc+ :: Ptr GDImage -> CInt -> CInt -> CInt -> CInt+ -> CInt -> CInt -> CInt -> IO ()+ foreign import ccall "gd.h gdImageSetAntiAliased" gdImageSetAntiAliased :: Ptr GDImage -> CInt -> IO () +foreign import ccall "gd.h gdImageSetPixel" gdImageSetPixel+ :: Ptr GDImage -> CInt -> CInt -> CInt -> IO () + type Image = ForeignPtr GDImage type Size = (Int,Int)@@ -317,12 +330,33 @@ withImage i $ \p -> gdImageFilledEllipse p (int cx) (int cy) (int w) (int h) c +drawLine :: Point -- ^ Start+ -> Point -- ^ End+ -> Color -> Image -> IO ()+drawLine (x1,y1) (x2,y2) c i =+ withImage i $ \p ->+ gdImageLine p (int x1) (int y1) (int x2) (int y2) c++drawArc :: Point -- ^ Center+ -> Size -- ^ Width and height+ -> Int -- ^ Starting position (degrees)+ -> Int -- ^ Ending position (degrees)+ -> Color -> Image -> IO ()+drawArc (cx,cy) (w,h) sp ep c i =+ withImage i $ \p ->+ gdImageArc p (int cx) (int cy) (int w) (int h) (int sp) (int ep) c+ -- | Use anti-aliasing when performing the given drawing function. -- This can cause a segault with some gd versions. antiAliased :: (Color -> Image -> IO a) -> Color -> Image -> IO a antiAliased f c i = do withImage i (\p -> gdImageSetAntiAliased p c) f (#{const gdAntiAliased}) i++setPixel :: Point -> Color -> Image -> IO ()+setPixel (x,y) c i =+ withImage i $ \p ->+ gdImageSetPixel p (int x) (int y) c -- -- * Colors
gd.cabal view
@@ -1,5 +1,5 @@ Name: gd-Version: 3000.0.1+Version: 3000.1.0 Copyright: Bjorn Bringert Maintainer: bjorn@bringert.net Author: Bjorn Bringert