gd 3000.7 → 3000.7.1
raw patch · 2 files changed
+26/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Graphics.GD: PCREOption :: CInt -> PCREOption
+ Graphics.GD: brushed :: PCREOption
+ Graphics.GD: instance Eq PCREOption
+ Graphics.GD: instance Show PCREOption
+ Graphics.GD: newtype PCREOption
+ Graphics.GD: setBrush :: Image -> Image -> IO ()
+ Graphics.GD: unPCREOption :: PCREOption -> CInt
Files
- Graphics/GD.hsc +25/−2
- gd.cabal +1/−1
Graphics/GD.hsc view
@@ -1,7 +1,7 @@ {-# LANGUAGE EmptyDataDecls #-} module Graphics.GD ( -- * Types- Image, Size, Point, Color,+ Image, Size, Point, Color, PCREOption(..), -- * Creating and copying images newImage, copyImage, copyRegion, copyRegionScaled,@@ -28,6 +28,8 @@ -- * Manipulating images resizeImage, rotateImage, -- * Drawing+ brushed,+ setBrush, fillImage, drawFilledRectangle, drawFilledEllipse,@@ -54,8 +56,9 @@ import Foreign (Ptr,FunPtr,ForeignPtr) import Foreign (peekByteOff) import qualified Foreign as F-import Foreign.C (CInt,CString,CDouble)+import Foreign.C (CString) import qualified Foreign.C as C+import Foreign.C.Types data CFILE @@ -164,6 +167,9 @@ -- Drawing functions +foreign import ccall "gd.h gdImageSetBrush" gdImageSetBrush+ :: Ptr GDImage -> Ptr GDImage -> IO ()+ foreign import ccall "gd.h gdImageFilledRectangle" gdImageFilledRectangle :: Ptr GDImage -> CInt -> CInt -> CInt -> CInt -> CInt -> IO () @@ -216,6 +222,10 @@ foreign import ccall "gd.h gdImageAlphaBlending" gdImageAlphaBlending :: Ptr GDImage -> CInt -> IO () +-- | To access the definition 'gdBrush' from GD+newtype PCREOption = PCREOption { unPCREOption :: CInt }+ deriving (Eq,Show)+ -- We use a second level of indirection to allow storing a null pointer -- when the image has already been freed. This allows 'withImage' to -- free the @gdImage@ early.@@ -475,6 +485,19 @@ -- -- * Drawing --++-- | Special character for gdBrushed+brushed :: PCREOption+brushed = PCREOption (#const gdBrushed)++-- | Set an @Image@ as a brush for an @Image@+setBrush :: Image -- ^ Source image+ -> Image -- ^ Brush+ -> IO ()+setBrush i b = + withImagePtr b $+ \brushImg -> withImagePtr i $+ \srcImg -> gdImageSetBrush srcImg brushImg -- | Fill the entire image with the given color. fillImage :: Color -> Image -> IO ()
gd.cabal view
@@ -1,7 +1,7 @@ Name: gd Category: Graphics License-File: LICENSE-Version: 3000.7+Version: 3000.7.1 Cabal-version: >= 1.2 Build-type: Simple Copyright: Bjorn Bringert