Code example for RadialGradient

Methods: setLocalMatrix

0
	protected void onBoundsChange(Rect bounds) {
		super.onBoundsChange(bounds);
		mRect.set(mMargin, mMargin, bounds.width() - mMargin, bounds.height() - mMargin);
 
		if (USE_VIGNETTE) {
			RadialGradient vignette = new RadialGradient(
					mRect.centerX(), mRect.centerY() * 1.0f / 0.7f, mRect.centerX() * 1.3f,
					new int[] { 0, 0, 0x7f000000 }, new float[] { 0.0f, 0.7f, 1.0f }, 
					Shader.TileMode.CLAMP);
 
			Matrix oval = new Matrix();
			oval.setScale(1.0f, 0.7f);
			vignette.setLocalMatrix(oval);
 
			mPaint.setShader(
					new ComposeShader(mBitmapShader, vignette, PorterDuff.Mode.SRC_OVER));
		} 
	} 
 
	@Override 
	public void draw(Canvas canvas) {