Android examples for Graphics:Pixel
verify Pixel With Threshold
//package com.java2s; import android.graphics.Color; public class Main { /**// w ww . j a v a2 s . c om * @return True if close enough */ public static boolean verifyPixelWithThreshold(int color, int expectedColor, int threshold) { int diff = Math.abs(Color.red(color) - Color.red(expectedColor)) + Math.abs(Color.green(color) - Color.green(expectedColor)) + Math.abs(Color.blue(color) - Color.blue(expectedColor)); return diff <= threshold; } }