Compares two pixels and returns true if they are different, otherwise returns false - Java 2D Graphics

Java examples for 2D Graphics:Pixel

Description

Compares two pixels and returns true if they are different, otherwise returns false

Demo Code

/**//from   w  ww. j  av a2  s.  c  o  m
 *   Copyright 2012 Dr. Krusche & Partner PartG
 *
 *   AMES-Web-Service is free software: you can redistribute it and/or 
 *   modify it under the terms of the GNU General Public License 
 *   as published by the Free Software Foundation, either version 3 of 
 *   the License, or (at your option) any later version.
 *
 *   AMES- Web-Service is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * 
 *  See the GNU General Public License for more details. 
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this software. If not, see <http://www.gnu.org/licenses/>.
 *
 */
//package com.java2s;

public class Main {
    /**
     * Compares two pixels and returns true if they 
     * are different, otherwise returns false
     * 
     * @param p1
     * @param p2
     * @return
     */
    public static boolean comparePixel(int[] p1, int[] p2) {
        return ((p2[0] == p1[0]) && (p2[1] == p1[1]) && (p2[2] == p1[2])
                && (p2[3] == p1[3]) ? false : true);
    }
}

Related Tutorials