dia-base-0.1.1.1: An EDSL for teaching Haskell with diagrams - data types

Safe HaskellSafe-Infered

Graphics.Diagrams

Contents

Description

Diagrams user API

Synopsis

Points

type Point = (Double, Double)Source

Point type as defined in the diagrams package

(*.) :: Double -> Point -> PointSource

Scalar multiplication.

(.+.), (.*.), (.-.) :: Point -> Point -> PointSource

Elementwise addition, subtraction and multiplication for Points.

Colors

color :: String -> ColorSource

named color

rgb :: Double -> Double -> Double -> ColorSource

RGB color (components are between 0 and 1)

Diagrams

data Diagram Source

Diagram data type

Primitives

empty :: DiagramSource

empty diagram

rect :: Double -> Double -> DiagramSource

rectangle given with width and height

rectangle :: Point -> Point -> DiagramSource

rectangle given with two opposite corners

circle :: Double -> DiagramSource

circle with radius

(>-<), (~~) :: Point -> Point -> DiagramSource

line segment

Texts

textFrom :: String -> Point -> DiagramSource

text; beginning of text is fixed

textTo :: String -> Point -> DiagramSource

text; end of text is fixed

textAt :: String -> Point -> DiagramSource

text; middle of text is fixed

Transformations

rotate :: Diagram -> Double -> DiagramSource

rotate (degree)

scale :: Diagram -> Double -> DiagramSource

scale differently at x and y axes

clip :: Point -> Point -> Diagram -> DiagramSource

clip a rectangle region (give lower-left and upper-right corners)

Styles

fill :: Diagram -> Color -> DiagramSource

fill with color

stroke :: Diagram -> Color -> DiagramSource

set stroke color

strokeWidth :: Diagram -> Double -> DiagramSource

set stroke width

fontFamily :: Diagram -> String -> DiagramSource

set font family

link :: Diagram -> String -> DiagramSource

add an html link

Combining diagrams

(<|>) :: Diagram -> Diagram -> DiagramSource

overlay; the second diagram is over the first one

union :: [Diagram] -> DiagramSource

overlay generalized to several diagrams

pack :: Diagram -> (Diagram -> Diagram) -> DiagramSource

pack a diagram; (pack d f) is the more efficient version of (let v=d in f v).