Portability | GHC with TypeFamilies and more |
---|---|
Stability | unstable |
Maintainer | stephen.tetley@gmail.com |
Wumpus.Core.Colour
Contents
Description
RGB, HSB, Gray colour types, and conversions between them.
Internally Wumpus uses RGB3 Double
with range [0.0, 1..0]
as the colour type. All colour values in the generated SVG or
PostScript files will be RGB.
Colour have Num instances for convenience, though the
operations of Data.VectorSpace
(instances also defined)
seem more approriate.
- data RGB3 a = RGB3 !a !a !a
- type DRGB = RGB3 Double
- data HSB3 a = HSB3 !a !a !a
- type DHSB = HSB3 Double
- newtype Gray a = Gray a
- type DGray = Gray Double
- rgb2hsb :: DRGB -> DHSB
- hsb2rgb :: DHSB -> DRGB
- rgb2gray :: DRGB -> DGray
- gray2rgb :: DGray -> DRGB
- hsb2gray :: DHSB -> DGray
- gray2hsb :: DGray -> DHSB
- black :: DRGB
- white :: DRGB
- red :: DRGB
- green :: DRGB
- blue :: DRGB
Colour types
Red-Green-Blue - no alpha.
Constructors
RGB3 !a !a !a |
Instances
Eq a => Eq (RGB3 a) | |
Fractional a => Fractional (RGB3 a) | |
Num a => Num (RGB3 a) | |
Show a => Show (RGB3 a) | |
Num a => VectorSpace (RGB3 a) | |
Num a => AdditiveGroup (RGB3 a) | |
PSColour (RGB3 Double) | |
Ellipse (RGB3 Double) | |
TextLabel (RGB3 Double) | |
Fill (RGB3 Double) | |
Stroke (RGB3 Double) | |
Ellipse (RGB3 Double, [StrokeAttr]) | |
Ellipse (RGB3 Double, StrokeAttr) | |
Ellipse (RGB3 Double, DrawEllipse) | |
TextLabel (RGB3 Double, FontAttr) | |
Stroke (RGB3 Double, [StrokeAttr]) | |
Stroke (RGB3 Double, StrokeAttr) |
RGB representated by Double - values should be in the range 0.0 to 1.0.
- 0 represents full saturation, for instance red is 1.0, 0.0, 0.0.
Hue-Saturation-Brightness.
Constructors
HSB3 !a !a !a |
Instances
Eq a => Eq (HSB3 a) | |
Fractional a => Fractional (HSB3 a) | |
Num a => Num (HSB3 a) | |
Show a => Show (HSB3 a) | |
Num a => VectorSpace (HSB3 a) | |
Num a => AdditiveGroup (HSB3 a) | |
PSColour (HSB3 Double) | |
Ellipse (HSB3 Double) | |
TextLabel (HSB3 Double) | |
Fill (HSB3 Double) | |
Stroke (HSB3 Double) | |
Ellipse (HSB3 Double, [StrokeAttr]) | |
Ellipse (HSB3 Double, StrokeAttr) | |
Ellipse (HSB3 Double, DrawEllipse) | |
TextLabel (HSB3 Double, FontAttr) | |
Stroke (HSB3 Double, [StrokeAttr]) | |
Stroke (HSB3 Double, StrokeAttr) |
Gray scale.
Constructors
Gray a |
Instances
Eq a => Eq (Gray a) | |
Fractional a => Fractional (Gray a) | |
Num a => Num (Gray a) | |
Ord a => Ord (Gray a) | |
Show a => Show (Gray a) | |
Num a => VectorSpace (Gray a) | |
Num a => AdditiveGroup (Gray a) | |
PSColour (Gray Double) | |
Ellipse (Gray Double) | |
TextLabel (Gray Double) | |
Fill (Gray Double) | |
Stroke (Gray Double) | |
Ellipse (Gray Double, [StrokeAttr]) | |
Ellipse (Gray Double, StrokeAttr) | |
Ellipse (Gray Double, DrawEllipse) | |
TextLabel (Gray Double, FontAttr) | |
Stroke (Gray Double, [StrokeAttr]) | |
Stroke (Gray Double, StrokeAttr) |
type DGray = Gray DoubleSource
Gray represented by a Double - values should be in the range 0.0 (black) to 1.0 (white).