GraphicsUtils { public static double[] rgb2luv(double[] rgb, double[] luv) { double[] xyz = rgb2xyz(rgb, null); return xyz2luv(xyz, luv); } protected  GraphicsUtils(); static Shape getOutline(String text, Font font, float wrappingWidth,
			double alignment); static void fillPaintedShape(Graphics2D graphics, Shape shape,
			Paint paint, Rectangle2D paintBounds); static void drawPaintedShape(Graphics2D graphics, Shape shape,
			Paint paint, Rectangle2D paintBounds, Stroke stroke); static double[] rgb2xyz(double[] rgb, double[] xyz); static double[] luv2xyz(double[] luv, double[] xyz); static double[] xyz2rgb(double[] xyz, double[] rgb); static double[] xyz2luv(double[] xyz, double[] luv); static double[] rgb2luv(double[] rgb, double[] luv); static double[] luv2rgb(double[] luv, double[] rgb); static Color blend(Color color1, Color color2, double weight); static Color deriveWithAlpha(Color color, int alpha); static Color deriveDarker(Color color); static Color deriveBrighter(Color color);  }
@Test public void testRgb2Luv() { double[] luv = new double[3]; GraphicsUtils.rgb2luv(new double[] { 0.0, 0.0, 0.0 }, luv); assertEqualsArray(new double[] { 0.00000000000000, 0.00000000000000000000, 0.000000000000000000000 }, luv, DELTA); GraphicsUtils.rgb2luv(new double[] { 0.0, 0.5, 1.0 }, luv); assertEqualsArray(new double[] { 53.39149927909138, -34.19278610160572000000,-101.728990843596360000000 }, luv, DELTA); GraphicsUtils.rgb2luv(new double[] { 0.5, 0.5, 0.5 }, luv); assertEqualsArray(new double[] { 53.38894494212407, 0.00009162075020892017, -0.000087416607597709690 }, luv, DELTA); GraphicsUtils.rgb2luv(new double[] { 1.0, 0.5, 0.0 }, luv); assertEqualsArray(new double[] { 67.71991853084089, 107.44568793469313000000, 46.013808290473584000000 }, luv, DELTA); GraphicsUtils.rgb2luv(new double[] { 1.0, 1.0, 1.0 }, luv); assertEqualsArray(new double[] { 99.99996690132389, 0.00017160990909819560, -0.000163735355247670150 }, luv, DELTA); }