Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;

public class Main {
    public static Rect getBitmapRect(PointF center, float radius) {
        RectF rectF = new RectF();
        rectF.set(center.x - radius, center.y - radius, center.x + radius, center.y + radius);
        return rectF2Rect(rectF);
    }

    public static Rect rectF2Rect(RectF rectF) {
        Rect rect = new Rect();
        rect.set((int) rectF.left, (int) rectF.top, (int) rectF.right, (int) rectF.bottom);
        return rect;
    }
}