mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge branch 'background-image-android-clip'
This commit is contained in:
@@ -85,13 +85,20 @@ class BorderGradientDrawable extends android.graphics.drawable.GradientDrawable
|
||||
}
|
||||
|
||||
public draw(canvas: android.graphics.Canvas): void {
|
||||
if (this.bitmap) {
|
||||
this.setColor(android.graphics.Color.TRANSPARENT);
|
||||
super.draw(canvas);
|
||||
|
||||
if (this.bitmap) {
|
||||
var radius = this._cornerRadius * this._density;
|
||||
var stroke = this._borderWidth * this._density;
|
||||
|
||||
var bounds = this.getBounds();
|
||||
|
||||
var path = new android.graphics.Path();
|
||||
path.addRoundRect(new android.graphics.RectF(stroke, stroke, bounds.right - stroke, bounds.bottom - stroke), radius, radius, android.graphics.Path.Direction.CW)
|
||||
canvas.clipPath(path);
|
||||
|
||||
canvas.drawBitmap(this.bitmap, stroke, stroke, undefined);
|
||||
}
|
||||
super.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user