【发布时间】:2016-04-19 01:04:23
【问题描述】:
我想通过 NativeScript 访问 Canvas,但我似乎找不到桥接入口点。因为 _CreateUI 不会在画布中传递,而 Java 中的 onDraw 会传递。
我想做以下 NativeScript Equiv:
@Override
protected void onDraw(Canvas canvas) {
// floor the border width to avoid gaps between the border and the image
float roundedBorderWidth = (float) Math.floor(this.borderWidth);
float innerRadius = Math.max(0, this.cornerRadius - roundedBorderWidth);
// The border width is included in the padding so there is no need for
// clip if there is no inner border radius.
if (innerRadius != 0) {
this.rect.set(
roundedBorderWidth,
roundedBorderWidth,
this.getWidth() - roundedBorderWidth,
this.getHeight() - roundedBorderWidth);
this.path.reset();
this.path.addRoundRect(rect, innerRadius, innerRadius, android.graphics.Path.Direction.CW);
canvas.clipPath(this.path);
}
super.onDraw(canvas);
}
谢谢 菲尔
【问题讨论】:
标签: android-canvas nativescript