Refactor modules
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{- Transform a picture into renderable objects. -}
|
||||
module Picture.Tree
|
||||
( picToLTree
|
||||
, picToLTree'
|
||||
, picToFTree
|
||||
, picToRenderList
|
||||
, picToAlt
|
||||
@@ -10,6 +11,8 @@ module Picture.Tree
|
||||
import Picture.Data
|
||||
import Geometry
|
||||
import Geometry.Data
|
||||
--import StrictHelp
|
||||
import Control.DeepSeq
|
||||
|
||||
import Data.Bifunctor
|
||||
import Data.List
|
||||
@@ -17,6 +20,12 @@ import qualified Data.DList as DL
|
||||
import Control.Applicative
|
||||
--import Data.Maybe (isNothing)
|
||||
|
||||
picToLTree'
|
||||
:: Maybe Int -- ^ Layer filter. Draw 'Nothing' when value is the same as at the leaf.
|
||||
-> Picture
|
||||
-> LTree RenderType
|
||||
picToLTree' x p = rnf (picToLTree x p) `seq` picToLTree x p
|
||||
|
||||
-- todo: refactor out the layer check somehow
|
||||
-- consider generalising to alternative rather than using LTree
|
||||
-- | Transform a picture into a tree of renderable objects
|
||||
@@ -58,6 +67,7 @@ picToLTree _ (ThickArc startA endA rad wdth) = LLeaf $ RenderArc
|
||||
picToLTree _ (Text s) = LLeaf $ RenderText $ stringToList s
|
||||
picToLTree _ Blank = LBranches []
|
||||
picToLTree j (Pictures pics) = LBranches $ map (picToLTree j) pics
|
||||
--picToLTree j (Pictures pics) = LBranches . forceFoldable $ map (picToLTree j) pics
|
||||
picToLTree j (OverPic f f' (OverPic g g' pic)) = picToLTree j $ OverPic (f . g) (f' . g') pic
|
||||
picToLTree j (OverPic f f' (Pictures ps)) = LBranches (map (picToLTree j . OverPic f f') ps)
|
||||
picToLTree j (OverPic f f' pic) = overPos f . overCol f' <$> picToLTree j pic
|
||||
|
||||
Reference in New Issue
Block a user