public void setRadius(float radius) { if (!FloatUtil.floatsEqual(mBorderRadius,radius)) { mBorderRadius = radius; mNeedUpdatePathForBorderRadius = true; invalidateSelf(); } }
public void setRadius(float radius, int position) { if (mBorderCornerRadii == null) { mBorderCornerRadii = new float[4]; Arrays.fill(mBorderCornerRadii, CSSConstants.UNDEFINED); } if (!FloatUtil.floatsEqual(mBorderCornerRadii[position], radius)) { mBorderCornerRadii[position] = radius; mNeedUpdatePathForBorderRadius = true; invalidateSelf(); } }
@Override public void process(Bitmap output, Bitmap source) { cornerRadii(sComputedCornerRadii); output.setHasAlpha(true); if (FloatUtil.floatsEqual(sComputedCornerRadii[0], 0f) && FloatUtil.floatsEqual(sComputedCornerRadii[1], 0f) && FloatUtil.floatsEqual(sComputedCornerRadii[2], 0f) && FloatUtil.floatsEqual(sComputedCornerRadii[3], 0f)) { super.process(output, source); return; } Paint paint = new Paint(); paint.setAntiAlias(true); paint.setShader(new BitmapShader(source, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP)); Canvas canvas = new Canvas(output); float[] radii = new float[8]; getRadii(source, sComputedCornerRadii, radii); Path pathForBorderRadius = new Path(); pathForBorderRadius.addRoundRect( new RectF(0, 0, source.getWidth(), source.getHeight()), radii, Path.Direction.CW); canvas.drawPath(pathForBorderRadius, paint); }
public void setBorderRadius(float borderRadius, int position) { if (mBorderCornerRadii == null) { mBorderCornerRadii = new float[4]; Arrays.fill(mBorderCornerRadii, CSSConstants.UNDEFINED); } if (!FloatUtil.floatsEqual(mBorderCornerRadii[position], borderRadius)) { mBorderCornerRadii[position] = borderRadius; mIsDirty = true; } }
public void setBorderRadius(float borderRadius) { if (!FloatUtil.floatsEqual(mBorderRadius, borderRadius)) { mBorderRadius = borderRadius; mIsDirty = true; } }