Permalink
Browse files

oh right and the cabal file

  • Loading branch information...
1 parent 16e9607 commit 87d2d1e26b6980237c0b694624ba23727bd2fb0d @substack committed Mar 21, 2010
Showing with 14 additions and 5 deletions.
  1. +7 −2 Graphics/GD/State.hs
  2. +5 −1 examples/circle.hs
  3. +2 −2 gd.cabal
View
@@ -1,3 +1,9 @@
+{-
+ Graphics.GD.State
+ License: BSD3
+ Author: James Halliday
+-}
+
module Graphics.GD.State (
GD,channels,
withImage,withNewImage,newImage,
@@ -79,8 +85,7 @@ withImage im f = do
g' mIm = case mIm of
Just im -> im
Nothing -> im
- -- mapM_ (flip runCmd $ im') $ gdCmds gd'
- foldM_ g (gdImage gd') $ gdCmds gd'
+ foldM_ g (gdImage gd') $ reverse $ gdCmds gd'
return value
withNewImage :: Size -> GD a -> IO a
View
@@ -3,9 +3,13 @@ import Graphics.GD.State
main = do
(savePngFile "circle.png" =<<) . newImage (400,300) $ do
(w,h) <- getSize
+
+ fill $ rgb 100 63 127 -- dark purple background
+
drawArc
(w `div` 2,h `div` 2) -- centered
(180,180) -- (width,height)
0 360 -- a circle
(rgb 255 255 255) -- white circle
- fill $ rgb 100 63 127 -- dark purple background
+
+ drawLine (0,0) (w-1,h-1) (rgb 127 255 127)
View
@@ -1,5 +1,5 @@
Name: gd
-Version: 3000.4.0
+Version: 3000.4.1
Cabal-version: >= 1.2
Build-type: Simple
Copyright: Bjorn Bringert
@@ -22,7 +22,7 @@ Library
-- in base 1.0 and 3.0 bytestring is a separate package
Build-depends: base < 2.0 || >= 3, bytestring >= 0.9, mtl
Extensions: ForeignFunctionInterface
- Exposed-Modules: Graphics.GD
+ Exposed-Modules: Graphics.GD, Graphics.GD.State
Ghc-options: -Wall
Extra-libraries: gd, png, z, jpeg, m, fontconfig, freetype, pthread, expat
Includes: gd.h

0 comments on commit 87d2d1e

Please sign in to comment.