Rasterific-0.3: A pure haskell drawing engine.

Safe HaskellSafe-Inferred

Graphics.Rasterific.Outline

Description

This module provide helper functions to create outline of shapes.

Synopsis

Documentation

strokizeSource

Arguments

:: StrokeWidth

Stroke width

-> Join

Which kind of join will be used

-> (Cap, Cap)

Start and end capping.

-> [Primitive]

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)
       [CubicBezierPrim $
            CubicBezier (V2  40 160) (V2 40   40)
                        (V2 160  40) (V2 160 160)]

dashedStrokizeSource

Arguments

:: 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.

-> [Primitive]

List of 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)
       [CubicBezierPrim $
            CubicBezier (V2  40 160) (V2 40   40)
                        (V2 160  40) (V2 160 160)]