[prev in list] [next in list] [prev in thread] [next in thread]
List: e-lang
Subject: Re: [e-lang] Taming bug: java.awt.Color.getComponents and
From: "Mark S. Miller" <markm () caplet ! com>
Date: 2004-06-10 18:20:50
Message-ID: 6.1.0.6.2.20040610110607.04261e80 () caplet ! com
[Download RAW message or body]
At 08:31 AM 5/11/2004 Tuesday, Kevin Reid wrote:
> These enabled methods of java.awt.Color modify the passed arrays, and are \
> documented to do so:
> getColorComponents(ColorSpace, float[])
> getColorComponents(float[])
> getComponents(ColorSpace, float[])
> getComponents(float[])
> getRGBColorComponents(float[])
> getRGBComponents(float[])
> static float[] RGBtoHSB(int, int, int, float[])
>
> I suggest creating sugar methods which do not have the float[] arguments, and pass \
> null to the original methods. [...]
> ? def rl1 := red.getColorComponents(null)
> # value: [1.0, 0.0, 0.0]
In the upcoming 0.8.28e release, I've taken your suggestion: I've added sugar
methods for all these without the last float[] argument, that pass null to
the original. Because two of the originals already overloaded on arity, I
added an informative error when a ColorSpace argument is null:
? def red := <awt:Color>.getRed()
# value: java.awt.Color[r=255,g=0,b=0]
? def rl1 := red.getColorComponents(null)
# problem: Failed: Use getColorComponents/0
? def rl1 := red.getColorComponents()
# value: [1.0, 0.0, 0.0]
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
_______________________________________________
e-lang mailing list
e-lang@mail.eros-os.org
http://www.eros-os.org/mailman/listinfo/e-lang
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic