Safe Haskell | None |
---|---|
Language | Haskell2010 |
Transforms an image into rows of operations.
- type MRowOps s = MVector s SpanOps
- type MSpanOps s = MVector s SpanOp
- data BlitState = BlitState {
- _columnOffset :: Int
- _rowOffset :: Int
- _skipColumns :: Int
- _skipRows :: Int
- _remainingColumns :: Int
- _remainingRows :: Int
- skipRows :: Lens' BlitState Int
- skipColumns :: Lens' BlitState Int
- rowOffset :: Lens' BlitState Int
- remainingRows :: Lens' BlitState Int
- remainingColumns :: Lens' BlitState Int
- columnOffset :: Lens' BlitState Int
- data BlitEnv s = BlitEnv {
- _region :: DisplayRegion
- _mrowOps :: MRowOps s
- region :: forall s. Lens' (BlitEnv s) DisplayRegion
- mrowOps :: forall s s. Lens (BlitEnv s) (BlitEnv s) (MRowOps s) (MRowOps s)
- type BlitM s a = ReaderT (BlitEnv s) (StateT BlitState (ST s)) a
- displayOpsForPic :: Picture -> DisplayRegion -> DisplayOps
- displayOpsForImage :: Image -> DisplayOps
- combinedOpsForLayers :: Picture -> DisplayRegion -> ST s (MRowOps s)
- substituteSkips :: Background -> MRowOps s -> ST s (MRowOps s)
- mergeUnder :: MRowOps s -> MRowOps s -> ST s (MRowOps s)
- mergeRowUnder :: SpanOps -> SpanOps -> SpanOps
- swapSkipsForSingleColumnCharSpan :: Char -> Attr -> SpanOps -> SpanOps
- swapSkipsForCharSpan :: Int -> Char -> Attr -> SpanOps -> SpanOps
- buildSpans :: Image -> DisplayRegion -> ST s (MRowOps s)
- startImageBuild :: Image -> BlitM s ()
- isOutOfBounds :: Image -> BlitState -> Bool
- addMaybeClipped :: forall s. Image -> BlitM s ()
- addMaybeClippedJoin :: forall s. String -> Lens BlitState BlitState Int Int -> Lens BlitState BlitState Int Int -> Lens BlitState BlitState Int Int -> Int -> Image -> Image -> Int -> BlitM s ()
- addUnclippedText :: Attr -> DisplayText -> BlitM s ()
- addRowCompletion :: DisplayRegion -> Int -> BlitM s ()
- snocOp :: SpanOp -> Int -> BlitM s ()
Documentation
BlitState | |
|
region :: forall s. Lens' (BlitEnv s) DisplayRegion Source
displayOpsForPic :: Picture -> DisplayRegion -> DisplayOps Source
Produces the span ops that will render the given picture, possibly cropped or padded, into the specified region.
displayOpsForImage :: Image -> DisplayOps Source
Returns the DisplayOps for an image rendered to a window the size of the image.
largerly used only for debugging.
combinedOpsForLayers :: Picture -> DisplayRegion -> ST s (MRowOps s) Source
Produces the span ops for each layer then combines them.
TODO: a fold over a builder function. start with span ops that are a bg fill of the entire region.
substituteSkips :: Background -> MRowOps s -> ST s (MRowOps s) Source
mergeRowUnder :: SpanOps -> SpanOps -> SpanOps Source
buildSpans :: Image -> DisplayRegion -> ST s (MRowOps s) Source
Builds a vector of row operations that will output the given picture to the terminal.
Crops to the given display region.
todo I'm pretty sure there is an algorithm that does not require a mutable buffer.
startImageBuild :: Image -> BlitM s () Source
Add the operations required to build a given image to the current set of row operations returns the number of columns and rows contributed to the output.
isOutOfBounds :: Image -> BlitState -> Bool Source
addMaybeClipped :: forall s. Image -> BlitM s () Source
This adds an image that might be partially clipped to the output ops.
This is a very touchy algorithm. Too touchy. For instance, the CropRight and CropBottom implementations are odd. They pass the current tests but something seems terribly wrong about all this.
todo prove this cannot be called in an out of bounds case.
addMaybeClippedJoin :: forall s. String -> Lens BlitState BlitState Int Int -> Lens BlitState BlitState Int Int -> Lens BlitState BlitState Int Int -> Int -> Image -> Image -> Int -> BlitM s () Source
addUnclippedText :: Attr -> DisplayText -> BlitM s () Source
addRowCompletion :: DisplayRegion -> Int -> BlitM s () Source