| Copyright | (c) 2013 diagrams-core team (see LICENSE) |
|---|---|
| License | BSD-style (see LICENSE) |
| Maintainer | [email protected] |
| Safe Haskell | None |
| Language | Haskell2010 |
Diagrams.Core.Compile
Description
This module provides tools for compiling QDiagrams into a more
convenient and optimized tree form, suitable for use by backends.
- data RNode b v a
- type RTree b v a = Tree (RNode b v a)
- toRTree :: (HasLinearMap v, InnerSpace v, Data v, Data (Scalar v), OrderedField (Scalar v), Monoid m, Semigroup m) => Transformation v -> QDiagram b v m -> RTree b v Annotation
- renderDia :: (Backend b v, InnerSpace v, Data v, OrderedField (Scalar v), Data (Scalar v), Monoid' m) => b -> Options b v -> QDiagram b v m -> Result b v
- renderDiaT :: (Backend b v, HasLinearMap v, InnerSpace v, Data v, OrderedField (Scalar v), Data (Scalar v), Monoid' m) => b -> Options b v -> QDiagram b v m -> (Transformation v, Result b v)
- toDTree :: HasLinearMap v => Scalar v -> Scalar v -> QDiagram b v m -> Maybe (DTree b v Annotation)
- fromDTree :: HasLinearMap v => DTree b v Annotation -> RTree b v Annotation
- styleToOutput :: forall v. (Data v, Data (Scalar v), Num (Scalar v), Ord (Scalar v), Fractional (Scalar v)) => Scalar v -> Scalar v -> Style v -> Style v
- toOutput :: forall v. (Data v, Data (Scalar v), Num (Scalar v), Ord (Scalar v), Fractional (Scalar v)) => Scalar v -> Scalar v -> Measure v -> Measure v
Tools for backends
toRTree :: (HasLinearMap v, InnerSpace v, Data v, Data (Scalar v), OrderedField (Scalar v), Monoid m, Semigroup m) => Transformation v -> QDiagram b v m -> RTree b v 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, InnerSpace v, Data v, OrderedField (Scalar v), Data (Scalar v), Monoid' m) => b -> Options b v -> QDiagram b v m -> Result b v Source
Render a diagram.
renderDiaT :: (Backend b v, HasLinearMap v, InnerSpace v, Data v, OrderedField (Scalar v), Data (Scalar v), Monoid' m) => b -> Options b v -> QDiagram b v m -> (Transformation v, Result b v) 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 => Scalar v -> Scalar v -> QDiagram b v m -> Maybe (DTree b v Annotation) Source
Convert a QDiagram into a raw tree.
fromDTree :: HasLinearMap v => DTree b v Annotation -> RTree b v 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.
styleToOutput :: forall v. (Data v, Data (Scalar v), Num (Scalar v), Ord (Scalar v), Fractional (Scalar v)) => Scalar v -> Scalar v -> Style v -> Style v Source
Convert all Measure values to Output units. The arguments
are, respectively, the scaling factor from global units to output
units, and from normalized units to output units. It is assumed
that local units are identical to output units (which will be the
case if all transformations have been fully pushed down and
applied). Normalized units are based on a logical diagram size of
1 x 1.