1 module RMCA.GUI.Shapes where
3 import Graphics.Rendering.Cairo
5 -- Draws a regular hexagon
7 -- Colors are given in RGB format, coefficient goes from 0 to 1
8 hexagon :: (Double, Double, Double) -- Background color
9 -> (Double, Double, Double) -- Frame color
10 -> (Double, Double) -- Center
13 hexagon (backR, backG, backB) (frameR, frameG, frameB) (x,y) w = do
14 setSourceRGB frameR frameG frameB
15 setLineWidth (0.01 * w)
28 setSourceRGB backR backG backB
35 main = withImageSurface FormatARGB32 pnw pnh
36 (\srf -> do renderWith srf (hexagon (1,1,1) (0,0,0)
37 (fromIntegral pnw/2,fromIntegral pnh/ 2) (fromIntegral (pnw `quot` 2)))
38 surfaceWriteToPNG srf "myDraw.png")