chalkboard-0.1: Combinators for building and processing 2D images.

Portabilityghc
Stabilityunstable
MaintainerAndy Gill <andygill@ku.edu>

Graphics.Chalkboard.Types

Contents

Description

This module contains the types used by chalkboard, except Board itself.

Synopsis

Basic types

type UI = RSource

Unit Interval: value between 0 and 1, inclusive.

type R = FloatSource

A real number.

type Point = (R, R)Source

A point in R2.

type Radian = FloatSource

Angle units

Overlaying

class Over c whereSource

For placing a value literally over another value. The 2nd value might shine through. The operation must be assocative.

Methods

over :: c -> c -> cSource

Instances

Over Bool 
Over RGB 
Over Gray 
Over (Maybe a) 
Over (Z c) 
(Scale c, Lerp c) => Over (Alpha c) 
Over c => Over (Board c) 

stack :: Over c => [c] -> cSource

stack stacks a list of things over each other, where earlier elements are over later elements. Requires non empty lists, which can be satisfied by using an explicity transparent Board as one of the elements.

Scaling

class Scale c whereSource

Scale something by a value. scaling value can be bigger than 1.

Methods

scale :: R -> c -> cSource

Instances

Linear Interpolation

class Lerp a whereSource

Linear interpolation between two values.

Methods

lerp :: a -> a -> UI -> aSource

Instances

Lerp R 
Lerp RGB 
Lerp a => Lerp (Maybe a) 
(Lerp a, Lerp b) => Lerp (a, b)

Lerp over pairs

Averaging

class Average a whereSource

Average a set of values. weighting can be achived using multiple entries.

Methods

average :: [a] -> aSource

average is not defined for empty list

Instances

Alpha Channel support

data Alpha c Source

Channels with alpha component, the channel is pre-scaled.

Constructors

Alpha c !UI 

Instances

Show c => Show (Alpha c) 
(Scale c, Lerp c) => Over (Alpha c) 

alpha :: c -> Alpha cSource

alpha builds something that has an alpha channel, and is completely opaque.

transparent :: c -> Alpha cSource

transparent builds something that has an alpha channel, and is completely transparent.

withAlpha :: Scale c => UI -> c -> Alpha cSource

withAlpha builds somethings that has a specific alpha value.

unAlpha :: Scale c => Alpha c -> cSource

unAlpha removes the alpha component, and returns the channel inside.

Z buffer support

data Z c Source

A Z buffer style Z value for a point, where lower numbers are nearer the viewer. Assumes no transparency.

Constructors

Z c R 

Instances

Show c => Show (Z c) 
Over (Z c) 

Constants

nearZero :: RSource

Close to zero; needed for Over (Alpha c) instance.