<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="previous" href="Cmyk32.html"> <link rel="next" href="Freetype.html"> <link rel="Up" href="index.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of class methods" rel=Appendix href="index_methods.html"> <link title="Index of classes" rel=Appendix href="index_classes.html"> <link title="Index of class types" rel=Appendix href="index_class_types.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Bitmap" rel="Chapter" href="Bitmap.html"> <link title="Blend" rel="Chapter" href="Blend.html"> <link title="Bmp" rel="Chapter" href="Bmp.html"> <link title="Cmyk32" rel="Chapter" href="Cmyk32.html"> <link title="Color" rel="Chapter" href="Color.html"> <link title="Freetype" rel="Chapter" href="Freetype.html"> <link title="Ftlow" rel="Chapter" href="Ftlow.html"> <link title="Fttext" rel="Chapter" href="Fttext.html"> <link title="Genimage" rel="Chapter" href="Genimage.html"> <link title="Gif" rel="Chapter" href="Gif.html"> <link title="Graphic_image" rel="Chapter" href="Graphic_image.html"> <link title="Images" rel="Chapter" href="Images.html"> <link title="Index16" rel="Chapter" href="Index16.html"> <link title="Index8" rel="Chapter" href="Index8.html"> <link title="Info" rel="Chapter" href="Info.html"> <link title="Jis_unicode" rel="Chapter" href="Jis_unicode.html"> <link title="Jpeg" rel="Chapter" href="Jpeg.html"> <link title="Mstring" rel="Chapter" href="Mstring.html"> <link title="OColor" rel="Chapter" href="OColor.html"> <link title="OImage" rel="Chapter" href="OImage.html"> <link title="OImages" rel="Chapter" href="OImages.html"> <link title="OXimage2" rel="Chapter" href="OXimage2.html"> <link title="OXvthumb" rel="Chapter" href="OXvthumb.html"> <link title="Png" rel="Chapter" href="Png.html"> <link title="Ppm" rel="Chapter" href="Ppm.html"> <link title="Ps" rel="Chapter" href="Ps.html"> <link title="Reduce" rel="Chapter" href="Reduce.html"> <link title="Region" rel="Chapter" href="Region.html"> <link title="Rgb24" rel="Chapter" href="Rgb24.html"> <link title="Rgba32" rel="Chapter" href="Rgba32.html"> <link title="Tmpfile" rel="Chapter" href="Tmpfile.html"> <link title="Ximage2" rel="Chapter" href="Ximage2.html"> <link title="Xpm" rel="Chapter" href="Xpm.html"> <link title="Xvthumb" rel="Chapter" href="Xvthumb.html"><title>Color</title> </head> <body> <div class="navbar"><a href="Cmyk32.html">Previous</a> <a href="index.html">Up</a> <a href="Freetype.html">Next</a> </div> <center><h1>Module <a href="type_Color.html">Color</a></h1></center> <br> <pre><span class="keyword">module</span> Color: <code class="code">sig</code> <a href="Color.html">..</a> <code class="code">end</code></pre>Definition of colormaps, i.e. mappings from real RGB colors to integers. The integer corresponding to a color <code class="code">c</code> is an index <code class="code">i</code> into a vector of colors whose <code class="code">i</code>th element is <code class="code">c</code>.<br> <hr width="100%"> <pre><span class="keyword">exception</span> <a name="EXCEPTIONToo_many_colors"></a>Too_many_colors</pre> <br><code><span class="keyword">type</span> <a name="TYPEmap"></a><code class="type">'a</code> map = {</code><table class="typetable"> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>max : <code class="type">int</code>;</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>map : <code class="type">'a array</code>;</code></td> </tr></table> } <div class="info"> This is copied in Images also<br> </div> <pre><span class="keyword">val</span> <a name="VALsize"></a>size : <code class="type">'a <a href="Color.html#TYPEmap">map</a> -> int</code></pre><div class="info"> Colormap manipulation functions <p> Returns the size of a colormap.<br> </div> <pre><span class="keyword">val</span> <a name="VALfind_exact"></a>find_exact : <code class="type">'a <a href="Color.html#TYPEmap">map</a> -> 'a -> int</code></pre><div class="info"> Finds a color in the colormap and returns its color index. Raises exception <code class="code">Not_found</code> if the color is not in the colormap.<br> </div> <pre><span class="keyword">val</span> <a name="VALadd_color"></a>add_color : <code class="type">'a <a href="Color.html#TYPEmap">map</a> -> 'a -> int</code></pre><div class="info"> Add a new color into the given colormap and return its index. If the color is already in the colormap, it is not added again, and the corresponding color index is returned.<br> </div> <pre><span class="keyword">val</span> <a name="VALadd_colors"></a>add_colors : <code class="type">'a <a href="Color.html#TYPEmap">map</a> -> 'a list -> int list</code></pre><div class="info"> Add the list of new colors into the given colormap and return their indices. If a color is already in the colormap, it is not added again, and the corresponding color index is returned.<br> </div> <pre><span class="keyword">val</span> <a name="VALcopy"></a>copy : <code class="type">'a <a href="Color.html#TYPEmap">map</a> -> 'a <a href="Color.html#TYPEmap">map</a></code></pre><div class="info"> Copy a colormap<br> </div> <pre><span class="keyword">module</span> <a href="Color.Rgb.html">Rgb</a>: <code class="code">sig</code> <a href="Color.Rgb.html">..</a> <code class="code">end</code></pre><pre><span class="keyword">type</span> <a name="TYPErgb"></a><code class="type"></code>rgb = <code class="type"><a href="Color.Rgb.html#TYPEt">Rgb.t</a></code> = {</pre><table class="typetable"> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>r : <code class="type">int</code>;</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>g : <code class="type">int</code>;</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>b : <code class="type">int</code>;</code></td> </tr></table> } <pre><span class="keyword">module</span> <a href="Color.Rgba.html">Rgba</a>: <code class="code">sig</code> <a href="Color.Rgba.html">..</a> <code class="code">end</code></pre><pre><span class="keyword">type</span> <a name="TYPErgba"></a><code class="type"></code>rgba = <code class="type"><a href="Color.Rgba.html#TYPEt">Rgba.t</a></code> = {</pre><table class="typetable"> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>color : <code class="type"><a href="Color.html#TYPErgb">rgb</a></code>;</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>alpha : <code class="type">int</code>;</code></td> </tr></table> } <div class="info"> RGB with alpha (transparent) information<br> </div> <pre><span class="keyword">module</span> <a href="Color.Cmyk.html">Cmyk</a>: <code class="code">sig</code> <a href="Color.Cmyk.html">..</a> <code class="code">end</code></pre><pre><span class="keyword">type</span> <a name="TYPEcmyk"></a><code class="type"></code>cmyk = <code class="type"><a href="Color.Cmyk.html#TYPEt">Cmyk.t</a></code> = {</pre><table class="typetable"> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>c : <code class="type">int</code>;</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>m : <code class="type">int</code>;</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>y : <code class="type">int</code>;</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span class="keyword">mutable </span>k : <code class="type">int</code>;</code></td> </tr></table> } <div class="info"> Cyan Magenta Yellow blacK color model<br> </div> <pre><span class="keyword">val</span> <a name="VALrgb_square_distance"></a>rgb_square_distance : <code class="type"><a href="Color.html#TYPErgb">rgb</a> -> <a href="Color.html#TYPErgb">rgb</a> -> int</code></pre><div class="info"> Rgb specialized functions (for backward compatibility) <p> Compute the distance between two colours.<br> </div> <pre><span class="keyword">val</span> <a name="VALplus"></a>plus : <code class="type"><a href="Color.html#TYPErgb">rgb</a> -> <a href="Color.html#TYPErgb">rgb</a> -> <a href="Color.html#TYPErgb">rgb</a></code></pre><pre><span class="keyword">val</span> <a name="VALminus"></a>minus : <code class="type"><a href="Color.html#TYPErgb">rgb</a> -> <a href="Color.html#TYPErgb">rgb</a> -> <a href="Color.html#TYPErgb">rgb</a></code></pre><pre><span class="keyword">val</span> <a name="VALbrightness"></a>brightness : <code class="type"><a href="Color.html#TYPErgb">rgb</a> -> int</code></pre><pre><span class="keyword">val</span> <a name="VALcolor_parse"></a>color_parse : <code class="type">string -> <a href="Color.html#TYPErgb">rgb</a></code></pre><pre><span class="keyword">val</span> <a name="VALcolormap_parse"></a>colormap_parse : <code class="type">string array -> <a href="Color.html#TYPErgb">rgb</a> array * int</code></pre></body></html>