Java Color Blend blendColors(Color color, Color color1, double d)

Here you can find the source of blendColors(Color color, Color color1, double d)

Description

blend Colors

License

Open Source License

Declaration

public static Color blendColors(Color color, Color color1, double d) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.*;

public class Main {
    public static Color blendColors(Color color, Color color1, double d) {
        if (color == null || color1 == null) {
            return null;
        } else {/*from   ww  w . j a  v a 2 s . c o  m*/
            int i = (int) ((double) color1.getRed() * d + (double) color.getRed() * (1.0D - d));
            int j = (int) ((double) color1.getGreen() * d + (double) color.getGreen() * (1.0D - d));
            int k = (int) ((double) color1.getBlue() * d + (double) color.getBlue() * (1.0D - d));
            int l = color.getAlpha();
            return new Color(i, j, k, l);
        }
    }
}

Related

  1. blend(final Color first, final Color second, final float alpha)
  2. blendAlpha(Color under, Color over)
  3. blendcol(Color in, Color bl)
  4. blendColor(Color clOne, Color clTwo, double amount)
  5. blendColorKeepAlpha(Color source, Color dest)
  6. blendColors(Color from, Color to, double toFraction)
  7. blendColorsUnsafe(final float[] fractions, final Color[] colors, final float progress)