Here you can find the source of makeVivid(Bitmap src, int type, float percent)
Parameter | Description |
---|---|
src | the src |
type | the type |
percent | the percent |
public static Bitmap makeVivid(Bitmap src, int type, float percent)
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Color; public class Main { /**// ww w. j a v a 2 s . co m * Make colors in bitmap vivid. * * @param src * the src * @param type * the type * @param percent * the percent * @return the bitmap * @author siddhesh */ public static Bitmap makeVivid(Bitmap src, int type, float percent) { int width = src.getWidth(); int height = src.getHeight(); Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig()); int A, R, G, B; int pixel; for (int x = 0; x < width; ++x) { for (int y = 0; y < height; ++y) { pixel = src.getPixel(x, y); A = Color.alpha(pixel); R = Color.red(pixel); G = Color.green(pixel); B = Color.blue(pixel); // Log.e("CHECK", "RGB : R = " + R + " G = " + G + " B = " + B); R = (int) (R * (1 + percent)); if (R > 255) R = 255; G = (int) (G * (1 + percent)); if (G > 255) G = 255; B = (int) (B * (1 + percent)); if (B > 255) B = 255; bmOut.setPixel(x, y, Color.argb(A, R, G, B)); } } return bmOut; } }