- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 05 Mar 2009 22:58:40 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/values In directory hutz:/tmp/cvs-serv7988 Modified Files: HSLA.java Log Message: rewritten like HSL Index: HSLA.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/values/HSLA.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- HSLA.java 14 Sep 2005 15:15:33 -0000 1.4 +++ HSLA.java 5 Mar 2009 22:58:38 -0000 1.5 @@ -13,27 +13,47 @@ */ package org.w3c.css.values; +import org.w3c.css.util.Util; + public class HSLA { String output = null; - Object h; - Object s; - Object l; - Object a; + float fh; + float fs; + float fl; + float fa; /** - * Create a new HSLA + * Create a new HSL */ public HSLA() { } - /** - * Create a new RGBA with default values - */ - public HSLA(Object h, Object s, Object l, Object a) { - this.h = h; - this.s = s; - this.l = l; - this.a = a; + public void setHue(float hue) { + this.fh = (float)((((double)hue%360.0)+360.0)%360.0); + } + public void setHue(CssNumber hue) { + setHue(hue.getValue()); + } + + public void setSaturation(float sat) { + this.fs = sat; + } + public void setSaturation(CssNumber sat) { + setSaturation(sat.getValue()); + } + + public void setLightness(float light) { + this.fl = light; + } + public void setLightness(CssNumber light) { + setLightness(light.getValue()); + } + + public void setAlpha(float alpha) { + this.fa = alpha; + } + public void setAlpha(CssNumber alpha) { + setAlpha(alpha.getValue()); } /** @@ -41,9 +61,13 @@ */ public String toString() { if (output == null) { - return "hsla(" + h + ", " + s + ", " + l + ", " + a + ")"; - } else { - return output; + StringBuilder sb = new StringBuilder("hsl("); + sb.append(Util.displayFloat(fh)).append(", "); + sb.append(Util.displayFloat(fs)).append("%, "); + sb.append(Util.displayFloat(fl)).append("%, "); + sb.append(Util.displayFloat(fa)).append(")"); + output = sb.toString(); } + return output; } }
Received on Thursday, 5 March 2009 22:58:50 UTC