diff options
Diffstat (limited to 'docs/html/overview-summary-color.js.html')
-rw-r--r-- | docs/html/overview-summary-color.js.html | 407 |
1 files changed, 0 insertions, 407 deletions
diff --git a/docs/html/overview-summary-color.js.html b/docs/html/overview-summary-color.js.html deleted file mode 100644 index 2050d02..0000000 --- a/docs/html/overview-summary-color.js.html +++ /dev/null @@ -1,407 +0,0 @@ -<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"> -<html> -<head> -<title> - Overview -</title> -<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style"> -<script> -function asd() { - - parent.document.title="color.js Overview"; - -} -</script> -</head> -<body bgcolor="white" onload="asd();"> - -<!-- ========== START OF NAVBAR ========== --> -<a name="navbar_top"><!-- --></a> -<table border="0" width="100%" cellpadding="1" cellspacing="0"> -<tr> -<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1"> -<a name="navbar_top_firstrow"><!-- --></a> -<table border="0" cellpadding="0" cellspacing="3"> - <tr align="center" valign="top"> - - - <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td> - <td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td> - - - <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td> - <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td> - <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td> - <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td> - </tr> -</table> -</td> -<td bgcolor="#EEEEFF" align="right" valign="top"> -<em> -<b></b></em> -</td> -</tr> - -<tr> -<td bgcolor="white" class="NavBarCell2"><font size="-2"> - PREV - NEXT</font></td> -<td bgcolor="white" class="NavBarCell2"><font size="-2"> - <a href="index.html" target="_top"><b>FRAMES</b></a> - <a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a> - -<script> - <!-- - if(window==top) { - document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); - } - //--> -</script> -<noscript> -<a href="allclasses-noframe.html" target=""><b>All Classes</b></a> -</noscript> -</font></td> -</tr> -</table> -<!-- =========== END OF NAVBAR =========== --> - -<hr> -<center> - - <h2>color.js</h2> - -</center> - - - - -<h4>Summary</h4> -<p> - - No overview generated for 'color.js'<BR/><BR/> - -</p> - -<hr> - - - <table border="1" cellpadding="3" cellspacing="0" width="100%"> - <tr bgcolor="#CCCCFF" class="TableHeadingColor"> - <td colspan=2><font size="+2"> - - <b>Class Summary</b> - - </font></td> - </tr> - - <tr bgcolor="white" class="TableRowColor"> - <td width="15%"><b><a href="Color.html">Color</a></b></td> - <td> </td> - </tr> - - </table> - <hr/> - - -<!-- ========== METHOD SUMMARY =========== --> - -<!-- ========== END METHOD SUMMARY =========== --> - - - <pre class="sourceview"><span class="comment">// Released under the MIT/X11 license</span> -<span class="comment">// http://www.opensource.org/licenses/mit-license.php</span> -<span class="literal">"use strict"</span>; -<span class="comment">// ============================================================================</span> -<span class="comment">// Color management methods</span> -<span class="comment">// originally from</span> -<span class="comment">// http://www.mjijackson.com/2008/02\</span> -<span class="comment">// /rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript</span> -var Color = exports.Color = <span class="reserved">function</span> Color(r, g, b) { - <span class="reserved">this</span>.Luminosity = 0.85; - <span class="reserved">this</span>.Desaturated = 0.4; - - <span class="reserved">if</span> (r instanceof Array) { - <span class="reserved">this</span>.r = r[0]; - <span class="reserved">this</span>.g = r[1]; - <span class="reserved">this</span>.b = r[2]; - } <span class="reserved">else</span> { - <span class="reserved">this</span>.r = r; - <span class="reserved">this</span>.g = g; - <span class="reserved">this</span>.b = b; - } -}; - -Color.<span class="reserved">prototype</span>.update = <span class="reserved">function</span>(r, g, b) { - <span class="reserved">this</span>.r = r; - <span class="reserved">this</span>.g = g; - <span class="reserved">this</span>.b = b; -}; - -Color.<span class="reserved">prototype</span>.hs = <span class="reserved">function</span>(nStr) { - <span class="reserved">if</span> (Number(nStr) === 0) { - <span class="reserved">return</span> <span class="literal">"00"</span>; - } <span class="reserved">else</span> <span class="reserved">if</span> (nStr.length < 2) { - <span class="reserved">return</span> <span class="literal">"0"</span> + nStr; - } <span class="reserved">else</span> { - <span class="reserved">return</span> nStr; - } -}; - -Color.<span class="reserved">prototype</span>.toString = <span class="reserved">function</span>() { - var rH = Number(<span class="reserved">this</span>.r.toFixed()).toString(16); - var gH = Number(<span class="reserved">this</span>.g.toFixed()).toString(16); - var bH = Number(<span class="reserved">this</span>.b.toFixed()).toString(16); - <span class="reserved">return</span> <span class="literal">"#"</span> + <span class="reserved">this</span>.hs(rH) + <span class="reserved">this</span>.hs(gH) + <span class="reserved">this</span>.hs(bH); -}; - -<span class="comment">/** - * Converts an RGB color value to HSL. Conversion formula adapted from - * http://en.wikipedia.org/wiki/HSL_color_space. Assumes r, g, and b are - * contained in the set [0, 255] and returns h, s, and l in the set [0, 1].4343 - * - * <span class="attrib">@param</span> Number r The red color value - * <span class="attrib">@param</span> Number g The green color value - * <span class="attrib">@param</span> Number b The blue color value - * <span class="attrib">@return</span> Array The HSL representation - */</span> -Color.<span class="reserved">prototype</span>.hsl = <span class="reserved">function</span>() { - var r = <span class="reserved">this</span>.r / 255; - var g = <span class="reserved">this</span>.g / 255; - var b = <span class="reserved">this</span>.b / 255; - var max = Math.max(r, g, b), min = Math.min(r, g, b); - var h, s, l = (max + min) / 2; - - <span class="reserved">if</span> (max === min) { - h = s = 0; <span class="comment">// achromatic</span> - } <span class="reserved">else</span> { - var d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch (max) { - case r: - h = (g - b) / d + (g < b ? 6 : 0); - break; - case g: - h = (b - r) / d + 2; - break; - case b: - h = (r - g) / d + 4; - break; - } - h /= 6; - } - - <span class="reserved">return</span> [ h, s, l ]; -}; - -<span class="comment">/** - * Converts an HSL color value to RGB. Conversion formula adapted from - * http://en.wikipedia.org/wiki/HSL_color_space. Assumes h, s, and l are - * contained in the set [0, 1] and returns r, g, and b in the set [0, 255]. - * - * <span class="attrib">@param</span> Number h The hue - * <span class="attrib">@param</span> Number s The saturation - * <span class="attrib">@param</span> Number l The lightness - * <span class="attrib">@return</span> Array The RGB representation - */</span> -Color.<span class="reserved">prototype</span>.hslToRgb = <span class="reserved">function</span>(h, s, l) { - <span class="reserved">function</span> hue2rgb(p, q, t) { - <span class="reserved">if</span> (t < 0) { - t += 1; - } - <span class="reserved">if</span> (t > 1) { - t -= 1; - } - <span class="reserved">if</span> (t < 1 / 6) { - <span class="reserved">return</span> p + (q - p) * 6 * t; - } - <span class="reserved">if</span> (t < 1 / 2) { - <span class="reserved">return</span> q; - } - <span class="reserved">if</span> (t < 2 / 3) { - <span class="reserved">return</span> p + (q - p) * (2 / 3 - t) * 6; - } - <span class="reserved">return</span> p; - } - - var r, g, b; - - <span class="reserved">if</span> (s === 0) { - r = g = b = l; <span class="comment">// achromatic</span> - } <span class="reserved">else</span> { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hue2rgb(p, q, h + 1 / 3); - g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1 / 3); - } - - <span class="reserved">return</span> [ r * 255, g * 255, b * 255 ]; -}; - -<span class="comment">/** - * Converts an RGB color value to HSV. Conversion formula adapted from - * http://en.wikipedia.org/wiki/HSV_color_space. Assumes r, g, and b are - * contained in the set [0, 255] and returns h, s, and v in the set [0, 1]. - * - * <span class="attrib">@param</span> Number r The red color value - * <span class="attrib">@param</span> Number g The green color value - * <span class="attrib">@param</span> Number b The blue color value - * <span class="attrib">@return</span> Array The HSV representation - */</span> -Color.<span class="reserved">prototype</span>.hsv = <span class="reserved">function</span>() { - var r = <span class="reserved">this</span>.r / 255; - var g = <span class="reserved">this</span>.g / 255; - var b = <span class="reserved">this</span>.b / 255; - var max = Math.max(r, g, b), min = Math.min(r, g, b); - var h, s, v = max; - - var d = max - min; - s = max === 0 ? 0 : d / max; - - <span class="reserved">if</span> (max === min) { - h = 0; <span class="comment">// achromatic</span> - } <span class="reserved">else</span> { - switch (max) { - case r: - h = (g - b) / d + (g < b ? 6 : 0); - break; - case g: - h = (b - r) / d + 2; - break; - case b: - h = (r - g) / d + 4; - break; - } - h /= 6; - } - - <span class="reserved">return</span> [ h, s, v ]; -}; - -<span class="comment">/** - * Converts an HSV color value to RGB. Conversion formula adapted from - * http://en.wikipedia.org/wiki/HSV_color_space. Assumes h, s, and v are - * contained in the set [0, 1] and returns r, g, and b in the set [0, 255]. - * - * <span class="attrib">@param</span> Number h The hue - * <span class="attrib">@param</span> Number s The saturation - * <span class="attrib">@param</span> Number v The value - * <span class="attrib">@return</span> Array The RGB representation - */</span> -Color.<span class="reserved">prototype</span>.hsvToRgb = <span class="reserved">function</span>(h, s, v) { - var r, g, b; - - var i = Math.floor(h * 6); - var f = h * 6 - i; - var p = v * (1 - s); - var q = v * (1 - f * s); - var t = v * (1 - (1 - f) * s); - - switch (i % 6) { - case 0: - r = v; - g = t; - b = p; - break; - case 1: - r = q; - g = v; - b = p; - break; - case 2: - r = p; - g = v; - b = t; - break; - case 3: - r = p; - g = q; - b = v; - break; - case 4: - r = t; - g = p; - b = v; - break; - case 5: - r = v; - g = p; - b = q; - break; - } - - <span class="reserved">return</span> [ r * 255, g * 255, b * 255 ]; -}; - -<span class="comment">/** - * Provide - */</span> -Color.<span class="reserved">prototype</span>.lightColor = <span class="reserved">function</span>() { - var hslArray = <span class="reserved">this</span>.hsl(); - var h = Number(hslArray[0]); - var s = Number(hslArray[1]) * <span class="reserved">this</span>.Desaturated; - var l = <span class="reserved">this</span>.Luminosity; - var desA = <span class="reserved">this</span>.hslToRgb(h, s, l); - <span class="reserved">return</span> new Color(desA[0], desA[1], desA[2]); -}; -</pre> - <hr> - - - -<!-- ========== START OF NAVBAR ========== --> -<a name="navbar_top"><!-- --></a> -<table border="0" width="100%" cellpadding="1" cellspacing="0"> -<tr> -<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1"> -<a name="navbar_top_firstrow"><!-- --></a> -<table border="0" cellpadding="0" cellspacing="3"> - <tr align="center" valign="top"> - - - <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td> - <td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td> - - - <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td> - <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td> - <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td> - <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td> - </tr> -</table> -</td> -<td bgcolor="#EEEEFF" align="right" valign="top"><em> -<b></b></em> -</td> -</tr> - -<tr> -<td bgcolor="white" class="NavBarCell2"><font size="-2"> - PREV - NEXT</font></td> -<td bgcolor="white" class="NavBarCell2"><font size="-2"> - <a href="index.html" target="_top"><b>FRAMES</b></a> - <a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a> - -<script> - <!-- - if(window==top) { - document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); - } - //--> -</script> -<noscript> -<a href="allclasses-noframe.html" target=""><b>All Classes</b></a> -</noscript> -</font></td> -</tr> -</table> -<!-- =========== END OF NAVBAR =========== --> - -<hr> -<font size="-1"> - -</font> -<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Wed Jun 23 09:33:14 2010</div> -</body> -</html> |