craftwerk-0.1: 2D graphics library with integrated TikZ output.

MaintainerMalte Harder <malte.harder@gmail.com>

Graphics.Craftwerk.Core.Style

Contents

Description

Styles in craftwerk are nodes in the figure tree and the style at the node is applied to all subnodes. If a field of a style is empty (i.e its value is Nothing) the value of the next parent style node is applied.

Synopsis

Data types

data LineCap Source

Constructors

CapRect 
CapButt 
CapRound 

Instances

data ArrowTip Source

Constructors

TipNone 
TipDefault 

Instances

Named styles

emptyStyle :: StylePropertiesSource

A style where no property has been set.

newStyle :: StylePropertiesSource

Alias for empty style, makes style construction nicer.

defaultStyle :: StylePropertiesSource

The default style used at the root node of any Figure.

Property values

yes :: Maybe BoolSource

Alias for 'Just True' to make style specification more convenient.

no :: Maybe BoolSource

Alias for 'Just False' to make style specification more convenient.

rgb :: Double -> Double -> Double -> Maybe FigureColorSource

Make a rgb color property.

thin :: Maybe DoubleSource

Width 0.4.

thick :: Maybe DoubleSource

Width 0.8.

Property access and merging

getProperty :: StyleProperties -> (StyleProperties -> Maybe a) -> aSource

Read a property from a style property record returning the value of the default style if the value is Nothing.

mergeProperties :: StyleProperties -> StyleProperties -> StylePropertiesSource

Merge two property records, where the second argument overwrites fields of the first unless a field is Nothing.

Arrow functions

arrow :: (ArrowDummy -> ArrowTips) -> Maybe ArrowTipsSource

Arrow tip styles can be specified by using the notation 'arrow (<==)'

(<=>) :: ArrowDummy -> ArrowTipsSource

(===) :: ArrowDummy -> ArrowTipsSource

(==>) :: ArrowDummy -> ArrowTipsSource

(<==) :: ArrowDummy -> ArrowTipsSource