private void buildShadowCorners() {
RectF innerBounds = new RectF(-this.mCornerRadius, -this.mCornerRadius, this.mCornerRadius, this.mCornerRadius);
RectF outerBounds = new RectF(innerBounds);
outerBounds.inset(-this.mShadowSize, -this.mShadowSize);
if (this.mCornerShadowPath == null) {
this.mCornerShadowPath = new Path();
} else {
this.mCornerShadowPath.reset();
}
this.mCornerShadowPath.setFillType(FillType.EVEN_ODD);
this.mCornerShadowPath.moveTo(-this.mCornerRadius, 0.0f);
this.mCornerShadowPath.rLineTo(-this.mShadowSize, 0.0f);
this.mCornerShadowPath.arcTo(outerBounds, 180.0f, 90.0f, false);
this.mCornerShadowPath.arcTo(innerBounds, 270.0f, -90.0f, false);
this.mCornerShadowPath.close();
float startRatio = this.mCornerRadius / (this.mCornerRadius + this.mShadowSize);
this.mCornerShadowPaint.setShader(new RadialGradient(0.0f, 0.0f, this.mCornerRadius + this.mShadowSize, new int[]{this.mShadowStartColor, this.mShadowStartColor, this.mShadowEndColor}, new float[]{0.0f, startRatio, 1.0f}, TileMode.CLAMP));
this.mEdgeShadowPaint.setShader(new LinearGradient(0.0f, (-this.mCornerRadius) + this.mShadowSize, 0.0f, (-this.mCornerRadius) - this.mShadowSize, new int[]{this.mShadowStartColor, this.mShadowStartColor, this.mShadowEndColor}, new float[]{0.0f, 0.5f, 1.0f}, TileMode.CLAMP));
this.mEdgeShadowPaint.setAntiAlias(false);
}
RoundRectDrawableWithShadow.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:boohee_v5.6
作者:
评论列表
文章目录