I give you the first example on the Internet, rendering a primitive, point and rectangle. Next, double buffering. -- The Glorious Glasgow Haskell Compilation System, version 6.12.3 -- ghc --make SimpleCells.hs -- See: http://code.google.com/p/ainotebook/ -- -- Berlin Brown import Graphics.UI.Gtk import Graphics.UI.Gtk.Gdk.GC import Graphics.UI.Gtk hiding (Color, Point, Object) defaultFgColor :: Color defaultFgColor = Color 65535 65535 65535 defaultBgColor :: Color defaultBgColor = Color 0 0 0 renderScene d ev = do dw (w, h) gc let fg = Color (round (65535 * 205)) (round (65535 * 0)) (round (65535 * 0)) gcSetValues gc $ newGCValues { foreground = fg } drawPoint dw gc (120, 120) drawPoint dw gc (22, 22) drawRectangle dw gc True 20 20 20 20 return True main :: IO () main = do initGUI window drawing windowSetTitle window "Cells" containerAdd window drawing let bg = Color (round (65535 * 205)) (round (65535 * 205)) (round (65535 * 255))...
Comments
Post a Comment