B4J Library jColorUtils

Hi,

This library is the port of the JavaFx Color functions. http://docs.oracle.com/javafx/2/api/javafx/scene/paint/Color.html

I packed all the functions in a library called ColorUtils, that you can call the same way as DateUtils. Some methods have the non alpha version and the alpha version (with an "A" after their names).

Example:
B4X:
Log("Color equal to blue?: " & ColorUtils.Equals(MainForm.BackColor, fx.Colors.Blue))
Log("Blue: " & ColorUtils.GetBlue(MainForm.BackColor))
Log("Brigtness: " & ColorUtils.GetBrightness(MainForm.BackColor))
Log("Green: " & ColorUtils.GetGreen(MainForm.BackColor))
Log("Hue: " & ColorUtils.GetHue(MainForm.BackColor))
Log("Red: " & ColorUtils.GetRed(MainForm.BackColor))
Log("Opacity: " & ColorUtils.GetOpacity(MainForm.BackColor))
Log("Saturation: " & ColorUtils.GetSaturation(MainForm.BackColor))
Log("Hashcode: " & ColorUtils.Hashcode(MainForm.BackColor))
Log("Tostring: " & ColorUtils.Tostring(MainForm.BackColor))
Log("valueOf: " & ColorUtils.ValueOf("0x232323ff"))
MainForm.BackColor = ColorUtils.Desaturate(MainForm.BackColor)

Enjoy.
 

Attachments

  • jColorUtils.zip
    4 KB · Views: 521
  • jColorUtils_Example.zip
    1.2 KB · Views: 465
Top