Copyright | (c) 2013-2015 diagrams-core team (see LICENSE) |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | diagrams-discuss@googlegroups.com |
Safe Haskell | None |
Language | Haskell2010 |
This module provides tools for compiling QDiagrams
into a more
convenient and optimized tree form, suitable for use by backends.
- data RNode b v n a
- type RTree b v n a = Tree (RNode b v n a)
- toRTree :: (HasLinearMap v, Metric v, Typeable v, Typeable n, OrderedField n, Monoid m, Semigroup m) => Transformation v n -> QDiagram b v n m -> RTree b v n Annotation
- renderDia :: (Backend b v n, HasLinearMap v, Metric v, Typeable v, Typeable n, OrderedField n, Monoid' m) => b -> Options b v n -> QDiagram b v n m -> Result b v n
- renderDiaT :: (Backend b v n, HasLinearMap v, Metric v, Typeable v, Typeable n, OrderedField n, Monoid' m) => b -> Options b v n -> QDiagram b v n m -> (Transformation v n, Result b v n)
- toDTree :: (HasLinearMap v, Floating n, Typeable n) => n -> n -> QDiagram b v n m -> Maybe (DTree b v n Annotation)
- fromDTree :: forall b v n. (Floating n, HasLinearMap v) => DTree b v n Annotation -> RTree b v n Annotation
Tools for backends
toRTree :: (HasLinearMap v, Metric v, Typeable v, Typeable n, OrderedField n, Monoid m, Semigroup m) => Transformation v n -> QDiagram b v n m -> RTree b v n Annotation Source
Compile a QDiagram
into an RTree
, rewriting styles with the
given function along the way. Suitable for use by backends when
implementing renderData
. The first argument is the
transformation used to convert the diagram from local to output
units.
Backend API
renderDia :: (Backend b v n, HasLinearMap v, Metric v, Typeable v, Typeable n, OrderedField n, Monoid' m) => b -> Options b v n -> QDiagram b v n m -> Result b v n Source
Render a diagram.
renderDiaT :: (Backend b v n, HasLinearMap v, Metric v, Typeable v, Typeable n, OrderedField n, Monoid' m) => b -> Options b v n -> QDiagram b v n m -> (Transformation v n, Result b v n) Source
Render a diagram, returning also the transformation which was
used to convert the diagram from its ("global") coordinate
system into the output coordinate system. The inverse of this
transformation can be used, for example, to convert output/screen
coordinates back into diagram coordinates. See also adjustDia
.
Internals
toDTree :: (HasLinearMap v, Floating n, Typeable n) => n -> n -> QDiagram b v n m -> Maybe (DTree b v n Annotation) Source
Convert a QDiagram
into a raw tree.
fromDTree :: forall b v n. (Floating n, HasLinearMap v) => DTree b v n Annotation -> RTree b v n Annotation Source
Convert a DTree
to an RTree
which can be used dirctly by backends.
A DTree
includes nodes of type DTransform (Transformation v)
;
in the RTree
transform is pushed down until it reaches a primitive node.