Example usage for android.graphics Point Point

List of usage examples for android.graphics Point Point

Introduction

In this page you can find the example usage for android.graphics Point Point.

Prototype

public Point(int x, int y) 

Source Link

Usage

From source file:Main.java

public static Point eventToPoint(@NonNull MotionEvent event) {
    return new Point((int) event.getX(), (int) event.getY());
}

From source file:Main.java

public static Point getTileCoordFromPixCoord(Point point, int i) {
    int j = toScale(i);
    int g = point.x << j;
    int f = point.y << j;
    return new Point(g, f);
}

From source file:Main.java

public static Point getDeviceSize(Context context) {
    Point size = new Point(-1, -1); // invalid size
    if (context == null)
        return size;
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay(); // the display that we see
    display.getSize(size);/*from   ww w . ja va  2 s . c  o  m*/
    return size;
}

From source file:Main.java

public static Point getScreenSize() {
    DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
    return new Point(metrics.widthPixels, metrics.heightPixels);
}

From source file:Main.java

public static Point getScreenWH(Context context) {
    DisplayMetrics metrics = context.getResources().getDisplayMetrics();
    return new Point(metrics.widthPixels, metrics.heightPixels);
}

From source file:Main.java

public static Point restrictSizeInSize(Point size, Point inSize) {
    if (size.x * inSize.y > inSize.x * size.y) {
        int width = inSize.x;
        int height = (int) (size.y * 1.0 / size.x * inSize.x);
        return new Point(width, height);
    } else if (size.y * inSize.x > inSize.y * size.x) {
        int height = inSize.y;
        int width = (int) (size.x * 1.0 / size.y * inSize.y);
        return new Point(width, height);
    } else {/*www.  jav a2  s  . c o  m*/
        return inSize;
    }
}

From source file:Main.java

public static void drawArrow(Canvas canvas, int x, int y, int height, int width, Paint paint) {
    int triOffset = width / 2;
    Point a = new Point(x, y);
    Point b = new Point(x + triOffset, y - height);
    Point c = new Point(x - triOffset, y - height);

    drawTriangle(canvas, a, b, c, paint);
}

From source file:Main.java

public static Point getImageSize(String path) {
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;//from w w w . j  av a 2 s.  co  m
    BitmapFactory.decodeFile(path, options);
    return new Point(options.outWidth, options.outHeight);
}

From source file:Main.java

public static Point getImageRawSize(String imagePath) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;//from www .  jav  a 2 s. c  o  m
    BitmapFactory.decodeFile(imagePath, options);
    return new Point(options.outWidth, options.outHeight);
}

From source file:Main.java

public static Point getScreenMetrics(Context context) {
    DisplayMetrics dm = context.getResources().getDisplayMetrics();
    int w_screen = dm.widthPixels;
    int h_screen = dm.heightPixels;
    return new Point(w_screen, h_screen);
}