Java Code Examples for android.graphics.RadialGradient#setLocalMatrix()

The following examples show how to use android.graphics.RadialGradient#setLocalMatrix() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamActivity.java    From codeexamples-android with Eclipse Public License 1.0 6 votes vote down vote up
@Override
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));
	}
}
 
Example 2
Source File: RoundedVignetteBitmapDisplayer.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBoundsChange(Rect bounds) {
    super.onBoundsChange(bounds);
    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);

    paint.setShader(new ComposeShader(bitmapShader, vignette, PorterDuff.Mode.SRC_OVER));
}
 
Example 3
Source File: RoundedVignetteBitmapDisplayer.java    From letv with Apache License 2.0 5 votes vote down vote up
protected void onBoundsChange(Rect bounds) {
    super.onBoundsChange(bounds);
    RadialGradient vignette = new RadialGradient(this.mRect.centerX(), (this.mRect.centerY() * 1.0f) / 0.7f, this.mRect.centerX() * 1.3f, new int[]{0, 0, 2130706432}, new float[]{0.0f, 0.7f, 1.0f}, TileMode.CLAMP);
    Matrix oval = new Matrix();
    oval.setScale(1.0f, 0.7f);
    vignette.setLocalMatrix(oval);
    this.paint.setShader(new ComposeShader(this.bitmapShader, vignette, Mode.SRC_OVER));
}
 
Example 4
Source File: RevealDrawable.java    From MDPreference with Apache License 2.0 5 votes vote down vote up
private void fillCanvasWithHole(Canvas canvas, ColorChangeTask task, float radius, boolean transparent){
	if(transparent)
		return;
	
	float scale = radius / GRADIENT_RADIUS;
	
	mMatrix.reset();
	mMatrix.postScale(scale, scale, task.x, task.y);
	RadialGradient shader = getShader(task);
	shader.setLocalMatrix(mMatrix);
	mShaderPaint.setShader(shader);
	canvas.drawRect(getBounds(), mShaderPaint);
}
 
Example 5
Source File: RoundedVignetteBitmapDisplayer.java    From Android-Application-ZJB with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBoundsChange(Rect bounds) {
	super.onBoundsChange(bounds);
	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);

	paint.setShader(new ComposeShader(bitmapShader, vignette, PorterDuff.Mode.SRC_OVER));
}
 
Example 6
Source File: RoundedLomoBitmapDisplayer.java    From Android-Application-ZJB with Apache License 2.0 5 votes vote down vote up
protected void onBoundsChange(Rect bounds) {
    super.onBoundsChange(bounds);
    RadialGradient vignette = new RadialGradient(this.mRect.centerX(), this.mRect.centerY() * 1.0F / 0.7F, this.mRect.centerX() * 1.3F, new int[]{0, 0, 2130706432}, new float[]{0.0F, 0.7F, 1.0F}, TileMode.CLAMP);
    Matrix oval = new Matrix();
    oval.setScale(1.0F, 0.7F);
    vignette.setLocalMatrix(oval);
    this.paint.setShader(new ComposeShader(this.bitmapShader, vignette, Mode.SRC_OVER));
}
 
Example 7
Source File: RoundedVignetteBitmapDisplayer.java    From WliveTV with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBoundsChange(Rect bounds) {
	super.onBoundsChange(bounds);
	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);

	paint.setShader(new ComposeShader(bitmapShader, vignette, PorterDuff.Mode.SRC_OVER));
}
 
Example 8
Source File: RevealDrawable.java    From material with Apache License 2.0 5 votes vote down vote up
private void fillCanvasWithHole(Canvas canvas, ColorChangeTask task, float radius, boolean transparent){
	if(transparent)
		return;
	
	float scale = radius / GRADIENT_RADIUS;
	
	mMatrix.reset();
	mMatrix.postScale(scale, scale, task.x, task.y);
	RadialGradient shader = getShader(task);
	shader.setLocalMatrix(mMatrix);
	mShaderPaint.setShader(shader);
	canvas.drawRect(getBounds(), mShaderPaint);
}