Example usage for android.graphics Rect height

List of usage examples for android.graphics Rect height

Introduction

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

Prototype

public final int height() 

Source Link

Usage

From source file:Main.java

public static boolean makesureSizeNotTooLarge(Rect paramRect) {
    return paramRect.width() * paramRect.height() * 2 <= 5242880;
}

From source file:Main.java

public static float calculateAspectRatio(Rect paramRect) {
    return paramRect.width() / paramRect.height();
}

From source file:Main.java

public static float m2226a(Rect rect) {
    return ((float) rect.width()) / ((float) rect.height());
}

From source file:Main.java

public static int getSampleSizeOfNotTooLarge(Rect paramRect) {
    double d = paramRect.width() * paramRect.height() * 2.0D / 5242880.0D;
    if (d >= 1.0D)
        return (int) d;
    return 1;//w ww.j  ava 2  s  . c  o m
}

From source file:Main.java

/**
 * Calculates the aspect ratio given a rectangle.
 *//*  w w  w.  ja  v  a 2 s  .  co  m*/
public static float calculateAspectRatio(Rect rect) {
    return calculateAspectRatio(rect.width(), rect.height());
}

From source file:Main.java

public static Bitmap cropWithCanvas(Bitmap bitmap, Rect cropRect) {
    Rect destRect = new Rect(0, 0, cropRect.width(), cropRect.height());
    Bitmap cropped = Bitmap.createBitmap(cropRect.width(), cropRect.height(), Bitmap.Config.RGB_565);
    Canvas canvas = new Canvas(cropped);
    canvas.drawBitmap(bitmap, cropRect, destRect, null);
    return cropped;
}

From source file:Main.java

public static int getScreenHeight(Activity activity) {
    Rect out = new Rect();
    activity.getWindow().getDecorView().getHitRect(out);
    return out.height();
}

From source file:Main.java

public static Bitmap cutBitmap(Bitmap mBitmap, Rect r, Bitmap.Config config) {
    int width = r.width();
    int height = r.height();

    Bitmap croppedImage = Bitmap.createBitmap(width, height, config);

    Canvas cvs = new Canvas(croppedImage);
    Rect dr = new Rect(0, 0, width, height);
    cvs.drawBitmap(mBitmap, r, dr, null);
    return croppedImage;
}

From source file:Main.java

public static int getSampleSizeOfNotTooLarge(Rect rect) {
    final int FIVE_M = 5 * 1024 * 1024;
    double ratio = ((double) rect.width()) * rect.height() * 2 / FIVE_M;
    return ratio >= 1 ? (int) ratio : 1;
}

From source file:Main.java

/**
 * Calculates the aspect ratio given a rectangle.
 *///from   www.j  av a 2s  . c o  m
public static float calculateAspectRatio(Rect rect) {

    final float aspectRatio = (float) rect.width() / (float) rect.height();

    return aspectRatio;
}