• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 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.one.v2.camera2proxy;
18 
19 import android.graphics.Rect;
20 
21 import com.android.camera.async.SafeCloseable;
22 
23 import java.nio.ByteBuffer;
24 import java.util.List;
25 
26 import javax.annotation.concurrent.ThreadSafe;
27 
28 /**
29  * An interface for {@link android.media.Image} with two convenient differences:
30  * <ul>
31  * <li>Implementations must be thread-safe.</li>
32  * <li>Methods will never throw a RuntimeException, even if the underlying Image
33  * has been closed.</li>
34  * </ul>
35  */
36 @ThreadSafe
37 public interface ImageProxy extends SafeCloseable {
38 
39     /**
40      * An interface for {@link android.media.Image.Plane} with two convenient
41      * differences:
42      * <ul>
43      * <li>Implementations must be thread-safe.</li>
44      * <li>Getters must never throw, even if the underlying Image has been
45      * closed.</li>
46      * </ul>
47      */
48     public interface Plane {
49 
50         /**
51          * @see {@link android.media.Image.Plane#getRowStride()}
52          */
getRowStride()53         public int getRowStride();
54 
55         /**
56          * @see {@link android.media.Image.Plane#getPixelStride()}
57          */
getPixelStride()58         public int getPixelStride();
59 
60         /**
61          * @see {@link android.media.Image.Plane#getBuffer()}
62          */
getBuffer()63         public ByteBuffer getBuffer();
64     }
65 
66     /**
67      * @see {@link android.media.Image#getCropRect}
68      */
getCropRect()69     public Rect getCropRect();
70 
71     /**
72      * @see {@link android.media.Image#setCropRect}
73      */
setCropRect(Rect cropRect)74     public void setCropRect(Rect cropRect);
75 
76     /**
77      * @see {@link android.media.Image#getFormat}
78      */
getFormat()79     public int getFormat();
80 
81     /**
82      * @see {@link android.media.Image#getHeight}
83      */
getHeight()84     public int getHeight();
85 
86     /**
87      * @see {@link android.media.Image#getPlanes}
88      */
getPlanes()89     public List<Plane> getPlanes();
90 
91     /**
92      * @see {@link android.media.Image#getTimestamp}
93      */
getTimestamp()94     public long getTimestamp();
95 
96     /**
97      * @see {@link android.media.Image#getWidth}
98      */
getWidth()99     public int getWidth();
100 
101     /**
102      * @see {@link android.media.Image#close}
103      */
104     @Override
close()105     public void close();
106 }
107