Java Color Blend blendColors(Color from, Color to, double toFraction)

Here you can find the source of blendColors(Color from, Color to, double toFraction)

Description

blend Colors

License

Artistic License

Declaration

public static Color blendColors(Color from, Color to, double toFraction) 

Method Source Code


//package com.java2s;
//License from project: Artistic License 

import java.awt.Color;

public class Main {
    public static Color blendColors(Color from, Color to, double toFraction) {
        toFraction = Math.min(1.0, toFraction);
        double fromFraction = 1 - toFraction;
        return new Color((int) (from.getRed() * fromFraction + to.getRed() * toFraction),
                (int) (from.getGreen() * fromFraction + to.getGreen() * toFraction),
                (int) (from.getBlue() * fromFraction + to.getBlue() * toFraction));
    }/*www .j a v a 2  s . c  om*/
}

Related

  1. blendAlpha(Color under, Color over)
  2. blendcol(Color in, Color bl)
  3. blendColor(Color clOne, Color clTwo, double amount)
  4. blendColorKeepAlpha(Color source, Color dest)
  5. blendColors(Color color, Color color1, double d)
  6. blendColorsUnsafe(final float[] fractions, final Color[] colors, final float progress)