algebra-driven-design-0.1.0.1: Companion library for the book Algebra-Driven Design by Sandy Maguire
Safe HaskellNone
LanguageHaskell2010

ADD.Tiles.Basic

Synopsis

Tiles and their observations

data Tile Source #

Instances

Instances details
Show Tile Source # 
Instance details

Defined in ADD.Tiles.Basic

Methods

showsPrec :: Int -> Tile -> ShowS #

show :: Tile -> String #

showList :: [Tile] -> ShowS #

Semigroup Tile Source # 
Instance details

Defined in ADD.Tiles.Basic

Methods

(<>) :: Tile -> Tile -> Tile #

sconcat :: NonEmpty Tile -> Tile #

stimes :: Integral b => b -> Tile -> Tile #

Monoid Tile Source # 
Instance details

Defined in ADD.Tiles.Basic

Methods

mempty :: Tile #

mappend :: Tile -> Tile -> Tile #

mconcat :: [Tile] -> Tile #

Arbitrary Tile Source # 
Instance details

Defined in ADD.Tiles.Basic

Methods

arbitrary :: Gen Tile #

shrink :: Tile -> [Tile] #

rasterize Source #

Arguments

:: Int

resulting width

-> Int

resulting heigeht

-> Tile 
-> Compose ZipList ZipList Color

the resulting "pixels" in row-major order

Rasterize a Tile down into a row-major representation of its constituent "pixels". For a version that emits a list of lists directly, see rasterize'.

rasterize' Source #

Arguments

:: Int

resulting width

-> Int

resulting heigeht

-> Tile 
-> [[Color]]

the resulting "pixels" in row-major order

Like rasterize, but with a more convenient output type.

toImage Source #

Arguments

:: Int

resulting width

-> Int

resulting height

-> Tile 
-> Image PixelRGBA8 

Like rasterize, but into a format that can be directly saved to disk as an image.

Tile constructors

empty :: Tile Source #

The empty, fully transparent Tile.

cw :: Tile -> Tile Source #

Rotate a Tile clockwise.

ccw :: Tile -> Tile Source #

Rotate a Tile counterclockwise.

flipH :: Tile -> Tile Source #

Mirror a Tile horizontally.

flipV :: Tile -> Tile Source #

Mirror a Tile vertically.

beside :: Tile -> Tile -> Tile Source #

Place the first Tile to the left of the second. Each Tile will receive half of the available width, but keep their full height.

rows :: [Tile] -> Tile Source #

Like above, but repeated. Every element in the list will take up a proportional height of the resulting Tile.

above :: Tile -> Tile -> Tile Source #

Place the first Tile above the second. Each Tile will receive half of the available height, but keep their full width.

cols :: [Tile] -> Tile Source #

Like beside, but repeated. Every element in the list will take up a proportional width of the resulting Tile.

behind :: Tile -> Tile -> Tile Source #

Place the first Tile behind the second. The result of this operation is for transparent or semi-transparent pixels in the second argument to be blended via over with those in the first.

quad :: Tile -> Tile -> Tile -> Tile -> Tile Source #

Place four Tiles in the four quadrants. The first argument is the top-left; the second is the top-right; third: bottom left; fourth: bottom right.

swirl :: Tile -> Tile Source #

A quad where the given Tile is rotated via cw once more per quadrant.

nona :: Tile -> Tile -> Tile -> Tile Source #

Puts a frame around a Tile. The first argument is the straight-edge border for the top of the frame. The second argument should be for the top-right corner. The third argument is the Tile that should be framed.

Special tiles

haskell :: Tile Source #

The Haskell logo.

sandy :: Tile Source #

Sandy.

Colors and their observations

redChannel :: Color -> Double Source #

Extract the red channel from a Color.

greenChannel :: Color -> Double Source #

Extract the green channel from a Color.

blueChannel :: Color -> Double Source #

Extract the blue channel from a Color.

alphaChannel :: Color -> Double Source #

Extract the alpha channel from a Color.

Color constructors

pattern Color :: Double -> Double -> Double -> Double -> Color Source #

 

invert :: Color -> Color Source #

Inverts a Color by negating each of its color channels, but leaving the alpha alone.

mask :: Color -> Color -> Color Source #

Copy the alpha channel from the first Color and the color channels from the second Color.

over :: Color -> Color -> Color Source #

Blends a Color using standard alpha compositing.

Orphan instances

Semigroup Color Source # 
Instance details

Methods

(<>) :: Color -> Color -> Color #

sconcat :: NonEmpty Color -> Color #

stimes :: Integral b => b -> Color -> Color #

Monoid Color Source # 
Instance details

Methods

mempty :: Color #

mappend :: Color -> Color -> Color #

mconcat :: [Color] -> Color #

Arbitrary PixelRGBA8 Source # 
Instance details

CoArbitrary PixelRGBA8 Source # 
Instance details

Methods

coarbitrary :: PixelRGBA8 -> Gen b -> Gen b #