adjust Rectangle Radius - Android Graphics

Android examples for Graphics:Rectangle

Description

adjust Rectangle Radius

Demo Code


//package com.java2s;
import android.graphics.Rect;

public class Main {
    public static Rect adjustRadius(Rect rect, int radius) {
        return of(rect.centerX(), rect.centerY(), radius);
    }/*from w ww . j  av  a 2 s  .com*/

    public static Rect of(int centerX, int centerY, int radius) {
        return new Rect(centerX - radius, centerY - radius, centerX
                + radius, centerY + radius);
    }
}

Related Tutorials