Java Code Examples for android.hardware.Camera.Parameters#getMaxZoom()
The following examples show how to use
android.hardware.Camera.Parameters#getMaxZoom() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Utils.java From code-scanner with MIT License | 5 votes |
public static void setZoom(@NonNull final Parameters parameters, final int zoom) { if (parameters.isZoomSupported()) { if (parameters.getZoom() != zoom) { final int maxZoom = parameters.getMaxZoom(); if (zoom <= maxZoom) { parameters.setZoom(zoom); } else { parameters.setZoom(maxZoom); } } } }
Example 2
Source File: CameraManager.java From letv with Apache License 2.0 | 5 votes |
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(); } }
Example 3
Source File: CameraView.java From LLApp with Apache License 2.0 | 5 votes |
/** * 获取最大缩放级别,最大为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(); }