Here you can find the source of increaseGreen(Bitmap src, int value)
Parameter | Description |
---|---|
src | the src |
value | the value |
public static Bitmap increaseGreen(Bitmap src, int value)
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Color; public class Main { /**/*from w ww .j a v a 2s . c o m*/ * Increase green. * * @param src the src * @param value the value * @return the bitmap */ public static Bitmap increaseGreen(Bitmap src, int value) { int width = src.getWidth(); int height = src.getHeight(); final float factor = 1.1f; 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; } }