package com.joe.bitmap;import Android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.graphics.Bitmap.Config; import android.util.Log;public class BitmapUtils { private static final String TAG = "BitmapUtils"; /** * Set the pixels"s alpha. alpha"s value decrease by the bit"s height * @param pixels * the array which contains pixels. * @param srcWidth * the bitmap"s width * @param srcHeight * the bitmap"s height * @param alphastart * the first pixels"s alpha * @param percent * the line"s fouction"s slope (y = mx+b;) * such as: alphastart=0x2fffffff;(alpha"s value 0x2f) * m = 0x2f/(height * percent) (if the shadow fill full of the * bitmap,k =1. otherwise the shadow only in a half of the bitmap * percent = 0.5) alpha = m*height + alphaLagest * The percent max value are 1! * @param b * the line"s fouction"s const (y = mx+b) */ public static void shadowFromPixels(int[] pixels, int srcWidth, int srcHeight, int alphastart, float percent) { int b = alphastart; //if need display a part of (such as 1/2,1/3...) bitmap int alpahLine = (int) (srcHeight * percent);