Safe Haskell | None |
---|---|
Language | Haskell2010 |
A module for creating collections of homogenous shape types, optimizing shapes (combining paths when possible or removing duplicates), applying transformations to all of them, and rendering them as SVG elements.
Synopsis
- newtype Group shape = Group [shape]
- toLayer :: (Show a, SvgShape a, Transformable a) => String -> Group a -> Layer
- toList :: (Show a, SvgShape a, Transformable a) => Group a -> [a]
- size :: Group a -> Int
- translateOverPoints :: Transformable s => [Point] -> s -> Group s
- translateGroupOverPoints :: (Show a, SvgShape a, Transformable a, Mergable a) => [Point] -> Group a -> Group a
- deduplicate :: (Ord t, ApproxEq t) => Group t -> Group t
- transformAndAppend :: (Show a, SvgShape a, Transformable a, Mergable a) => (a -> a) -> Group a -> Group a
- optimizeGroup :: Mergable a => Group a -> Float -> Group a
- optimizeGroupAndLog :: Mergable a => Group a -> Float -> IO (Group a)
- toSvgN :: SvgShape s => Group s -> Svg
- toSvgWithStyle :: SvgShape s => Group s -> StyleAttrs -> Svg
Documentation
A type reprresenting a named group of some type of shape.
Group [shape] |
Instances
Functor Group Source # | A group can be mapped over just like any other container. |
Applicative Group Source # | |
Show a => Show (Group a) Source # | |
(Show a, SvgShape a, Transformable a, Mergable a) => Semigroup (Group a) Source # | Groups can be combined. |
(Show a, SvgShape a, Transformable a, Mergable a) => Monoid (Group a) Source # | There exists an identity element for any group. |
Transformable a => Transformable (Group a) Source # | Groups can be transformed in the same way single shapes can. |
toLayer :: (Show a, SvgShape a, Transformable a) => String -> Group a -> Layer Source #
Convert a group to a layer.
toList :: (Show a, SvgShape a, Transformable a) => Group a -> [a] Source #
Convert a group to a list of shapes.
translateOverPoints :: Transformable s => [Point] -> s -> Group s Source #
Clone a shape over a series of points, returning a group of the translated objects.
translateGroupOverPoints :: (Show a, SvgShape a, Transformable a, Mergable a) => [Point] -> Group a -> Group a Source #
Clone a shape over a series of points, returning a group of the translated objects.
deduplicate :: (Ord t, ApproxEq t) => Group t -> Group t Source #
Remove any duplicate shapes from this group
transformAndAppend :: (Show a, SvgShape a, Transformable a, Mergable a) => (a -> a) -> Group a -> Group a Source #
optimizeGroup :: Mergable a => Group a -> Float -> Group a Source #
Produce a new group where all shapes that can be merged have been, plus all shapes that couldn't be.
optimizeGroupAndLog :: Mergable a => Group a -> Float -> IO (Group a) Source #
Produce a new group where all shapes that can be merged have been, plus all shapes that couldn't be, logging the result at the end.
toSvgN :: SvgShape s => Group s -> Svg Source #
Wrap a group of shapes into an SVG g element, including a comment with the name of the group.
toSvgWithStyle :: SvgShape s => Group s -> StyleAttrs -> Svg Source #
Wrap a group of shapes into an SVG g element, including a comment with the name of the group. Apply the given styles to the group.