Android Camera Size Get getSizeSIZE(List sizes, int w, int h)

Here you can find the source of getSizeSIZE(List sizes, int w, int h)

Description

get Size SIZE

Declaration

private static Size getSizeSIZE(List<Size> sizes, int w, int h) 

Method Source Code

//package com.java2s;
import java.util.List;

import android.hardware.Camera.Size;

public class Main {
    private static Size getSizeSIZE(List<Size> sizes, int w, int h) {
        Size re = null;/*from   w  w w. ja  va2 s .c o m*/
        int wantSize = w * h;
        int minGap = wantSize;
        for (Size size : sizes) {
            if (getSizeGap(size, wantSize) < minGap) {
                re = size;
                minGap = getSizeGap(size, wantSize);
            }
        }
        return re;
    }

    private static int getSizeGap(Size size, int wantSize) {
        return Math.abs(size.width * size.height - wantSize);
    }
}

Related

  1. getOptimalPreviewSize(int displayOrientation, int width, int height, Camera.Parameters parameters)
  2. getSmallestPictureSize(Camera.Parameters parameters)
  3. getPreviewSize(Camera.Parameters cp)
  4. getSizeLB(List sizes, int w, int h)
  5. getSizeRATIO(List sizes, int w, int h)
  6. getSizeWIDTH(List sizes, int w, int h)
  7. getOptimalPreviewSize( List sizes, int w, int h)
  8. getOptimalPreviewSize(List sizes, int w, int h)
  9. getOptimalPreviewSize(List supportedSizes, int w, int h)