Portability | portable |
---|---|

Stability | experimental |

Maintainer | byorgey@gmail.com |

Layout definitions for Graphics.Rendering.Diagrams, an embedded domain-specific language (EDSL) for creating simple diagrams.

- (##) :: Diagram -> Diagram -> Diagram
- union :: [Diagram] -> Diagram
- unionA :: HAlignment -> VAlignment -> [Diagram] -> Diagram
- (<>) :: Diagram -> Diagram -> Diagram
- (//) :: Diagram -> Diagram -> Diagram
- hcat :: [Diagram] -> Diagram
- vcat :: [Diagram] -> Diagram
- hcatA :: VAlignment -> [Diagram] -> Diagram
- vcatA :: HAlignment -> [Diagram] -> Diagram
- hsep :: Double -> [Diagram] -> Diagram
- vsep :: Double -> [Diagram] -> Diagram
- hsepA :: Double -> VAlignment -> [Diagram] -> Diagram
- vsepA :: Double -> HAlignment -> [Diagram] -> Diagram
- hdistrib :: Double -> HAlignment -> [Diagram] -> Diagram
- vdistrib :: Double -> VAlignment -> [Diagram] -> Diagram
- hdistribA :: Double -> HAlignment -> VAlignment -> [Diagram] -> Diagram
- vdistribA :: Double -> VAlignment -> HAlignment -> [Diagram] -> Diagram
- position :: [(Point, Diagram)] -> Diagram
- positionA :: HAlignment -> VAlignment -> [(Point, Diagram)] -> Diagram
- positionAlong :: [Diagram] -> Path -> Diagram
- positionAlongA :: HAlignment -> VAlignment -> [Diagram] -> Path -> Diagram
- grid :: [[Diagram]] -> Diagram
- gridA :: HAlignment -> VAlignment -> [[Diagram]] -> Diagram
- gridAs :: [[(HAlignment, VAlignment)]] -> [[Diagram]] -> Diagram
- type VAlignment = Alignment
- top :: VAlignment
- vcenter :: VAlignment
- bottom :: VAlignment
- type HAlignment = Alignment
- left :: HAlignment
- hcenter :: HAlignment
- right :: HAlignment
- tree :: Double -> Double -> Tree Diagram -> Diagram
- pad :: Double -> Double -> Diagram -> Diagram
- padA :: Double -> Double -> HAlignment -> VAlignment -> Diagram -> Diagram
- showBBox :: Diagram -> Diagram
- showBBoxes :: Diagram -> Diagram
- withSize :: (Double -> Double -> Diagram) -> Diagram -> Diagram

# Union

(##) :: Diagram -> Diagram -> DiagramSource

Superimpose one diagram atop another. `d1 ## d2`

results in a
diagram in which `d2`

is on top of `d1`

(i.e., `d1`

is drawn
first, then `d2`

).

unionA :: HAlignment -> VAlignment -> [Diagram] -> DiagramSource

Create a `Diagram`

as a union of subdiagrams superimposed on one
another, aligned vertically and/or horizontally.

# Lists

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

`d1 <> d2`

is a `Diagram`

with `d1`

to the left of `d2`

, aligned
along their top edges.

(//) :: Diagram -> Diagram -> DiagramSource

`d1 // d2`

is a `Diagram`

with `d1`

above `d2`

, aligned
along their left edges.

hcat :: [Diagram] -> DiagramSource

Lay out a list of `Diagram`

s horizontally from left to right,
aligned along their top edges.

vcat :: [Diagram] -> DiagramSource

Lay out a list of `Diagram`

s vertically from top to bottom,
aligned along their left edges.

hcatA :: VAlignment -> [Diagram] -> DiagramSource

vcatA :: HAlignment -> [Diagram] -> DiagramSource

Lay out a list of `Diagram`

s horizontally, aligned along their
top edges, with a given amount of separation in between each pair.

Lay out a list of `Diagram`

s vertically, aligned along their
left edges, with a given amount of separation in between each pair.

:: Double | amount of separation between each pair of diagrams |

-> VAlignment | |

-> [Diagram] | |

-> Diagram |

:: Double | amount of separation between each pair of diagrams |

-> HAlignment | |

-> [Diagram] | |

-> Diagram |

:: Double | How far from one diagram to the next? |

-> HAlignment | Distribute according to which parts of
the diagrams ( |

-> [Diagram] | |

-> Diagram |

Distribute a list of `Diagram`

s horizontally according to a
regular spacing, aligned along their top edges.

:: Double | How far from one diagram to the next? |

-> VAlignment | Distribute according to which parts of
the diagrams ( |

-> [Diagram] | |

-> Diagram |

Distribute a list of `Diagram`

s vertically according to a regular
spacing, aligned along their left edges.

:: Double | How far from one diagram to the next? |

-> HAlignment | Distribute according to which parts of
the diagrams ( |

-> VAlignment | |

-> [Diagram] | |

-> Diagram |

Distribute a list of `Diagram`

s horizontally according to a
regular spacing, with the given alignment.

:: Double | How far from one diagram to the next? |

-> VAlignment | Distribute according to which parts of
the diagrams ( |

-> HAlignment | |

-> [Diagram] | |

-> Diagram |

Distribute a list of `Diagram`

s vertically according to a
regular spacing, with the given alignment.

position :: [(Point, Diagram)] -> DiagramSource

Create a diagram from a list of subdiagrams with explicit
positions in a local coordinate system. Each subdiagram will be
positioned with its center at the corresponding
position. `position`

is equivalent to ```
positionA hcenter
vcenter
```

.

positionA :: HAlignment -> VAlignment -> [(Point, Diagram)] -> DiagramSource

Create a diagram from a list of subdiagrams with explicit
positions in a local coordinate system. The alignment options
specify what part of each subdiagram should be placed on the
corresponding position. For example, `positionA left top`

will
position the top left corner of each subdiagram at the
corresponding point.

positionAlong :: [Diagram] -> Path -> DiagramSource

Create a diagram from a list of subdiagrams and a given path, by positioning the subdiagrams at successive vertices of the path. If there are more diagrams than path vertices, the extra diagrams will be discarded.

positionAlongA :: HAlignment -> VAlignment -> [Diagram] -> Path -> DiagramSource

A version of `positionAlong`

with explicit alignment.

grid :: [[Diagram]] -> DiagramSource

Align diagrams into a grid, with each item centered horizontally and vertically Warning: there is currently an exponential performace blowup if you nest grids. (exponential in how deep the nesting is).

gridA :: HAlignment -> VAlignment -> [[Diagram]] -> DiagramSource

Align diagrams into a grid with each item aligned as specified. Warning: there is currently an exponential performace blowup if you nest grids (exponential in how deep the nesting is).

gridAs :: [[(HAlignment, VAlignment)]] -> [[Diagram]] -> DiagramSource

Align diagrams into a grid, specifying individual alignments for each item. Warning: there is currently an exponential performace blowup if you nest grids (exponential in how deep the nesting is).

type VAlignment = AlignmentSource

Vertical alignment.

type HAlignment = AlignmentSource

Horizontal alignment.

# Tree

# Miscellaneous

pad :: Double -> Double -> Diagram -> DiagramSource

Add extra padding to a diagram. `pad w h d`

is a diagram which
is the same as `d`

, but with `w`

units added to the width and `h`

units added to the height, with `d`

centered in the available
space. Thus `pad w h`

is equivalent to `padA w h hcenter vcenter`

.

padA :: Double -> Double -> HAlignment -> VAlignment -> Diagram -> DiagramSource

Add extra padding to a diagram, aligning the diagram as indicated within the avilable space.

showBBox :: Diagram -> DiagramSource

Show a rectangle denoting a diagram's bounding box, in addition to the diagram itself.

showBBoxes :: Diagram -> DiagramSource

Show the bounding boxes of a diagram and all its subdiagrams.