33{-# LANGUAGE ExistentialQuantification #-}
44{-# LANGUAGE NamedFieldPuns #-}
55{-# LANGUAGE RankNTypes #-}
6- {-# LANGUAGE TemplateHaskell #-}
76
87-- | Transforms an image into rows of operations.
98module Graphics.Vty.PictureToSpans
@@ -19,7 +18,6 @@ import Graphics.Vty.Span
1918
2019import Lens.Micro
2120import Lens.Micro.Mtl
22- import Lens.Micro.TH
2321import Control.Monad
2422import Control.Monad.Reader
2523import Control.Monad.State.Strict hiding ( state )
@@ -55,14 +53,34 @@ data BlitState = BlitState
5553 , _remainingRows :: Int
5654 }
5755
58- makeLenses ''BlitState
56+ columnOffset :: Lens' BlitState Int
57+ columnOffset = lens _columnOffset (\ e v -> e { _columnOffset = v })
58+
59+ rowOffset :: Lens' BlitState Int
60+ rowOffset = lens _rowOffset (\ e v -> e { _rowOffset = v })
61+
62+ skipColumns :: Lens' BlitState Int
63+ skipColumns = lens _skipColumns (\ e v -> e { _skipColumns = v })
64+
65+ skipRows :: Lens' BlitState Int
66+ skipRows = lens _skipRows (\ e v -> e { _skipRows = v })
67+
68+ remainingColumns :: Lens' BlitState Int
69+ remainingColumns = lens _remainingColumns (\ e v -> e { _remainingColumns = v })
70+
71+ remainingRows :: Lens' BlitState Int
72+ remainingRows = lens _remainingRows (\ e v -> e { _remainingRows = v })
5973
6074data BlitEnv s = BlitEnv
6175 { _region :: DisplayRegion
6276 , _mrowOps :: MRowOps s
6377 }
6478
65- makeLenses ''BlitEnv
79+ region :: Lens' (BlitEnv s ) DisplayRegion
80+ region = lens _region (\ e r -> e { _region = r })
81+
82+ mrowOps :: Lens' (BlitEnv s ) (MRowOps s )
83+ mrowOps = lens _mrowOps (\ e r -> e { _mrowOps = r })
6684
6785type BlitM s a = ReaderT (BlitEnv s ) (StateT BlitState (ST s )) a
6886
0 commit comments