vty-5.11.3: A simple terminal UI library

Safe HaskellNone
LanguageHaskell2010

Graphics.Vty.PictureToSpans

Description

Transforms an image into rows of operations.

Synopsis

Documentation

data BlitEnv s Source #

Constructors

BlitEnv 

mrowOps :: forall s s. Lens (BlitEnv s) (BlitEnv s) (MRowOps s) (MRowOps s) Source #

type BlitM s a = ReaderT (BlitEnv s) (StateT BlitState (ST s)) a 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.

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.

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.

snocOp :: SpanOp -> Int -> BlitM s () Source #

snocs the operation to the operations for the given row.

(-~) :: Num a => ASetter s t a a -> a -> s -> t Source #

(+~) :: Num a => ASetter s t a a -> a -> s -> t Source #