Java Color Blend blendColorKeepAlpha(Color source, Color dest)

Here you can find the source of blendColorKeepAlpha(Color source, Color dest)

Description

blend Color Keep Alpha

License

Open Source License

Declaration

public static Color blendColorKeepAlpha(Color source, Color dest) 

Method Source Code


//package com.java2s;
import java.awt.*;

public class Main {
    public static Color blendColorKeepAlpha(Color source, Color dest) {
        return new Color(
                (int) (source.getRed() + (float) (dest.getRed() - source.getRed()) * (dest.getAlpha() / 255.0f)),
                (int) (source.getGreen()
                        + (float) (dest.getGreen() - source.getGreen()) * (dest.getAlpha() / 255.0f)),
                (int) (source.getBlue() + (float) (dest.getBlue() - source.getBlue()) * (dest.getAlpha() / 255.0f)),
                source.getAlpha());//from  www  . j  av a  2s. c om
    }
}

Related

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