grow a Rectangle - Android Graphics

Android examples for Graphics:Rectangle

Description

grow a Rectangle

Demo Code


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

public class Main {
    public static void grow(Rect rect, int size) {
        rect.set(rect.left - size, rect.top - size, rect.right + size,
                rect.bottom + size);//from   w  w  w . ja  v a2 s  . c o  m
        //return new Rect(rect.left - size, rect.top - size, rect.right + size, rect.bottom + size);
    }

    public static void grow(RectF rect, int size) {
        rect.set(rect.left - size, rect.top - size, rect.right + size,
                rect.bottom + size);
    }
}

Related Tutorials