Android Bitmap Color Get getPixelsCount(Bitmap bitmap)

Here you can find the source of getPixelsCount(Bitmap bitmap)

Description

get Pixels Count

Declaration

public static int getPixelsCount(Bitmap bitmap) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;

public class Main {
    public static int getPixelsCount(Bitmap bitmap) {
        int hlen = bitmap.getWidth(), vlen = bitmap.getHeight();
        int toReturn = 0;
        for (int i = 0; i < vlen; i++) {
            for (int j = 0; j < hlen; j++) {
                if ((bitmap.getPixel(j, i) & 0xff) > 0) {
                    toReturn++;/*w  ww .  jav a  2  s  . c o m*/
                }
            }
        }

        return toReturn;
    }
}

Related

  1. countSE(Bitmap bitmap, int[][] se)
  2. getContactCount(Bitmap bitmap)
  3. kernelMatch(int x, int y, int w, int h, Bitmap bitmap, int[][] se)
  4. getColorHistogram(Bitmap bitmap)
  5. isBitmapWhiteAtTopOrBottom(Bitmap largeBitmap)