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

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

Description

get Size WIDTH

Declaration

private static Size getSizeWIDTH(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 getSizeWIDTH(List<Size> sizes, int w, int h) {
        int wantWidth = w;
        Size re = null;/*from   w w w. j a  v  a 2  s.co m*/
        int minGap = w;
        for (Size size : sizes) {
            if (getWidthGap(size, wantWidth) < minGap) {
                minGap = getWidthGap(size, wantWidth);
                re = size;
            }
        }
        return re;
    }

    private static int getWidthGap(Size size, int wantWidth) {
        return Math.abs(size.height - wantWidth);
    }
}

Related

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