-- | This module provide helper functions to create outline

-- of  shapes.

module Graphics.Rasterific.Outline
    ( StrokeWidth
    , strokize
    , S.dashedStrokize 
    , S.approximatePathLength
    ) where

import Graphics.Rasterific.Types
import qualified Graphics.Rasterific.StrokeInternal as S

-- | 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)

--

-- <<docimages/strokize_path.png>>

--

strokize :: 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]
strokize :: StrokeWidth -> Join -> (Cap, Cap) -> geom -> [Primitive]
strokize StrokeWidth
w Join
j (Cap, Cap)
c = Container Primitive -> [Primitive]
forall a. Container a -> [a]
listOfContainer (Container Primitive -> [Primitive])
-> (geom -> Container Primitive) -> geom -> [Primitive]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. StrokeWidth -> Join -> (Cap, Cap) -> geom -> Container Primitive
forall geom.
Geometry geom =>
StrokeWidth -> Join -> (Cap, Cap) -> geom -> Container Primitive
S.strokize StrokeWidth
w Join
j (Cap, Cap)
c