Code example for Paint

Methods: setShader

	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));
Experience pair programming with AI  Get Codota for Java