compare Color Span - Android Graphics

Android examples for Graphics:Color Operation

Description

compare Color Span

Demo Code


//package com.java2s;
import android.graphics.Color;

public class Main {

    public static int compareSpan(int colorOld, int colorLast) {
        int or = Color.red(colorOld);
        int og = Color.green(colorOld);
        int ob = Color.blue(colorOld);

        int lr = Color.red(colorLast);
        int lg = Color.green(colorLast);
        int lb = Color.blue(colorLast);
        return (Math.abs(or - lr) + Math.abs(og - lg) + Math.abs(ob - lb)) / 3;
    }//w  ww  .java2s  .co  m
}

Related Tutorials