本文整理汇总了Java中android.hardware.Camera.Parameters.getMaxZoom方法的典型用法代码示例。如果您正苦于以下问题:Java Parameters.getMaxZoom方法的具体用法?Java Parameters.getMaxZoom怎么用?Java Parameters.getMaxZoom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.hardware.Camera.Parameters
的用法示例。
在下文中一共展示了Parameters.getMaxZoom方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: zoomOut
import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
public void zoomOut() {
if (this.camera != null) {
Parameters parameters = this.camera.getParameters();
int cz = parameters.getZoom();
if (cz < parameters.getMaxZoom()) {
parameters.setZoom(cz + 1);
this.camera.setParameters(parameters);
return;
}
Toast.makeText(this.context, "焦距已经调节到最大", 0).show();
}
}
示例2: run
import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
@Override
public void run() {
if (mCamera == null) {
return;
}
mCamera.stopPreview();
Parameters params = mCamera.getParameters();
zoomRatios = params.getZoomRatios();
zoomIndex = minZoomIndex = 0;
maxZoomIndex = params.getMaxZoom();
List<Camera.Size> sizes = params.getSupportedPreviewSizes();
List<Camera.Size> vSize = params.getSupportedVideoSizes();
Camera.Size size = CameraHelper.getOptimalPreviewSize(sizes, vSize);
if(size != null)
{
params.setPreviewSize(size.width, size.height);
mCamera.setParameters(params);
resolutionSize = size;
}else {
resolutionSize = null;
}
try {
mCamera.setPreviewDisplay(mHolder);
cameraDisplayOrientation = CameraHelper.getCameraDisplayOrientation(
(Activity)mContext, currentCamera);
mCamera.setDisplayOrientation(cameraDisplayOrientation);
mCamera.startPreview();
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: getMaxZoom
import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
/**
* 获取最大缩放级别,最大为40
* @return
*/
@Override
public int getMaxZoom(){
if(mCamera==null) return -1;
Parameters parameters=mCamera.getParameters();
if(!parameters.isZoomSupported()) return -1;
return parameters.getMaxZoom()>40?40:parameters.getMaxZoom();
}
示例4: initializeZoom
import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
public void initializeZoom(Parameters param) {
if (param == null || !param.isZoomSupported()) {
mGestures.setZoomEnabled(false);
return;
}
mGestures.setZoomEnabled(true);
mZoomMax = param.getMaxZoom();
mZoomRatios = param.getZoomRatios();
// Currently we use immediate zoom for fast zooming to get better UX and
// there is no plan to take advantage of the smooth zoom.
mZoomRenderer.setZoomMax(mZoomMax);
mZoomRenderer.setZoom(param.getZoom());
mZoomRenderer.setZoomValue(mZoomRatios.get(param.getZoom()));
mZoomRenderer.setOnZoomChangeListener(new ZoomChangeListener());
}