PaintUtils { public static Color blend(Color origin, Color over) { if (over == null) { return origin; } if (origin == null) { return over; } int a = over.getAlpha(); int rb = (((over.getRGB() & 0x00ff00ff) * (a + 1)) + ((origin.getRGB() & 0x00ff00ff) * (0xff - a))) & 0xff00ff00; int g = (((over.getRGB() & 0x0000ff00) * (a + 1)) + ((origin.getRGB() & 0x0000ff00) * (0xff - a))) & 0x00ff0000; return new Color((over.getRGB() & 0xff000000) | ((rb | g) >> 8)); } private  PaintUtils(); static Paint resizeGradient(Paint p, int width, int height); static Paint getCheckerPaint(); static Paint getCheckerPaint(Paint c1, Paint c2, int size); static String toHexString(Color color); static Color removeAlpha(Color color); static Color setAlpha(Color color, int alpha); static Color setSaturation(Color color, float saturation); static Color setBrightness(Color color, float brightness); static Color blend(Color origin, Color over); static Color interpolate(Color b, Color a, float t); static Color computeForeground(Color bg); static final GradientPaint BLUE_EXPERIENCE; static final GradientPaint MAC_OSX_SELECTED; static final GradientPaint MAC_OSX; static final GradientPaint AERITH; static final GradientPaint GRAY; static final GradientPaint RED_XP; static final GradientPaint NIGHT_GRAY; static final GradientPaint NIGHT_GRAY_LIGHT; static final Paint ORANGE_DELIGHT; static final Paint BLACK_STAR; }
@Test public void testBlendWith255() { assertThat(PaintUtils.blend(Color.BLACK, Color.WHITE), is(Color.WHITE)); }
@Test public void testBlendWithNullSrc() { assertThat(PaintUtils.blend(null, Color.WHITE), is(Color.WHITE)); }
@Test public void testBlendWithNullOver() { assertThat(PaintUtils.blend(Color.BLACK, null), is(Color.BLACK)); }