當前位置: 首頁>>代碼示例>>Java>>正文


Java Parameters.getSupportedPictureSizes方法代碼示例

本文整理匯總了Java中android.hardware.Camera.Parameters.getSupportedPictureSizes方法的典型用法代碼示例。如果您正苦於以下問題:Java Parameters.getSupportedPictureSizes方法的具體用法?Java Parameters.getSupportedPictureSizes怎麽用?Java Parameters.getSupportedPictureSizes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.hardware.Camera.Parameters的用法示例。


在下文中一共展示了Parameters.getSupportedPictureSizes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initialCameraPictureSize

import android.hardware.Camera.Parameters; //導入方法依賴的package包/類
public static void initialCameraPictureSize(
        Context context, Parameters parameters) {
    // When launching the camera app first time, we will set the picture
    // size to the first one in the list defined in "arrays.xml" and is also
    // supported by the driver.
    List<Size> supported = parameters.getSupportedPictureSizes();
    if (supported == null) return;
    for (String candidate : context.getResources().getStringArray(
            R.array.pref_camera_picturesize_entryvalues)) {
        if (setCameraPictureSize(candidate, supported, parameters)) {
            SharedPreferences.Editor editor = ComboPreferences
                    .get(context).edit();
            editor.putString(KEY_PICTURE_SIZE, candidate);
            editor.apply();
            return;
        }
    }
    Log.e(TAG, "No supported picture size found");
}
 
開發者ID:asm-products,項目名稱:nexus-camera,代碼行數:20,代碼來源:CameraSettings.java

示例2: setCamera

import android.hardware.Camera.Parameters; //導入方法依賴的package包/類
void setCamera() {
	myCamera = getCameraInstance();

	Parameters params = myCamera.getParameters();
	List<Camera.Size> sizes = params.getSupportedPictureSizes();
	int minWidth = Integer.MAX_VALUE, minHeight = Integer.MAX_VALUE;
	for (int i = 0; i < sizes.size(); i++) {
		Log.i("PictureSize", "Supported Size: " + sizes.get(i).width
				+ " height : " + sizes.get(i).height);
		if (sizes.get(i).width < minWidth) {
			minWidth = sizes.get(i).width;
			minHeight = sizes.get(i).height;
		}
	}
	Log.i("PictureSize", "Min Size: " + minWidth + " height : " + minHeight);

	List<int[]> fpsRanges = params.getSupportedPreviewFpsRange();
	for (int i = 0; i < fpsRanges.size(); i++) {
		Log.i("Fps ranges:", String.valueOf(fpsRanges.get(i)[0] / 1000)
				+ ' ' + String.valueOf(fpsRanges.get(i)[1] / 1000));
	}

	params.setPictureSize(minWidth, minHeight);
	params.setPreviewSize(minWidth, minHeight);
	myCamera.setParameters(params);

	camHeight = myCamera.getParameters().getPreviewSize().height;
	camWidth = myCamera.getParameters().getPreviewSize().width;
	Log.i("SavedPictureSize", "Size: " + camWidth + " height : "
			+ camHeight);
	mCallbackBuf = new byte[camHeight * camWidth * 3 / 2]; // 用於previewcallback
	hbeg = (camHeight - hnum) / 2;
	wbeg = (camWidth - wnum) / 2;
	myCamera.setPreviewCallbackWithBuffer(new MyPreview());
	myCamera.addCallbackBuffer(mCallbackBuf);

	sv_hidden.removeAllViews(); // 是不是應該先清空
	myCameraSurfaceView = new MyCameraSurfaceView(getApplicationContext(),
			myCamera);

	sv_hidden.addView(myCameraSurfaceView);
	// sv_hidden.setVisibility(View.INVISIBLE);

}
 
開發者ID:thmedialab,項目名稱:DataDrivenBP,代碼行數:45,代碼來源:BPActivity.java


注:本文中的android.hardware.Camera.Parameters.getSupportedPictureSizes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。