当前位置: 首页>>代码示例>>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;未经允许,请勿转载。