Java Color Merge mergeColor(Color a, Color b)

Here you can find the source of mergeColor(Color a, Color b)

Description

merge Color

License

Open Source License

Declaration

public static Color mergeColor(Color a, Color b) 

Method Source Code


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

import java.awt.Color;

public class Main {
    public static Color mergeColor(Color a, Color b) {
        return new Color((a.getRed() + b.getRed()) / 2, (a.getGreen() + b.getGreen()) / 2,
                (a.getBlue() + b.getBlue()) / 2,
                (a.getAlpha() + b.getAlpha()) / 2 + Math.abs(b.getAlpha() - a.getAlpha()));
    }//from  www .j a  v a  2s .  co  m
}

Related

  1. mergeColor(Color c1, Color c2)
  2. mergeColors(Color a, float fa, Color b, float fb)
  3. mergeColors(Color color1, Color color2)
  4. mergeCols(Color col1, Color col2)