Java Color Mix mix(double x, double y, double a)

Here you can find the source of mix(double x, double y, double a)

Description

mix

License

Open Source License

Declaration

public static double mix(double x, double y, double a) 

Method Source Code

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

import java.awt.*;

public class Main {
    public static double mix(double x, double y, double a) {
        return x + a * (y - x);
    }/*from w  w w  . j av a2s . c o m*/

    public static Color mix(Color c1, Color c2, double a) {
        double red = c1.getRed() + a * (c2.getRed() - c1.getRed());
        double green = c1.getGreen() + a * (c2.getGreen() - c1.getGreen());
        double blue = c1.getBlue() + a * (c2.getBlue() - c1.getBlue());
        return new Color((int) red, (int) green, (int) blue);
    }
}

Related

  1. mix(Color c1, Color c2)
  2. mix(Color c1, Color c2, boolean useAlpha)
  3. mix(Color c1, Color c2, double f)
  4. mix(Color c1, Color c2, float bias)
  5. mix(Color src, Color dst, double factor)
  6. mix(final Color c1, final Color c2, final double factor)
  7. mix(int a, int b, int amt)
  8. mixColor(Paint p, double value)
  9. mixColors(Color a, Color b, double r)