Copyright | (c) 2011 diagrams-lib team (see LICENSE) |
---|---|

License | BSD-style (see LICENSE) |

Maintainer | diagrams-discuss@googlegroups.com |

Safe Haskell | None |

Language | Haskell2010 |

Diagram combinators specialized to two dimensions. For more general combinators, see Diagrams.Combinators.

- (===) :: (Juxtaposable a, V a ~ R2, Semigroup a) => a -> a -> a
- (|||) :: (Juxtaposable a, V a ~ R2, Semigroup a) => a -> a -> a
- atAngle :: (Juxtaposable a, V a ~ R2, Semigroup a) => Angle -> a -> a -> a
- hcat :: (Juxtaposable a, HasOrigin a, Monoid' a, V a ~ R2) => [a] -> a
- hcat' :: (Juxtaposable a, HasOrigin a, Monoid' a, V a ~ R2) => CatOpts R2 -> [a] -> a
- vcat :: (Juxtaposable a, HasOrigin a, Monoid' a, V a ~ R2) => [a] -> a
- vcat' :: (Juxtaposable a, HasOrigin a, Monoid' a, V a ~ R2) => CatOpts R2 -> [a] -> a
- strutR2 :: (Backend b R2, Monoid' m) => R2 -> QDiagram b R2 m
- strutX :: (Backend b R2, Monoid' m) => Double -> QDiagram b R2 m
- strutY :: (Backend b R2, Monoid' m) => Double -> QDiagram b R2 m
- padX :: (Backend b R2, Monoid' m) => Double -> QDiagram b R2 m -> QDiagram b R2 m
- padY :: (Backend b R2, Monoid' m) => Double -> QDiagram b R2 m -> QDiagram b R2 m
- extrudeLeft :: Monoid' m => Double -> QDiagram b R2 m -> QDiagram b R2 m
- extrudeRight :: Monoid' m => Double -> QDiagram b R2 m -> QDiagram b R2 m
- extrudeBottom :: Monoid' m => Double -> QDiagram b R2 m -> QDiagram b R2 m
- extrudeTop :: Monoid' m => Double -> QDiagram b R2 m -> QDiagram b R2 m
- view :: (Backend b R2, Monoid' m) => P2 -> R2 -> QDiagram b R2 m -> QDiagram b R2 m
- boundingRect :: (Enveloped t, Transformable t, TrailLike t, Monoid t, V t ~ R2, Enveloped a, V a ~ R2) => a -> t
- bg :: Renderable (Path R2) b => Colour Double -> Diagram b R2 -> Diagram b R2

# Binary combinators

(===) :: (Juxtaposable a, V a ~ R2, Semigroup a) => a -> a -> a infixl 6 Source

Place two diagrams (or other objects) vertically adjacent to one another, with the first diagram above the second. Since Haskell ignores whitespace in expressions, one can thus write

c === d

to place `c`

above `d`

. The local origin of the resulting
combined diagram is the same as the local origin of the first.
`(===)`

is associative and has `mempty`

as an identity. See the
documentation of `beside`

for more information.

(|||) :: (Juxtaposable a, V a ~ R2, Semigroup a) => a -> a -> a infixl 6 Source

Place two diagrams (or other juxtaposable objects) horizontally
adjacent to one another, with the first diagram to the left of
the second. The local origin of the resulting combined diagram
is the same as the local origin of the first. `(|||)`

is
associative and has `mempty`

as an identity. See the
documentation of `beside`

for more information.

atAngle :: (Juxtaposable a, V a ~ R2, Semigroup a) => Angle -> a -> a -> a Source

Place two diagrams (or other juxtaposable objects) adjacent to one
another, with the second diagram placed along a line at angle
`th`

from the first. The local origin of the resulting combined
diagram is the same as the local origin of the first.
See the documentation of `beside`

for more information.

# n-ary combinators

hcat :: (Juxtaposable a, HasOrigin a, Monoid' a, V a ~ R2) => [a] -> a Source

Lay out a list of juxtaposable objects in a row from left to right, so that their local origins lie along a single horizontal line, with successive envelopes tangent to one another.

vcat :: (Juxtaposable a, HasOrigin a, Monoid' a, V a ~ R2) => [a] -> a Source

Lay out a list of juxtaposable objects in a column from top to bottom, so that their local origins lie along a single vertical line, with successive envelopes tangent to one another.

# Spacing/envelopes

strutR2 :: (Backend b R2, Monoid' m) => R2 -> QDiagram b R2 m Source

`strutR2 v`

is a two-dimensional diagram which produces no
output, but with respect to alignment, envelope, *and trace* acts
like a 1-dimensional segment oriented along the vector `v`

, with
local origin at its center. If you don't care about the trace
then there's no difference between `strutR2`

and the more general
`strut`

.

strutX :: (Backend b R2, Monoid' m) => Double -> QDiagram b R2 m Source

`strutX w`

is an empty diagram with width `w`

, height 0, and a
centered local origin. Note that `strutX (-w)`

behaves the same as
`strutX w`

.

strutY :: (Backend b R2, Monoid' m) => Double -> QDiagram b R2 m Source

`strutY h`

is an empty diagram with height `h`

, width 0, and a
centered local origin. Note that `strutY (-h)`

behaves the same as
`strutY h`

.

padX :: (Backend b R2, Monoid' m) => Double -> QDiagram b R2 m -> QDiagram b R2 m Source

`padX s`

"pads" a diagram in the x-direction, expanding its
envelope horizontally by a factor of `s`

(factors between 0 and 1
can be used to shrink the envelope). Note that the envelope will
expand with respect to the local origin, so if the origin is not
centered horizontally the padding may appear "uneven". If this
is not desired, the origin can be centered (using `centerX`

)
before applying `padX`

.

padY :: (Backend b R2, Monoid' m) => Double -> QDiagram b R2 m -> QDiagram b R2 m Source

`padY s`

"pads" a diagram in the y-direction, expanding its
envelope vertically by a factor of `s`

(factors between
0 and 1 can be used to shrink the envelope). Note that
the envelope will expand with respect to the local origin,
so if the origin is not centered vertically the padding may appear
"uneven". If this is not desired, the origin can be centered
(using `centerY`

) before applying `padY`

.

extrudeLeft :: Monoid' m => Double -> QDiagram b R2 m -> QDiagram b R2 m Source

`extrudeLeft s`

"extrudes" a diagram in the negative x-direction,
offsetting its envelope by the provided distance. When ` s < 0 `

,
the envelope is inset instead.

See the documentation for `extrudeEnvelope`

for more information.

extrudeRight :: Monoid' m => Double -> QDiagram b R2 m -> QDiagram b R2 m Source

`extrudeRight s`

"extrudes" a diagram in the positive x-direction,
offsetting its envelope by the provided distance. When ` s < 0 `

,
the envelope is inset instead.

See the documentation for `extrudeEnvelope`

for more information.

extrudeBottom :: Monoid' m => Double -> QDiagram b R2 m -> QDiagram b R2 m Source

`extrudeBottom s`

"extrudes" a diagram in the negative y-direction,
offsetting its envelope by the provided distance. When ` s < 0 `

,
the envelope is inset instead.

See the documentation for `extrudeEnvelope`

for more information.

extrudeTop :: Monoid' m => Double -> QDiagram b R2 m -> QDiagram b R2 m Source

`extrudeTop s`

"extrudes" a diagram in the positive y-direction,
offsetting its envelope by the provided distance. When ` s < 0 `

,
the envelope is inset instead.

See the documentation for `extrudeEnvelope`

for more information.

view :: (Backend b R2, Monoid' m) => P2 -> R2 -> QDiagram b R2 m -> QDiagram b R2 m Source

`view p v`

sets the envelope of a diagram to a rectangle whose
lower-left corner is at `p`

and whose upper-right corner is at ```
p
.+^ v
```

. Useful for selecting the rectangular portion of a
diagram which should actually be "viewed" in the final render,
if you don't want to see the entire diagram.