{-# LANGUAGE NoMonomorphismRestriction #-} module Diagrams ( Diagram , circle, rect, (>-<) , move, rotate, scale , (<|>), union , polygon, polyline , strokeWidth , fill, stroke, Color, rgb , module Data.Colour.Names , Point, (.+.), (.-.), (.*.), (*.) , scaleY ) where import Graphics.Rendering.Diagrams hiding (circle, rotate, scale) import qualified Graphics.Rendering.Diagrams as D import Graphics.Rendering.Diagrams.Types import Data.Colour.SRGB.Linear (rgb) import Data.Colour.RGBSpace import Data.Colour.Names -------------------------------- infix 4 >-< infixl 3 `move`, `rotate`, `scale`, `fill`, `stroke`, `strokeWidth` infixl 2 <|> ----------------- d `move` (x,y) = translate x y d x `rotate` d = D.rotate (d/360) x scale = flip D.scale fill = flip fillColor stroke = flip lineColor strokeWidth = flip lineWidth (<|>) = (##) circle d | d > 0 = D.circle d circle _ = nil a >-< b = straight (pathFromVertices [a,b]) `move` 0.5 *. (a .+. b) polygon :: [Point] -> Diagram polygon xs = straight $ closed $ pathFromVertices xs polyline :: [Point] -> Diagram polyline xs = straight $ pathFromVertices xs --rgb :: Int -> Int -> Int -> Color --rgb r g b = rgbUsingSpace space r g b {- space :: RGBSpace Double space = linearRGBSpace $ mkRGBGamut (curryRGB id x x x) x where x = Data.Colour.CIE.Illuminant.e -}