Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > d0e10361641c23540bc6c59a45edabeb > files > 47

ghc-colour-devel-2.3.1-1.fc14.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--Rendered using the Haskell Html Library v0.2-->
<HTML
><HEAD
><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"
><TITLE
>Data.Colour</TITLE
><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"
><SCRIPT SRC="haddock-util.js" TYPE="text/javascript"
></SCRIPT
><SCRIPT TYPE="text/javascript"
>window.onload = function () {setSynopsis("mini_Data-Colour.html")};</SCRIPT
></HEAD
><BODY
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="topbar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "
></TD
><TD CLASS="title"
>colour-2.3.1: A model for human colour/color perception</TD
><TD CLASS="topbut"
><A HREF="src/Data-Colour.html"
>Source code</A
></TD
><TD CLASS="topbut"
><A HREF="index.html"
>Contents</A
></TD
><TD CLASS="topbut"
><A HREF="doc-index.html"
>Index</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="modulebar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><FONT SIZE="6"
>Data.Colour</FONT
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="section4"
><B
>Contents</B
></TD
></TR
><TR
><TD
><DL
><DT
><A HREF="#1"
>Interfacing with Other Libraries' Colour Spaces
</A
></DT
><DT
><A HREF="#2"
>Colour type
</A
></DT
><DT
><A HREF="#3"
>Colour operations
</A
></DT
></DL
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Description</TD
></TR
><TR
><TD CLASS="doc"
><P
>Datatypes for representing the human perception of colour.
 Includes common operations for blending and compositing colours.
 The most common way of creating colours is either by name
 (see <A HREF="Data-Colour-Names.html"
>Data.Colour.Names</A
>) or by giving an sRGB triple 
 (see <A HREF="Data-Colour-SRGB.html"
>Data.Colour.SRGB</A
>).
</P
><P
>Methods of specifying Colours can be found in 
</P
><UL
><LI
> <A HREF="Data-Colour-SRGB.html"
>Data.Colour.SRGB</A
>
</LI
><LI
> <A HREF="Data-Colour-SRGB-Linear.html"
>Data.Colour.SRGB.Linear</A
>
</LI
><LI
> <A HREF="Data-Colour-CIE.html"
>Data.Colour.CIE</A
>
</LI
></UL
><P
>Colours can be specified in a generic Data.Colour.RGBSpace.RGBSpace
 by using
</P
><UL
><LI
> <A HREF="Data-Colour-RGBSpace.html"
>Data.Colour.RGBSpace</A
>
</LI
></UL
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Synopsis</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>data</SPAN
>  <A HREF="#t%3AColour"
>Colour</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AcolourConvert"
>colourConvert</A
> :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFractional"
>Fractional</A
> b, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AReal"
>Real</A
> a) =&gt; <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> b</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Ablack"
>black</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>data</SPAN
>  <A HREF="#t%3AAlphaColour"
>AlphaColour</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Aopaque"
>opaque</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AwithOpacity"
>withOpacity</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a -&gt; a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Atransparent"
>transparent</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AalphaColourConvert"
>alphaColourConvert</A
> :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFractional"
>Fractional</A
> b, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AReal"
>Real</A
> a) =&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> b</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AalphaChannel"
>alphaChannel</A
> ::  <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>class</SPAN
>  <A HREF="#t%3AAffineSpace"
>AffineSpace</A
> f  <SPAN CLASS="keyword"
>where</SPAN
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="#v%3AaffineCombo"
>affineCombo</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; [(a, f a)] -&gt; f a -&gt; f a</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Ablend"
>blend</A
> :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a, <A HREF="Data-Colour.html#t%3AAffineSpace"
>AffineSpace</A
> f) =&gt; a -&gt; f a -&gt; f a -&gt; f a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>class</SPAN
>  <A HREF="#t%3AColourOps"
>ColourOps</A
> f  <SPAN CLASS="keyword"
>where</SPAN
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="#v%3Aover"
>over</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; f a -&gt; f a</TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Adarken"
>darken</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; a -&gt; f a -&gt; f a</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Adissolve"
>dissolve</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Aatop"
>atop</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFractional"
>Fractional</A
> a =&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
><A NAME="1"
><A NAME="1"
>Interfacing with Other Libraries' Colour Spaces
</A
></A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Executive summary: Always use <A HREF="Data-Colour-SRGB.html"
>Data.Colour.SRGB</A
> when interfacing with
 other libraries.
 Use Data.Colour.SRGB.toSRGB24 / Data.Colour.SRGB.sRGB24 when
 interfacing with libraries wanting Data.Word.Word8 per channel.
 Use Data.Colour.SRGB.toSRGB / Data.Colour.SRGB.sRGB when
 interfacing with libraries wanting <TT
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ADouble"
>Double</A
></TT
> or <TT
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFloat"
>Float</A
></TT
> per channel.
</P
><P
>Interfacing with the colour for other libraries, such as cairo
 (<A HREF="http://www.haskell.org/gtk2hs/archives/category/cairo/"
>http://www.haskell.org/gtk2hs/archives/category/cairo/</A
>) and OpenGL
 (<A HREF="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/OpenGL"
>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/OpenGL</A
>),
 can be a challenge because these libraries often do not use colour spaces
 in a consistent way.
 The problem is that these libraries work in a device dependent colour
 space and give no indication what the colour space is.
 For most devices this colours space is implicitly the non-linear sRGB
 space.
 However, to make matters worse, these libraries also do their
 compositing and blending in the device colour space.
 Blending and compositing ought to be done in a linear colour space,
 but since the device space is typically non-linear sRGB, these libraries
 typically produce colour blends that are too dark.
</P
><P
>(Note that <A HREF="Data-Colour.html"
>Data.Colour</A
> is a device <EM
>independent</EM
> colour space, and
 produces correct blends. 
 e.g. compare <TT
>toSRGB (blend 0.5 lime red)</TT
> with <TT
>RGB 0.5 0.5 0</TT
>)
</P
><P
>Because these other colour libraries can only blend in device colour
 spaces, they are fundamentally broken and there is no &quot;right&quot; way
 to interface with them.
 For most libraries, the best one can do is assume they are working
 with an sRGB colour space and doing incorrect blends.  
 In these cases use <A HREF="Data-Colour-SRGB.html"
>Data.Colour.SRGB</A
> to convert to and from the
 colour coordinates.  This is the best advice for interfacing with cairo.
</P
><P
>When using OpenGL, the choice is less clear.
 Again, OpenGL usually does blending in the device colour space.
 However, because blending is an important part of proper shading, one
 may want to consider that OpenGL is working in a linear colour space,
 and the resulting rasters are improperly displayed.
 This is born out by the fact that OpenGL extensions that support
 sRGB do so by converting sRGB input/output to linear colour coordinates
 for processing by OpenGL.
</P
><P
>The best way to use OpenGL, is to use proper sRGB surfaces for textures
 and rendering.
 These surfaces will automatically convert to and from OpenGL's linear
 colour space.
 In this case, use <A HREF="Data-Colour-SRGB-Linear.html"
>Data.Colour.SRGB.Linear</A
> to interface OpenGL's linear
 colour space.
</P
><P
>If not using proper surfaces with OpenGL, then you have a choice between
 having OpenGL do improper blending or improper display
 If you are using OpenGL for 3D shading, I recommend using
 <A HREF="Data-Colour-SRGB-Linear.html"
>Data.Colour.SRGB.Linear</A
> (thus choosing improper OpenGL display).
 If you are not using OpenGL for 3D shading, I recommend using
 <A HREF="Data-Colour-SRGB.html"
>Data.Colour.SRGB</A
> (thus choosing improper OpenGL blending).
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
><A NAME="2"
><A NAME="2"
>Colour type
</A
></A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><SPAN CLASS="keyword"
>data</SPAN
>  <A NAME="t:Colour"
><A NAME="t%3AColour"
></A
></A
><B
>Colour</B
> a </TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#Colour"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="ndoc"
><P
>This type represents the human preception of colour.
 The <TT
>a</TT
> parameter is a numeric type used internally for the
 representation.
</P
><P
>The <TT
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Monoid.html#t%3AMonoid"
>Monoid</A
></TT
> instance allows one to add colours, but beware that adding
 colours can take you out of gamut.  Consider using <TT
><A HREF="Data-Colour.html#v%3Ablend"
>blend</A
></TT
> whenever
 possible.
</P
></TD
></TR
><TR
><TD CLASS="section4"
><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Colour')" ALT="show/hide"
> Instances</TD
></TR
><TR
><TD CLASS="body"
><DIV ID="i:Colour" STYLE="display:block;"
><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="Data-Colour.html#t%3AColourOps"
>ColourOps</A
> <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="Data-Colour.html#t%3AAffineSpace"
>AffineSpace</A
> <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq"
>Eq</A
> a =&gt; <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq"
>Eq</A
> (<A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a)</TD
></TR
><TR
><TD CLASS="decl"
>(<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFractional"
>Fractional</A
> a, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Read.html#t%3ARead"
>Read</A
> a) =&gt; <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Read.html#t%3ARead"
>Read</A
> (<A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a)</TD
></TR
><TR
><TD CLASS="decl"
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFractional"
>Fractional</A
> a =&gt; <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShow"
>Show</A
> (<A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a)</TD
></TR
><TR
><TD CLASS="decl"
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Monoid.html#t%3AMonoid"
>Monoid</A
> (<A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a)</TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:colourConvert"
><A NAME="v%3AcolourConvert"
></A
></A
><B
>colourConvert</B
> :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFractional"
>Fractional</A
> b, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AReal"
>Real</A
> a) =&gt; <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> b</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#colourConvert"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
>Change the type used to represent the colour coordinates.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:black"
><A NAME="v%3Ablack"
></A
></A
><B
>black</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#black"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><SPAN CLASS="keyword"
>data</SPAN
>  <A NAME="t:AlphaColour"
><A NAME="t%3AAlphaColour"
></A
></A
><B
>AlphaColour</B
> a </TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#AlphaColour"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="ndoc"
><P
>This type represents a <TT
><A HREF="Data-Colour.html#t%3AColour"
>Colour</A
></TT
> that may be semi-transparent.
</P
><P
>The <TT
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Monoid.html#t%3AMonoid"
>Monoid</A
></TT
> instance allows you to composite colours.
</P
><PRE
>x `mappend` y == x `over` y
</PRE
><P
>To get the (pre-multiplied) colour channel of an <TT
><A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TT
> <TT
>c</TT
>,
 simply composite <TT
>c</TT
> over black.
</P
><PRE
>c `over` (mempty :: Colour a)
</PRE
></TD
></TR
><TR
><TD CLASS="section4"
><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:AlphaColour')" ALT="show/hide"
> Instances</TD
></TR
><TR
><TD CLASS="body"
><DIV ID="i:AlphaColour" STYLE="display:block;"
><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="Data-Colour.html#t%3AColourOps"
>ColourOps</A
> <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="Data-Colour.html#t%3AAffineSpace"
>AffineSpace</A
> <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq"
>Eq</A
> a =&gt; <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq"
>Eq</A
> (<A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a)</TD
></TR
><TR
><TD CLASS="decl"
>(<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFractional"
>Fractional</A
> a, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Read.html#t%3ARead"
>Read</A
> a) =&gt; <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Read.html#t%3ARead"
>Read</A
> (<A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a)</TD
></TR
><TR
><TD CLASS="decl"
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFractional"
>Fractional</A
> a =&gt; <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShow"
>Show</A
> (<A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a)</TD
></TR
><TR
><TD CLASS="decl"
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Monoid.html#t%3AMonoid"
>Monoid</A
> (<A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a)</TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:opaque"
><A NAME="v%3Aopaque"
></A
></A
><B
>opaque</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#opaque"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
>Creates an opaque <TT
><A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TT
> from a <TT
><A HREF="Data-Colour.html#t%3AColour"
>Colour</A
></TT
>.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:withOpacity"
><A NAME="v%3AwithOpacity"
></A
></A
><B
>withOpacity</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
> a -&gt; a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#withOpacity"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Creates an <TT
><A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TT
> from a <TT
><A HREF="Data-Colour.html#t%3AColour"
>Colour</A
></TT
> with a given opacity.
</P
><PRE
>c `withOpacity` o == dissolve o (opaque c) 
</PRE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:transparent"
><A NAME="v%3Atransparent"
></A
></A
><B
>transparent</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#transparent"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
>This <TT
><A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TT
> is entirely transparent and has no associated
 colour channel.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:alphaColourConvert"
><A NAME="v%3AalphaColourConvert"
></A
></A
><B
>alphaColourConvert</B
> :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFractional"
>Fractional</A
> b, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AReal"
>Real</A
> a) =&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> b</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#alphaColourConvert"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
>Change the type used to represent the colour coordinates.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:alphaChannel"
><A NAME="v%3AalphaChannel"
></A
></A
><B
>alphaChannel</B
> ::  <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#alphaChannel"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
>Returns the opacity of an <TT
><A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TT
>.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
><A NAME="3"
><A NAME="3"
>Colour operations
</A
></A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="doc"
>These operations allow combine and modify existing colours
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><SPAN CLASS="keyword"
>class</SPAN
>  <A NAME="t:AffineSpace"
><A NAME="t%3AAffineSpace"
></A
></A
><B
>AffineSpace</B
> f  <SPAN CLASS="keyword"
>where</SPAN
></TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#AffineSpace"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="section4"
>Methods</TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:affineCombo"
><A NAME="v%3AaffineCombo"
></A
></A
><B
>affineCombo</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; [(a, f a)] -&gt; f a -&gt; f a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#affineCombo"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Compute a affine Combination (weighted-average) of points.
 The last parameter will get the remaining weight.
 e.g.
</P
><PRE
>affineCombo [(0.2,a), (0.3,b)] c == 0.2*a + 0.3*b + 0.4*c
</PRE
><P
>Weights can be negative, or greater than 1.0; however, be aware
 that non-convex combinations may lead to out of gamut colours.
</P
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="section4"
><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:AffineSpace')" ALT="show/hide"
> Instances</TD
></TR
><TR
><TD CLASS="body"
><DIV ID="i:AffineSpace" STYLE="display:block;"
><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="Data-Colour.html#t%3AAffineSpace"
>AffineSpace</A
> <A HREF="Data-Colour-CIE.html#t%3AChromaticity"
>Chromaticity</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="Data-Colour.html#t%3AAffineSpace"
>AffineSpace</A
> <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="Data-Colour.html#t%3AAffineSpace"
>AffineSpace</A
> <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:blend"
><A NAME="v%3Ablend"
></A
></A
><B
>blend</B
> :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a, <A HREF="Data-Colour.html#t%3AAffineSpace"
>AffineSpace</A
> f) =&gt; a -&gt; f a -&gt; f a -&gt; f a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#blend"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Compute the weighted average of two points.
 e.g.
</P
><PRE
>blend 0.4 a b = 0.4*a + 0.6*b
</PRE
><P
>The weight can be negative, or greater than 1.0; however, be aware
 that non-convex combinations may lead to out of gamut colours.
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><SPAN CLASS="keyword"
>class</SPAN
>  <A NAME="t:ColourOps"
><A NAME="t%3AColourOps"
></A
></A
><B
>ColourOps</B
> f  <SPAN CLASS="keyword"
>where</SPAN
></TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#ColourOps"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="section4"
>Methods</TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:over"
><A NAME="v%3Aover"
></A
></A
><B
>over</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; f a -&gt; f a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#over"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
><TT
>c1 `over` c2</TT
> returns the <TT
><A HREF="Data-Colour.html#t%3AColour"
>Colour</A
></TT
> created by compositing the
 <TT
><A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TT
> <TT
>c1</TT
> over <TT
>c2</TT
>, which may be either a <TT
><A HREF="Data-Colour.html#t%3AColour"
>Colour</A
></TT
> or
 <TT
><A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TT
>.
</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:darken"
><A NAME="v%3Adarken"
></A
></A
><B
>darken</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; a -&gt; f a -&gt; f a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#darken"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
><P
><TT
>darken s c</TT
> blends a colour with black without changing it's opacity.
</P
><P
>For <TT
><A HREF="Data-Colour.html#t%3AColour"
>Colour</A
></TT
>, <TT
>darken s c = blend s c mempty</TT
>
</P
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="section4"
><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:ColourOps')" ALT="show/hide"
> Instances</TD
></TR
><TR
><TD CLASS="body"
><DIV ID="i:ColourOps" STYLE="display:block;"
><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="Data-Colour.html#t%3AColourOps"
>ColourOps</A
> <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="Data-Colour.html#t%3AColourOps"
>ColourOps</A
> <A HREF="Data-Colour.html#t%3AColour"
>Colour</A
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:dissolve"
><A NAME="v%3Adissolve"
></A
></A
><B
>dissolve</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#dissolve"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
>Returns an <TT
><A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TT
> more transparent by a factor of <TT
>o</TT
>.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:atop"
><A NAME="v%3Aatop"
></A
></A
><B
>atop</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFractional"
>Fractional</A
> a =&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a -&gt; <A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
> a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Colour-Internal.html#atop"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
><P
><TT
>c1 `atop` c2</TT
> returns the <TT
><A HREF="Data-Colour.html#t%3AAlphaColour"
>AlphaColour</A
></TT
> produced by covering
 the portion of <TT
>c2</TT
> visible by <TT
>c1</TT
>.
 The resulting alpha channel is always the same as the alpha channel
 of <TT
>c2</TT
>.
</P
><PRE
>c1 `atop` (opaque c2) == c1 `over` (opaque c2)
AlphaChannel (c1 `atop` c2) == AlphaChannel c2
</PRE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="botbar"
>Produced by <A HREF="http://www.haskell.org/haddock/"
>Haddock</A
> version 2.6.1</TD
></TR
></TABLE
></BODY
></HTML
>