Code example for BitmapShader

    private void initializeBitmapShader() { 
	// A bitmap-shader to draw the bitmap. 
        // Clamp mode will repeat the last row of pixels. 
        // Hence its better to have an endAlpha of 0 for the linear-gradient. 
	BitmapShader bitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
	// A linear-gradient to specify the opacity of the bitmap. 
	LinearGradient gradient = new LinearGradient(0, 0, 0, mBitmap.getHeight(), mStartColor, mEndColor, Shader.TileMode.CLAMP);
	// Make a combined shader -- a performance win. 
        // The linear-gradient is the 'SRC' and the bitmap-shader is the 'DST'. 
	// Drawing the DST in the SRC will provide the opacity. 
	mPaint.setShader(new ComposeShader(bitmapShader, gradient, PorterDuff.Mode.DST_IN));
Stop searching for code, let great code find you!  Add Codota to your java IDE