get Circle from Point - Android Graphics

Android examples for Graphics:Path Point

Description

get Circle from Point

Demo Code


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

public class Main {
    public static RectF getCircle(final PointF center, final float radius) {
        return getOval(center, radius, radius);
    }/* w w w  .  j  a  v  a  2s  .co  m*/

    public static RectF getOval(final PointF center, final float radiusX,
            final float radiusY) {
        final RectF oval = new RectF();
        oval.left = center.x - radiusX;
        oval.top = center.y - radiusY;
        oval.right = center.x + radiusX;
        oval.bottom = center.y + radiusY;
        return oval;
    }
}

Related Tutorials