Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.BitmapRegionDecoder;

import android.graphics.Rect;

import java.io.IOException;

public class Main {
    private static Bitmap regionDecode(String path, int reqWidth, int reqHeight, int outWidth, int outHeight)
            throws IOException {
        BitmapRegionDecoder regionDecoder = BitmapRegionDecoder.newInstance(path, true);
        if (reqWidth > outWidth) {
            reqWidth = outWidth;
        }
        if (reqHeight > outHeight) {
            reqHeight = outHeight;
        }

        return regionDecoder.decodeRegion(new Rect(0, 0, reqWidth, reqHeight), null);
    }
}