Created
April 12, 2012 14:07
-
-
Save xenophobia/2367557 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drawString :: DrawingArea -> RGB -> Coordinate -> String -> IO () | |
drawString drawArea (r, g, b) (x, y) str = do | |
drawWin <- widgetGetDrawWindow drawArea | |
let gcVal = newGCValues {foreground = Color r g b} | |
gc <- gcNewWithValues drawWin gcVal | |
layout <- widgetCreateLayout drawArea str | |
layoutSetText layout str | |
layoutSetWrap layout WrapWholeWords | |
layoutSetWidth layout . Just $ 300 | |
lineCount <- layoutGetLineCount layout | |
widgetSetSizeRequest drawArea 300 1000 | |
drawLayout drawWin gc 0 0 layout | |
drawWindowClearAreaExpose drawWin 0 0 300 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment