1 /*
2  * Copyright 2023 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 androidx.camera.camera2.pipe.media
18 
19 import androidx.camera.camera2.pipe.UnsafeWrapper
20 import java.nio.ByteBuffer
21 
22 /**
23  * Wrapper interfaces that mirrors the primary read-only properties of {@link android.media.Image}.
24  */
25 public interface ImageWrapper : UnsafeWrapper, AutoCloseable {
26     /** @see {@link android.media.Image.getWidth} */
27     public val width: Int
28 
29     /** @see {@link android.media.Image.getHeight} */
30     public val height: Int
31 
32     /** @see {@link android.media.Image.getFormat} */
33     public val format: Int
34 
35     /** @see {@link android.media.Image.getPlanes} */
36     public val planes: List<ImagePlane>
37 
38     /** @see {@link android.media.Image.getTimestamp} */
39     public val timestamp: Long
40 }
41 
42 public interface ImagePlane : UnsafeWrapper {
43     /** @see {@link android.media.Image.Plane.getRowStride */
44     public val rowStride: Int
45 
46     /** @see {@link android.media.Image.Plane.getPixelStride */
47     public val pixelStride: Int
48 
49     /** @see {@link android.media.Image.Plane.getBuffer */
50     public val buffer: ByteBuffer?
51 }
52