cnc-pattern-lib-0.1.0.0: Haskell library for creating SVG patterns for CNC routers

Safe HaskellNone
LanguageHaskell2010

Layer

Description

A module for creating collections of heterogenous shape types with uniform styling and rendering them as SVG elements.

Synopsis

Documentation

data ShapeLike Source #

We use an existential type to wrap anything that meets our defintition of a shape. That is to say it can be shown, can be transformed according to methods in the Transformable typeclass, and can be converted to an SVG element. This includes arcs, circles, lines, and rectangles. Heterogenous shapes can all be placed in a single list and transformed via this type.

Instances
Eq ShapeLike Source # 
Instance details

Defined in Layer

Show ShapeLike Source # 
Instance details

Defined in Layer

Transformable ShapeLike Source # 
Instance details

Defined in Layer

SvgShape ShapeLike Source # 
Instance details

Defined in Layer

Methods

toSvg :: ShapeLike -> Svg Source #

SvgShape [ShapeLike] Source # 
Instance details

Defined in Layer

Methods

toSvg :: [ShapeLike] -> Svg Source #

pattern MkShape :: a -> ShapeLike Source #

data Layer Source #

A layer is just a sequence of shape-like things with a name and style

Instances
Eq Layer Source # 
Instance details

Defined in Layer

Methods

(==) :: Layer -> Layer -> Bool #

(/=) :: Layer -> Layer -> Bool #

Show Layer Source # 
Instance details

Defined in Layer

Methods

showsPrec :: Int -> Layer -> ShowS #

show :: Layer -> String #

showList :: [Layer] -> ShowS #

Semigroup Layer Source #

Layers can be combined.

Instance details

Defined in Layer

Methods

(<>) :: Layer -> Layer -> Layer #

sconcat :: NonEmpty Layer -> Layer #

stimes :: Integral b => b -> Layer -> Layer #

Monoid Layer Source #

There exists an identity element for any layer.

Instance details

Defined in Layer

Methods

mempty :: Layer #

mappend :: Layer -> Layer -> Layer #

mconcat :: [Layer] -> Layer #

SvgShape Layer Source # 
Instance details

Defined in Layer

Methods

toSvg :: Layer -> Svg Source #

mkLayer :: (Show a, SvgShape a, Transformable a) => String -> [a] -> Layer Source #

Layer constructor from a list of shapes: without style

mkLayerWithStyle :: (Show a, SvgShape a, Transformable a) => String -> [a] -> StyleAttrs -> Layer Source #

Layer constructor from a list of shapes: with style

pack :: (Show a, SvgShape a, Transformable a) => a -> ShapeLike Source #

A constructor to create a shape-like object from any shape.

(+:) :: (Show a, SvgShape a, Transformable a) => a -> Layer -> Layer infixr 5 Source #

Cons operation on a layer:

layer = mkLayer "layer-1" [shape1, shape3, shape3]
newlayer = shape+: layer