From f71b2f6c8b525436c233dccc096c5b036ed25990 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Thu, 18 Jun 2015 15:26:00 +0300 Subject: [PATCH] bitmap clip fixed --- ui/styling/stylers.android.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ui/styling/stylers.android.ts b/ui/styling/stylers.android.ts index 07bf52842..297069621 100644 --- a/ui/styling/stylers.android.ts +++ b/ui/styling/stylers.android.ts @@ -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); } }