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
17package com.android.camera.captureintent.resource;
18
19import com.android.camera.async.SafeCloseable;
20import com.android.camera.util.Size;
21
22import android.view.Surface;
23
24import javax.annotation.ParametersAreNonnullByDefault;
25
26/**
27 * Defines an interface that any implementation of this is responsible for
28 * retaining and releasing a {@link android.graphics.SurfaceTexture}.
29 */
30@ParametersAreNonnullByDefault
31public interface ResourceSurfaceTexture extends SafeCloseable {
32    /**
33     * Creates a surface from this surface texture for preview.
34     *
35     * @return A {@link android.view.Surface} object.
36     */
37    public Surface createPreviewSurface();
38
39    /**
40     * Updates the transform matrix in {@link com.android.camera.TextureViewHelper}.
41     */
42    public void updatePreviewTransform();
43
44    /**
45     * Obtains the chosen preview stream size.
46     *
47     * @return A {@link com.android.camera.util.Size} object.
48     */
49    public Size getPreviewSize();
50
51    /**
52     * Changes the preview stream size.
53     *
54     * @param previewSize The new preview stream size.
55     */
56    public void setPreviewSize(Size previewSize);
57
58    /**
59     * Obtains the current view layout size for the preview.
60     *
61     * @return A {@link com.android.camera.util.Size} object.
62     */
63    public Size getPreviewLayoutSize();
64
65    /**
66     * Changes the current view layout size.
67     *
68     * @param previewLayoutSize The new preview view layout size.
69     */
70    public void setPreviewLayoutSize(Size previewLayoutSize);
71}
72