use of android.graphics.RectF in project UltimateAndroid by cymcsg.
the class RotaryView method Init.
public void Init() {
dp = getResources().getDimension(R.dimen.triangle_dp);
bitmapScale = BitmapFactory.decodeResource(getResources(), R.drawable.triangle_icon_round_calibration);
brWidth = bitmapScale.getWidth();
brHeight = bitmapScale.getHeight();
WidthCenter = getWidth() / 2;
HeightCenter = getHeight() / 2;
zoom(0f);
rectf = new RectF();
rectf.set(dp * 0.1f, dp * 0.1f, getWidth() - dp * 0.1f, getHeight() - dp * 0.1f);
}
use of android.graphics.RectF in project UltimateAndroid by cymcsg.
the class ArcDrawable method onBoundsChange.
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
mWidth = dp2px(40);
mHeight = mWidth;
mBounds = new RectF(bounds.width() / 2 - mWidth / 2, bounds.top, bounds.width() / 2 + mWidth / 2, bounds.top + mHeight);
}
use of android.graphics.RectF in project UltimateAndroid by cymcsg.
the class RingDrawable method onBoundsChange.
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
mWidth = getRefreshLayout().getFinalOffset();
mHeight = mWidth;
mBounds = new RectF(bounds.width() / 2 - mWidth / 2, bounds.top, bounds.width() / 2 + mWidth / 2, bounds.top + mHeight);
mBounds.inset(dp2px(15), dp2px(15));
}
use of android.graphics.RectF in project UltimateAndroid by cymcsg.
the class ProgressWheel method setupBounds.
/**
* Set the bounds of the component
*/
private void setupBounds() {
// Width should equal to Height, find the min value to steup the circle
int minValue = Math.min(layout_width, layout_height);
// Calc the Offset if needed
int xOffset = layout_width - minValue;
int yOffset = layout_height - minValue;
// Add the offset
paddingTop = this.getPaddingTop() + (yOffset / 2);
paddingBottom = this.getPaddingBottom() + (yOffset / 2);
paddingLeft = this.getPaddingLeft() + (xOffset / 2);
paddingRight = this.getPaddingRight() + (xOffset / 2);
//this.getLayoutParams().width;
int width = getWidth();
//this.getLayoutParams().height;
int height = getHeight();
rectBounds = new RectF(paddingLeft, paddingTop, width - paddingRight, height - paddingBottom);
circleBounds = new RectF(paddingLeft + barWidth, paddingTop + barWidth, width - paddingRight - barWidth, height - paddingBottom - barWidth);
circleInnerContour = new RectF(circleBounds.left + (rimWidth / 2.0f) + (contourSize / 2.0f), circleBounds.top + (rimWidth / 2.0f) + (contourSize / 2.0f), circleBounds.right - (rimWidth / 2.0f) - (contourSize / 2.0f), circleBounds.bottom - (rimWidth / 2.0f) - (contourSize / 2.0f));
circleOuterContour = new RectF(circleBounds.left - (rimWidth / 2.0f) - (contourSize / 2.0f), circleBounds.top - (rimWidth / 2.0f) - (contourSize / 2.0f), circleBounds.right + (rimWidth / 2.0f) + (contourSize / 2.0f), circleBounds.bottom + (rimWidth / 2.0f) + (contourSize / 2.0f));
fullRadius = (width - paddingRight - barWidth) / 2;
circleRadius = (fullRadius - barWidth) + 1;
}
use of android.graphics.RectF in project Depth-LIB-Android- by danielzeller.
the class CustomShadow method buildShadowCorners.
private void buildShadowCorners() {
RectF innerBounds = new RectF(-mCornerRadius, -mCornerRadius, mCornerRadius, mCornerRadius);
RectF outerBounds = new RectF(innerBounds);
outerBounds.inset(-mShadowSize, -mShadowSize);
if (mCornerShadowPath == null) {
mCornerShadowPath = new Path();
} else {
mCornerShadowPath.reset();
}
mCornerShadowPath.setFillType(Path.FillType.EVEN_ODD);
mCornerShadowPath.moveTo(-mCornerRadius, 0);
mCornerShadowPath.rLineTo(-mShadowSize, 0);
// outer arc
mCornerShadowPath.arcTo(outerBounds, 180f, 90f, false);
// inner arc
mCornerShadowPath.arcTo(innerBounds, 270f, -90f, false);
mCornerShadowPath.close();
float startRatio = mCornerRadius / (mCornerRadius + mShadowSize);
mCornerShadowPaint.setShader(new RadialGradient(0, 0, mCornerRadius + mShadowSize, new int[] { mShadowStartColor, mShadowStartColor, mShadowEndColor }, new float[] { 0f, startRatio, 1f }, Shader.TileMode.CLAMP));
// we offset the content shadowSize/2 pixels up to make it more realistic.
// this is why edge shadow shader has some extra space
// When drawing bottom edge shadow, we use that extra space.
mEdgeShadowPaint.setShader(new LinearGradient(0, -mCornerRadius + mShadowSize, 0, -mCornerRadius - mShadowSize, new int[] { mShadowStartColor, mShadowStartColor, mShadowEndColor }, new float[] { 0f, .5f, 1f }, Shader.TileMode.CLAMP));
mEdgeShadowPaint.setAntiAlias(false);
}
Aggregations