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

Safe HaskellSafe
LanguageHaskell98

Graphics.Diagrams

Contents

Description

Diagrams user API

Synopsis

Points

type Point = (Double, Double) Source

Point type as defined in the diagrams package

(*.) :: Double -> Point -> Point infixl 7 Source

Scalar multiplication.

(.*.) :: Point -> Point -> Point infixl 7 Source

Elementwise addition, subtraction and multiplication for Points.

(.+.) :: Point -> Point -> Point infixl 6 Source

Elementwise addition, subtraction and multiplication for Points.

(.-.) :: Point -> Point -> Point infixl 6 Source

Elementwise addition, subtraction and multiplication for Points.

Colors

color :: String -> Color Source

named color

rgb :: Double -> Double -> Double -> Color Source

RGB color (components are between 0 and 1)

Diagrams

data Diagram Source

Diagram data type

Instances

Primitives

empty :: Diagram Source

empty diagram

rect :: Double -> Double -> Diagram Source

rectangle given with width and height

rectangle :: Point -> Point -> Diagram Source

rectangle given with two opposite corners

circle :: Double -> Diagram Source

circle with radius

(>-<) :: Point -> Point -> Diagram infix 4 Source

line segment

(~~) :: Point -> Point -> Diagram infix 4 Source

line segment

Texts

textFrom :: String -> Point -> Diagram infixl 3 Source

text; beginning of text is fixed

textTo :: String -> Point -> Diagram infixl 3 Source

text; end of text is fixed

textAt :: String -> Point -> Diagram infixl 3 Source

text; middle of text is fixed

Transformations

move :: Diagram -> Point -> Diagram infixl 3 Source

rotate :: Diagram -> Double -> Diagram infixl 3 Source

rotate (degree)

scale :: Diagram -> Double -> Diagram infixl 3 Source

scale differently at x and y axes

scaleXY :: Diagram -> (Double, Double) -> Diagram infixl 3 Source

clip :: Point -> Point -> Diagram -> Diagram Source

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

Styles

fill :: Diagram -> Color -> Diagram infixl 3 Source

fill with color

stroke :: Diagram -> Color -> Diagram infixl 3 Source

set stroke color

strokeWidth :: Diagram -> Double -> Diagram infixl 3 Source

set stroke width

fontFamily :: Diagram -> String -> Diagram infixl 3 Source

set font family

link :: Diagram -> String -> Diagram infixl 3 Source

add an html link

Combining diagrams

(<|>) :: Diagram -> Diagram -> Diagram infixl 2 Source

overlay; the second diagram is over the first one

union :: [Diagram] -> Diagram Source

overlay generalized to several diagrams

pack :: Diagram -> (Diagram -> Diagram) -> Diagram Source

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