add Colors - Java 2D Graphics

Java examples for 2D Graphics:Color

Description

add Colors

Demo Code


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

public class Main {
    public static Color addColors(Color c1, Color c2) {
        return new Color(Math.min(c1.getRed() + c2.getRed(), 255),
                Math.min(c1.getGreen() + c2.getGreen(), 255), Math.min(
                        c1.getBlue() + c2.getBlue(), 255));
    }/*from  ww  w.j  a  va2s. c o m*/
}

Related Tutorials