Java examples for 2D Graphics:Color
get Color Steppers
//package com.java2s; import java.awt.Color; public class Main { public static int[] getColorSteppers(Color c1, Color c2, int dividend) { int r = 0, g = 0, b = 0, a = 0; r = (c2.getRed() - c1.getRed()) / dividend; g = (c2.getGreen() - c1.getGreen()) / dividend; b = (c2.getBlue() - c1.getBlue()) / dividend; a = (c2.getAlpha() - c1.getAlpha()) / dividend; return new int[] { r, g, b, a }; }/*from ww w . j a va2 s. c o m*/ public static double[] getColorSteppers(Color c1, Color c2, double dividend) { double r = 0, g = 0, b = 0, a = 0; r = (c2.getRed() - c1.getRed()) / dividend; g = (c2.getGreen() - c1.getGreen()) / dividend; b = (c2.getBlue() - c1.getBlue()) / dividend; a = (c2.getAlpha() - c1.getAlpha()) / dividend; return new double[] { r, g, b, a }; } }