Android Bitmap Size Get computeInSampleSizeForMoment(Bitmap map, int newWidth, int newHeight)

Here you can find the source of computeInSampleSizeForMoment(Bitmap map, int newWidth, int newHeight)

Description

compute In Sample Size For Moment

Declaration

public static int computeInSampleSizeForMoment(Bitmap map,
            int newWidth, int newHeight) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;

public class Main {
    public static int computeInSampleSizeForMoment(Bitmap map,
            int newWidth, int newHeight) {
        int width = map.getWidth();
        int height = map.getHeight();
        int inSampleSize = 1;
        if (width < newWidth && height < newHeight) {

        } else {/* w  w w  . j a  va  2 s . c  o  m*/
            float widthRadio = width / newWidth;
            float heightRadio = height / newHeight;
            inSampleSize = (int) Math.max(widthRadio, heightRadio);
        }
        return inSampleSize;
    }
}

Related

  1. obtainBitmapSize(String pathName)
  2. computeSampleSize(BitmapFactory.Options options, int minSideLength, int maxNumOfPixels)
  3. computeInitialSampleSize( BitmapFactory.Options options, int minSideLength, int maxNumOfPixels)
  4. computeInitialSampleSize(int w, int h, int minSideLength, int maxNumOfPixels)
  5. computeInitialSampleSize( BitmapFactory.Options options, int minSideLength, int maxNumOfPixels)
  6. computeSampleSize(int width, int height, int minSideLength, int maxNumOfPixels)
  7. computeSampleSize(float scale)
  8. computeSampleSize(BitmapFactory.Options options, int minSideLength, int maxNumOfPixels)
  9. computeSampleSizeLarger(int w, int h, int minSideLength)