|Maintainer||Andy Gill <firstname.lastname@example.org>|
This module contains the types used by chalkboard, except Board itself.
- type UI = R
- type R = Float
- type Point = (R, R)
- type Radian = Float
- class Over c where
- over :: c -> c -> c
- stack :: Over c => [c] -> c
- class Scale c where
- class Lerp a where
- class Average a where
- average :: [a] -> a
- data Alpha c = Alpha c !UI
- alpha :: c -> Alpha c
- transparent :: Scale c => c -> Alpha c
- withAlpha :: Scale c => UI -> c -> Alpha c
- unAlpha :: Scale c => Alpha c -> c
- data Z c = Z c R
- nearZero :: R
For placing a value literally over another value. The 2nd value might shine through. The operation must be assocative.
Scale something by a value. scaling value can be bigger than 1.
Linear interpolation between two values.
Average a set of values. weighting can be achived using multiple entries.
Alpha Channel support
Channels with alpha component, the channel
alpha builds something that has an alpha channel, and is completely opaque.
transparent builds something that has an alpha channel, and is completely transparent.
withAlpha builds somethings that has a specific alpha value.
unAlpha removes the alpha component, and returns the channel inside.
Z buffer support
A Z buffer style Z value for a point, where lower numbers are nearer the viewer. Assumes no transparency.