diagrams-contrib-1.1.1.2: Collection of user contributions to diagrams EDSL

Copyright(c) 2012 Michael Sloan
LicenseBSD-style (see the LICENSE file)
MaintainerMichael Sloan <mgsloan at gmail>
Safe HaskellNone
LanguageHaskell2010

Diagrams.Layout.Wrap

Description

An algorithm for filling space in a fashion akin to word-wrapping.

Synopsis

Documentation

wrapDiagram :: (HasLinearMap v, InnerSpace v, OrderedField (Scalar v)) => ([(v, Diagram b v)], [Diagram b v]) -> Diagram b v Source

wrapDiagram post-processes the results of wrapOutside / wrapInside into a Diagram of the result. This only works when applying them to a list of diagrams.

wrapOutside :: (Enveloped a, v ~ V a, InnerSpace v, OrderedField (Scalar v)) => (Point v -> Bool) -> [v] -> Point v -> [a] -> ([(v, a)], [a]) Source

wrapOutside is the same as wrapInside, but with an inverted predicate.

wrapInside :: forall a v. (Enveloped a, v ~ V a, InnerSpace v, OrderedField (Scalar v)) => (Point v -> Bool) -> [v] -> Point v -> [a] -> ([(v, a)], [a]) Source

fillInside greedily wraps content to fill a space defined by a predicate. It is passed a list of vectors which express the order of dimensions to be filled. In other words, wrapping RTL text is done by passing in [unitX, unitY], to first exhaust space horizontally, and then vertically.

Note that this function does not guarantee that there are not points inside each positioned item for which the predicate is False. Instead, only the corners of the bounds, along each axii, are used.