advent-0.1.0.0: Advent of Code common library
Copyright(c) Eric Mertens 2018
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Advent.Visualize

Description

Thin wrapper around the JuicyPixels library to make it easy to generate small animations from solution files.

Synopsis

Documentation

data Image a #

Instances

Instances details
NFData (Image a) 
Instance details

Defined in Codec.Picture.Types

Methods

rnf :: Image a -> () #

(Eq (PixelBaseComponent a), Storable (PixelBaseComponent a)) => Eq (Image a) 
Instance details

Defined in Codec.Picture.Types

Methods

(==) :: Image a -> Image a -> Bool #

(/=) :: Image a -> Image a -> Bool #

data PixelRGB8 #

Constructors

PixelRGB8 !Pixel8 !Pixel8 !Pixel8 

Instances

Instances details
BmpEncodable PixelRGB8 
Instance details

Defined in Codec.Picture.Bitmap

PngPaletteSaveable PixelRGB8 
Instance details

Defined in Codec.Picture.Png.Internal.Export

PngSavable PixelRGB8 
Instance details

Defined in Codec.Picture.Png.Internal.Export

TgaSaveable PixelRGB8 
Instance details

Defined in Codec.Picture.Tga

TiffSaveable PixelRGB8 
Instance details

Defined in Codec.Picture.Tiff

Methods

colorSpaceOfPixel :: PixelRGB8 -> TiffColorspace

extraSampleCodeOfPixel :: PixelRGB8 -> Maybe ExtraSample

subSamplingInfo :: PixelRGB8 -> Vector Word32

sampleFormat :: PixelRGB8 -> [TiffSampleFormat]

LumaPlaneExtractable PixelRGB8 
Instance details

Defined in Codec.Picture.Types

Methods

computeLuma :: PixelRGB8 -> PixelBaseComponent PixelRGB8

extractLumaPlane :: Image PixelRGB8 -> Image (PixelBaseComponent PixelRGB8)

Pixel PixelRGB8 
Instance details

Defined in Codec.Picture.Types

Associated Types

type PixelBaseComponent PixelRGB8

Methods

mixWith :: (Int -> PixelBaseComponent PixelRGB8 -> PixelBaseComponent PixelRGB8 -> PixelBaseComponent PixelRGB8) -> PixelRGB8 -> PixelRGB8 -> PixelRGB8

mixWithAlpha :: (Int -> PixelBaseComponent PixelRGB8 -> PixelBaseComponent PixelRGB8 -> PixelBaseComponent PixelRGB8) -> (PixelBaseComponent PixelRGB8 -> PixelBaseComponent PixelRGB8 -> PixelBaseComponent PixelRGB8) -> PixelRGB8 -> PixelRGB8 -> PixelRGB8

pixelOpacity :: PixelRGB8 -> PixelBaseComponent PixelRGB8

componentCount :: PixelRGB8 -> Int

colorMap :: (PixelBaseComponent PixelRGB8 -> PixelBaseComponent PixelRGB8) -> PixelRGB8 -> PixelRGB8

pixelBaseIndex :: Image PixelRGB8 -> Int -> Int -> Int

mutablePixelBaseIndex :: MutableImage s PixelRGB8 -> Int -> Int -> Int

pixelAt :: Image PixelRGB8 -> Int -> Int -> PixelRGB8

readPixel :: PrimMonad m => MutableImage (PrimState m) PixelRGB8 -> Int -> Int -> m PixelRGB8

writePixel :: PrimMonad m => MutableImage (PrimState m) PixelRGB8 -> Int -> Int -> PixelRGB8 -> m ()

unsafePixelAt :: Vector (PixelBaseComponent PixelRGB8) -> Int -> PixelRGB8

unsafeReadPixel :: PrimMonad m => STVector (PrimState m) (PixelBaseComponent PixelRGB8) -> Int -> m PixelRGB8

unsafeWritePixel :: PrimMonad m => STVector (PrimState m) (PixelBaseComponent PixelRGB8) -> Int -> PixelRGB8 -> m ()

Show PixelRGB8 
Instance details

Defined in Codec.Picture.Types

Eq PixelRGB8 
Instance details

Defined in Codec.Picture.Types

Ord PixelRGB8 
Instance details

Defined in Codec.Picture.Types

Decimable PixelRGB16 PixelRGB8 
Instance details

Defined in Codec.Picture

Methods

decimateBitDepth :: Image PixelRGB16 -> Image PixelRGB8

Decimable PixelRGBF PixelRGB8 
Instance details

Defined in Codec.Picture

Methods

decimateBitDepth :: Image PixelRGBF -> Image PixelRGB8

ColorConvertible Pixel8 PixelRGB8 
Instance details

Defined in Codec.Picture.Types

Methods

promotePixel :: Pixel8 -> PixelRGB8

promoteImage :: Image Pixel8 -> Image PixelRGB8

ColorConvertible PixelRGB8 PixelRGB16 
Instance details

Defined in Codec.Picture.Types

Methods

promotePixel :: PixelRGB8 -> PixelRGB16

promoteImage :: Image PixelRGB8 -> Image PixelRGB16

ColorConvertible PixelRGB8 PixelRGBA16 
Instance details

Defined in Codec.Picture.Types

Methods

promotePixel :: PixelRGB8 -> PixelRGBA16

promoteImage :: Image PixelRGB8 -> Image PixelRGBA16

ColorConvertible PixelRGB8 PixelRGBA8 
Instance details

Defined in Codec.Picture.Types

Methods

promotePixel :: PixelRGB8 -> PixelRGBA8

promoteImage :: Image PixelRGB8 -> Image PixelRGBA8

ColorConvertible PixelRGB8 PixelRGBF 
Instance details

Defined in Codec.Picture.Types

Methods

promotePixel :: PixelRGB8 -> PixelRGBF

promoteImage :: Image PixelRGB8 -> Image PixelRGBF

ColorConvertible PixelYA8 PixelRGB8 
Instance details

Defined in Codec.Picture.Types

Methods

promotePixel :: PixelYA8 -> PixelRGB8

promoteImage :: Image PixelYA8 -> Image PixelRGB8

ColorPlane PixelRGB8 PlaneBlue 
Instance details

Defined in Codec.Picture.Types

Methods

toComponentIndex :: PixelRGB8 -> PlaneBlue -> Int

ColorPlane PixelRGB8 PlaneGreen 
Instance details

Defined in Codec.Picture.Types

Methods

toComponentIndex :: PixelRGB8 -> PlaneGreen -> Int

ColorPlane PixelRGB8 PlaneRed 
Instance details

Defined in Codec.Picture.Types

Methods

toComponentIndex :: PixelRGB8 -> PlaneRed -> Int

ColorSpaceConvertible PixelCMYK8 PixelRGB8 
Instance details

Defined in Codec.Picture.Types

Methods

convertPixel :: PixelCMYK8 -> PixelRGB8

convertImage :: Image PixelCMYK8 -> Image PixelRGB8

ColorSpaceConvertible PixelRGB8 PixelCMYK8 
Instance details

Defined in Codec.Picture.Types

Methods

convertPixel :: PixelRGB8 -> PixelCMYK8

convertImage :: Image PixelRGB8 -> Image PixelCMYK8

ColorSpaceConvertible PixelRGB8 PixelYCbCr8 
Instance details

Defined in Codec.Picture.Types

Methods

convertPixel :: PixelRGB8 -> PixelYCbCr8

convertImage :: Image PixelRGB8 -> Image PixelYCbCr8

ColorSpaceConvertible PixelYCbCr8 PixelRGB8 
Instance details

Defined in Codec.Picture.Types

Methods

convertPixel :: PixelYCbCr8 -> PixelRGB8

convertImage :: Image PixelYCbCr8 -> Image PixelRGB8

ColorSpaceConvertible PixelYCbCrK8 PixelRGB8 
Instance details

Defined in Codec.Picture.Types

Methods

convertPixel :: PixelYCbCrK8 -> PixelRGB8

convertImage :: Image PixelYCbCrK8 -> Image PixelRGB8

TransparentPixel PixelRGBA8 PixelRGB8 
Instance details

Defined in Codec.Picture.Types

Methods

dropTransparency :: PixelRGBA8 -> PixelRGB8

getTransparency :: PixelRGBA8 -> PixelBaseComponent PixelRGBA8

type PixelBaseComponent PixelRGB8 
Instance details

Defined in Codec.Picture.Types

type PixelBaseComponent PixelRGB8 = Word8

writePng :: PngSavable pixel => FilePath -> Image pixel -> IO () #

writeAnimation Source #

Arguments

:: FilePath

output filename

-> Int

frame delay in centiseconds

-> [Image PixelRGB8]

animation frames

-> IO () 

Save a looping animated GIF to disk given the animation frames and a delay.

generateImage :: Pixel px => (Int -> Int -> px) -> Int -> Int -> Image px #

coordImage Source #

Arguments

:: Pixel p 
=> (Coord, Coord)

inclusive coordinate range

-> (Coord -> p)

pixel coloring function

-> Image p 

Generate an image given coordinate bounds and a projection from coordinates to colors.

colorWheel :: Word8 -> PixelRGB8 Source #

Assign a gradient rainbow to the values of a 8-bit number.