1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.camera.captureintent.resource; 18 19 import android.graphics.PointF; 20 import android.view.Surface; 21 22 import com.android.camera.async.SafeCloseable; 23 import com.android.camera.device.CameraId; 24 import com.android.camera.one.OneCamera; 25 import com.android.camera.one.OneCameraCaptureSetting; 26 import com.android.camera.one.OneCameraCharacteristics; 27 import com.android.camera.util.Size; 28 29 /** 30 * Defines an interface that any implementation of this is responsible for 31 * retaining and releasing an opened {@link com.android.camera.one.OneCamera}. 32 */ 33 public interface ResourceOpenedCamera extends SafeCloseable { 34 /** 35 * Obtains the opened camera. 36 * 37 * @return A {@link com.android.camera.one.OneCamera} object. 38 */ getCamera()39 public OneCamera getCamera(); 40 41 /** 42 * Obtains key for this one camera object 43 * 44 * @return A {@link com.android.camera.one.OneCamera} object. 45 */ getCameraId()46 public CameraId getCameraId(); 47 48 /** 49 * Obtains the facing of the opened camera. 50 * 51 * @return A {@link com.android.camera.one.OneCamera.Facing}. 52 */ getCameraFacing()53 public OneCamera.Facing getCameraFacing(); 54 55 /** 56 * Obtains the characteristics of the opened camera. 57 * 58 * @return A {@link com.android.camera.one.OneCameraCharacteristics} 59 * object. 60 */ getCameraCharacteristics()61 public OneCameraCharacteristics getCameraCharacteristics(); 62 63 /** 64 * Obtains the chosen size for any picture taken by this camera. 65 * 66 * @return A {@link com.android.camera.util.Size} object. 67 */ getPictureSize()68 public Size getPictureSize(); 69 70 /** 71 * Obtains the capture setting of the opened camera. 72 * 73 * @return A {@link com.android.camera.one.OneCameraCaptureSetting} object. 74 */ getCaptureSetting()75 public OneCameraCaptureSetting getCaptureSetting(); 76 77 /** 78 * Obtains the current zoom ratio applied on this camera. 79 * 80 * @return The current zoom ratio. 81 */ getZoomRatio()82 public float getZoomRatio(); 83 84 /** 85 * Changes the zoom ratio on this camera. 86 * 87 * @param zoomRatio The new zoom ratio to be applied. 88 */ setZoomRatio(float zoomRatio)89 public void setZoomRatio(float zoomRatio); 90 91 /** 92 * Starts preview video on a particular surface. 93 * 94 * @param previewSurface A {@link android.view.Surface} that the preview 95 * will be displayed on. 96 * @param captureReadyCallback A {@link com.android.camera.one.OneCamera.CaptureReadyCallback}. 97 */ startPreview( Surface previewSurface, OneCamera.CaptureReadyCallback captureReadyCallback)98 public void startPreview( 99 Surface previewSurface, OneCamera.CaptureReadyCallback captureReadyCallback); 100 101 /** 102 * Trigger active focus at a specific point. 103 * 104 * @param point The focus point. 105 */ triggerFocusAndMeterAtPoint(PointF point)106 public void triggerFocusAndMeterAtPoint(PointF point); 107 } 108