Here you can find the source of boost(Bitmap src)
Parameter | Description |
---|---|
src | the src |
public static Bitmap boost(Bitmap src)
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Color; public class Main { /**//from w w w . j a v a 2 s . c o m * Boost color intensity. * * @param src * the src * @return the bitmap * @author siddhesh */ public static Bitmap boost(Bitmap src) { int width = src.getWidth(); int height = src.getHeight(); final float factor = 1.3f; Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig()); int[] pix = new int[width * height]; src.getPixels(pix, 0, width, 0, 0, width, height); int A, R, G, B; int i = 0; for (int pixel : pix) { A = Color.alpha(pixel); R = Color.red(pixel); G = Color.green(pixel); B = Color.blue(pixel); R = (int) (R * factor); if (R > 255) R = 255; G = (int) (G * factor); if (G > 255) G = 255; B = (int) (B * factor); if (B > 255) B = 255; pix[i] = Color.argb(A, R, G, B); i++; } bmOut.setPixels(pix, 0, width, 0, 0, width, height); // src.recycle(); return bmOut; } }