Any Point In Bounds - Android Graphics

Android examples for Graphics:Path Point

Description

Any Point In Bounds

Demo Code


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

public class Main {
    public static boolean AnyPointInBounds(PointF[] pts, RectF bounds) {
        return AnyPointInBounds(pts, bounds.left, bounds.top,
                bounds.width(), bounds.height());
    }/*from ww w. ja v  a2s. c  o  m*/

    public static boolean AnyPointInBounds(PointF[] pts, float x, float y,
            float width, float height) {
        for (int i = 0; i < pts.length; i++) {
            if (pts[i] != null) {
                if (pts[i].x >= x && pts[i].x <= x + width && pts[i].y >= y
                        && pts[i].y <= y + height)
                    return true;
            }
        }
        return false;
    }
}

Related Tutorials