diagrams-0.2.1.3: An EDSL for creating simple diagramsSource codeContentsIndex
Graphics.Rendering.Diagrams.Layouts
Portabilityportable
Stabilityexperimental
Maintainerbyorgey@gmail.com
Contents
Union
Lists
Tree
Miscellaneous
Description
Layout definitions for Graphics.Rendering.Diagrams, an embedded domain-specific language (EDSL) for creating simple diagrams.
Synopsis
(##) :: 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).
union :: [Diagram] -> DiagramSource
Create a Diagram as a union of subdiagrams which will not be repositioned. If the subdiagrams overlap, they will appear with the first Diagram on the bottom, and the last on top.
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 Diagrams horizontally from left to right, aligned along their top edges.
vcat :: [Diagram] -> DiagramSource
Lay out a list of Diagrams vertically from top to bottom, aligned along their left edges.
hcatA :: VAlignment -> [Diagram] -> DiagramSource
Lay out a list of Diagrams horizontally from left to right, with the given vertical alignment (top, vcenter, or bottom).
vcatA :: HAlignment -> [Diagram] -> DiagramSource
Lay out a list of Diagrams vertically from top to bottom, with the given horizontal alignment (left, hcenter, or right).
hsepSource
:: Doubleamount of separation between each pair of diagrams
-> [Diagram]
-> Diagram
Lay out a list of Diagrams horizontally, aligned along their top edges, with a given amount of separation in between each pair.
vsepSource
:: Doubleamount of separation between each pair of diagrams
-> [Diagram]
-> Diagram
Lay out a list of Diagrams vertically, aligned along their left edges, with a given amount of separation in between each pair.
hsepASource
:: Doubleamount of separation between each pair of diagrams
-> VAlignmentalignment to use (top, vcenter, or bottom)
-> [Diagram]
-> Diagram
Lay out a list of Diagrams horizontally, with the given amount of separation in between each pair, using the given vertical alignment (top, vcenter, or bottom).
vsepASource
:: Doubleamount of separation between each pair of diagrams
-> HAlignmentalignment to use (left, hcenter, or right)
-> [Diagram]
-> Diagram
Lay out a list of Diagrams vertically, with the given amount of separation in between each pair, using the given horizontal alignment (left, hcenter, or right).
hdistribSource
:: DoubleHow far from one diagram to the next?
-> HAlignmentDistribute according to which parts of the diagrams (left, hcenter, right)?
-> [Diagram]
-> Diagram
Distribute a list of Diagrams horizontally according to a regular spacing, aligned along their top edges.
vdistribSource
:: DoubleHow far from one diagram to the next?
-> VAlignmentDistribute according to which parts of the diagrams (top, vcenter, bottom)?
-> [Diagram]
-> Diagram
Distribute a list of Diagrams vertically according to a regular spacing, aligned along their left edges.
hdistribASource
:: DoubleHow far from one diagram to the next?
-> HAlignmentDistribute according to which parts of the diagrams (left, hcenter, right)?
-> VAlignmentalignment to use (top, vcenter, bottom)
-> [Diagram]
-> Diagram
Distribute a list of Diagrams horizontally according to a regular spacing, with the given alignment.
vdistribASource
:: DoubleHow far from one diagram to the next?
-> VAlignmentDistribute according to which parts of the diagrams (top, vcenter, bottom)?
-> HAlignmentalignment to use (left, hcenter, right)
-> [Diagram]
-> Diagram
Distribute a list of Diagrams 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.
top :: VAlignmentSource
vcenter :: VAlignmentSource
bottom :: VAlignmentSource
type HAlignment = AlignmentSource
Horizontal alignment.
left :: HAlignmentSource
hcenter :: HAlignmentSource
right :: HAlignmentSource
Tree
treeSource
:: Doubleseparation between layers
-> Doubleseparation between siblings
-> Tree Diagram
-> Diagram
Lay out a Tree (from Data.Tree) of Diagrams in a top-down fashion. This layout is experimental; future releases of the Diagrams library are planned which will be able to automatically draw edges between nodes in the 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.
withSizeSource
:: Double -> Double -> DiagramFunction for new diagram
-> DiagramOld diagram
-> Diagram
Create one diagram using the current size of another. The new diagram is returned, the old one is discarded.
Produced by Haddock version 2.6.1