@Override public void getOutline(View view, Outline outline) { Rect bounds = new Rect(); mBorderRect.roundOut(bounds); outline.setRoundRect(bounds, bounds.width() / 2.0f); }
@Override public void getOutline(View view, Outline outline) { Rect bounds = new Rect(); mBorderRect.roundOut(bounds); outline.setRoundRect(bounds, bounds.width() / 2.0f); }
RectF rectF = new RectF(0.0f, 0.0f, 10.5f, 20.f); Rect rect = new Rect(); rectF.roundOut(rect);// Now rect will contains these values Rect(0, 0, 11, 20) //What happens inside roundOut function Math.floor(0.0f);//Results 0 Math.floor(0.0f);//Results 0 Math.ceil(10.5f);//Results 10 Math.ceil(20.f);//Results 20
private Rect rectToPx(RectF rect) { rect.roundOut(mPixelRect); mPixelRect.left = (int) (mPixelRect.left * mDpToPx); mPixelRect.top = (int) (mPixelRect.top * mDpToPx); mPixelRect.right = (int) (mPixelRect.right * mDpToPx); mPixelRect.bottom = (int) (mPixelRect.bottom * mDpToPx); // Don't let any zero sized rects through, they'll cause parent // size errors in L. if (mPixelRect.width() == 0) { mPixelRect.right = mPixelRect.left + 1; } if (mPixelRect.height() == 0) { mPixelRect.bottom = mPixelRect.top + 1; } return mPixelRect; } }
@Override public void getOutline(View view, Outline outline) { Rect bounds = new Rect(); mBorderRect.roundOut(bounds); outline.setRoundRect(bounds, bounds.width() / 2.0f); } }
@Override public void getOutline(View view, Outline outline) { Rect bounds = new Rect(); mBorderRect.roundOut(bounds); outline.setRoundRect(bounds, bounds.width() / 2.0f); }
@Override public void getOutline(View view, Outline outline) { Rect bounds = new Rect(); mBorderRect.roundOut(bounds); outline.setRoundRect(bounds, bounds.width() / 2.0f); }
@Override public void getOutline(View view, Outline outline) { Rect bounds = new Rect(); mBorderRect.roundOut(bounds); outline.setRoundRect(bounds, bounds.width() / 2.0f); } }
@Override public void getOutline(View view, Outline outline) { Rect bounds = new Rect(); mBorderRect.roundOut(bounds); outline.setRoundRect(bounds, bounds.width() / 2.0f); }
@Override public void getOutline(View view, Outline outline) { Rect bounds = new Rect(); mBorderRect.roundOut(bounds); outline.setRoundRect(bounds, bounds.width() / 2.0f); }
public void getBounds(final Rect outBounds) { // Reuse mArc1 as working variable mPath.computeBounds(mArc1, true /* unused */); mArc1.roundOut(outBounds); } }
// get the Bitmap Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); // setup sample Path Path path = new Path(); path.moveTo(10, 10); path.lineTo(30, 10); path.lineTo(30, 20); path.close(); RectF bounds = new RectF(); path.computeBounds(bounds, true); Rect pathBounds = new Rect(); bounds.roundOut(pathBounds); Bitmap outBitmap = Bitmap.createBitmap(pathBounds.width(), pathBounds.height(), Bitmap.Config.ARGB_8888); Shader shader = new BitmapShader(b, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); Canvas c = new Canvas(outBitmap); Paint paint = new Paint(); paint.setShader(shader); c.translate(-pathBounds.left, -pathBounds.top); c.drawPath(path, paint);
mRect.roundOut(mSrcRect);
public void invalidateMapCoordinates(final RectF dirty) { dirty.roundOut(mInvalidateRect); final int width_2 = this.getWidth() / 2; final int height_2 = this.getHeight() / 2; // Since the canvas is shifted by getWidth/2, we can just return our natural scrollX/Y value // since that is the same as the shifted center. int centerX = this.getScrollX(); int centerY = this.getScrollY(); if (this.getMapOrientation() != 0) { GeometryMath.getBoundingBoxForRotatedRectangle(mInvalidateRect, centerX, centerY, this.getMapOrientation() + 180, mInvalidateRect); } mInvalidateRect.offset(width_2, height_2); super.invalidate(mInvalidateRect); }