Safe Haskell | None |
---|---|
Language | Haskell2010 |
Graphics.Rasterific.Outline
Description
This module provide helper functions to create outline of shapes.
- type StrokeWidth = Float
- strokize :: Geometry geom => StrokeWidth -> Join -> (Cap, Cap) -> geom -> [Primitive]
- dashedStrokize :: Geometry geom => Float -> DashPattern -> StrokeWidth -> Join -> (Cap, Cap) -> geom -> [[Primitive]]
- approximatePathLength :: Path -> Float
Documentation
type StrokeWidth = Float #
Type alias just to get more meaningful type signatures
Arguments
:: Geometry geom | |
=> StrokeWidth | Stroke width |
-> Join | Which kind of join will be used |
-> (Cap, Cap) | Start and end capping. |
-> geom | List of elements to strokize |
-> [Primitive] |
This function will create the outline of a given geometry given a path. You can then stroke it.
stroke 3 (JoinMiter 0) (CapStraight 0, CapStraight 0) $ strokize 40 JoinRound (CapRound, CapRound) $ CubicBezier (V2 40 160) (V2 40 40) (V2 160 40) (V2 160 160)
Arguments
:: Geometry geom | |
=> Float | Starting offset |
-> DashPattern | Dashing pattern to use for stroking |
-> StrokeWidth | Stroke width |
-> Join | Which kind of join will be used |
-> (Cap, Cap) | Start and end capping. |
-> geom | Elements to transform |
-> [[Primitive]] |
Create a list of outlines corresponding to all the dashed elements. They can be then stroked
mapM_ (stroke 3 (JoinMiter 0) (CapStraight 0, CapStraight 0)) $ dashedStrokize 0 [10, 5] 40 JoinRound (CapStraight 0, CapStraight 0) $ CubicBezier (V2 40 160) (V2 40 40) (V2 160 40) (V2 160 160)
approximatePathLength :: Path -> Float #
Return an approximation of the length of a given path. It's results is not precise but should be enough for rough calculations