diagrams-pgf-1.4: PGF backend for diagrams drawing EDSL.

Copyright(c) 2015 Christopher Chalmers
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

Graphics.Rendering.PGF

Contents

Description

Interface to PGF. See the manual http://www.ctan.org/pkg/pgf for details.

Synopsis

Documentation

type RenderM n m = RWS RenderInfo Builder (RenderState n) m Source #

Type for render monad.

type Render n = RenderM n () Source #

Convenient type for building.

initialState :: (Typeable n, Floating n) => RenderState n Source #

Starting state for running the builder.

Environments

scope :: Render n -> Render n Source #

Wrap the rendering in a scope.

epsilon :: Fractional n => n Source #

ε = 0.0001 is the limit at which lines are no longer stroked.

Lenses

style :: forall n. Lens' (RenderState n) (Style V2 n) Source #

units

bp :: RealFloat a => a -> Render n Source #

Render n length with bp (big point = 1 px at 72 dpi) units.

pt :: RealFloat a => a -> Render n Source #

Render n length with pt units.

mm :: RealFloat a => a -> Render n Source #

Render n length with mm units.

px :: RealFloat a => a -> Render n Source #

Render n length with px units.

RenderM commands

ln :: Render n -> Render n Source #

bracers :: Render n -> Render n Source #

Wrap a `Render n` in { .. }.

brackets :: Render n -> Render n Source #

Wrap a `Render n` in [ .. ].

Paths

usePath :: Bool -> Bool -> Render n Source #

usePath fill stroke combined in one function.

lineTo :: RealFloat n => V2 n -> Render n Source #

Move path by vector.

curveTo :: RealFloat n => V2 n -> V2 n -> V2 n -> Render n Source #

Make curved path from vectors.

moveTo :: RealFloat n => P2 n -> Render n Source #

Move path to point.

closePath :: Render n Source #

Close the current path.

clip :: Render n Source #

Use the defined path a clip for everything that follows in the current scope. Stacks.

stroke :: Render n Source #

Stroke the defined path using parameters from current scope.

fill :: Render n Source #

Fill the defined path using parameters from current scope.

asBoundingBox :: Render n Source #

Uses the current path as the bounding box for whole picture.

Strokeing Options

setDash :: RealFloat n => Dashing n -> Render n Source #

Sets the dash for the current scope. Must be done before stroking.

setLineWidth :: RealFloat n => n -> Render n Source #

Sets the line width in current scope. Must be done before stroking.

setLineCap :: LineCap -> Render n Source #

Sets the line cap in current scope. Must be done before stroking.

setLineJoin :: LineJoin -> Render n Source #

Sets the line join in current scope. Must be done before stroking.

setMiterLimit :: RealFloat n => n -> Render n Source #

Sets the miter limit in the current scope. Must be done before stroking.

setLineColor :: (RealFloat a, Color c) => c -> Render a Source #

Sets the stroke colour in current scope. If colour has opacity < 1, the scope opacity is set accordingly. Must be done before stroking.

setLineOpacity :: RealFloat n => n -> Render n Source #

Sets the stroke opacity for the current scope. Should be a value between 0 and 1. Must be done before stroking.

Fill Options

setFillColor :: Color c => c -> Render n Source #

Sets the fill colour for current scope. If an alpha colour is used, the fill opacity is set accordingly. Must be done before filling.

setFillRule :: FillRule -> Render n Source #

Set the fill rule to winding or even-odd for current scope. Must be done before filling.

setFillOpacity :: RealFloat a => a -> Render n Source #

Sets the stroke opacity for the current scope. Should be a value between 0 and 1. Must be done before stroking.

Transformations

setTransform :: RealFloat n => Transformation V2 n -> Render n Source #

Resets the transform and sets it. Must be set before the path is used.

applyTransform :: RealFloat n => Transformation V2 n -> Render n Source #

Applies a transformation to the current scope. This transformation only effects coordinates and text, not line withs or dash spacing. (See applyDeepTransform). Must be set before the path is used.

baseTransform :: RealFloat n => Transformation V2 n -> Render n Source #

Base transforms are applied by the document reader.

Shading

images

image :: RealFloat n => DImage n External -> Render n Source #

Images are wraped in a pgftext.

Text

setTextAlign :: RealFloat n => TextAlignment n -> [Render n] Source #

Returns a list of values to be put in square brackets like pgftext[left,top]{txt}.

setFontWeight :: FontWeight -> Render n Source #

Set the font weight by rendering bf . Nothing is done for normal weight.

setFontSlant :: FontSlant -> Render n Source #

Set the font slant by rendering bf . Nothing is done for normal weight.