Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget Class Reference
Inheritance diagram for io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget:
io.flutter.plugin.platform.PlatformViewRenderTarget

Public Member Functions

 ImageReaderPlatformViewRenderTarget (ImageTextureEntry textureEntry)
 
void resize (int width, int height)
 
int getWidth ()
 
int getHeight ()
 
long getId ()
 
void release ()
 
boolean isReleased ()
 
Surface getSurface ()
 
- Public Member Functions inherited from io.flutter.plugin.platform.PlatformViewRenderTarget
void resize (int width, int height)
 
int getWidth ()
 
int getHeight ()
 
long getId ()
 
void release ()
 
boolean isReleased ()
 
Surface getSurface ()
 
default void scheduleFrame ()
 

Protected Member Functions

ImageReader createImageReader33 ()
 
ImageReader createImageReader29 ()
 
ImageReader createImageReader ()
 

Detailed Description

Definition at line 17 of file ImageReaderPlatformViewRenderTarget.java.

Constructor & Destructor Documentation

◆ ImageReaderPlatformViewRenderTarget()

io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget.ImageReaderPlatformViewRenderTarget ( ImageTextureEntry  textureEntry)
inline

Definition at line 95 of file ImageReaderPlatformViewRenderTarget.java.

95 {
96 if (Build.VERSION.SDK_INT < API_LEVELS.API_29) {
97 throw new UnsupportedOperationException(
98 "ImageReaderPlatformViewRenderTarget requires API version 29+");
99 }
100 this.textureEntry = textureEntry;
101 }
def Build(configs, env, options)
Definition: build.py:232

Member Function Documentation

◆ createImageReader()

ImageReader io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget.createImageReader ( )
inlineprotected

Definition at line 85 of file ImageReaderPlatformViewRenderTarget.java.

85 {
86 if (Build.VERSION.SDK_INT >= API_LEVELS.API_33) {
87 return createImageReader33();
88 } else if (Build.VERSION.SDK_INT >= API_LEVELS.API_29) {
89 return createImageReader29();
90 }
91 throw new UnsupportedOperationException(
92 "ImageReaderPlatformViewRenderTarget requires API version 29+");
93 }

◆ createImageReader29()

ImageReader io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget.createImageReader29 ( )
inlineprotected

Definition at line 73 of file ImageReaderPlatformViewRenderTarget.java.

73 {
74 final ImageReader reader =
75 ImageReader.newInstance(
76 bufferWidth,
77 bufferHeight,
78 ImageFormat.PRIVATE,
79 MAX_IMAGES,
80 HardwareBuffer.USAGE_GPU_SAMPLED_IMAGE);
81 reader.setOnImageAvailableListener(this.onImageAvailableListener, onImageAvailableHandler);
82 return reader;
83 }

◆ createImageReader33()

ImageReader io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget.createImageReader33 ( )
inlineprotected

Definition at line 54 of file ImageReaderPlatformViewRenderTarget.java.

54 {
55 final ImageReader.Builder builder = new ImageReader.Builder(bufferWidth, bufferHeight);
56 // Allow for double buffering.
57 builder.setMaxImages(MAX_IMAGES);
58 // Use PRIVATE image format so that we can support video decoding.
59 // TODO(johnmccutchan): Should we always use PRIVATE here? It may impact our ability to read
60 // back texture data. If we don't always want to use it, how do we decide when to use it or not?
61 // Perhaps PlatformViews can indicate if they may contain DRM'd content. I need to investigate
62 // how PRIVATE impacts our ability to take screenshots or capture the output of Flutter
63 // application.
64 builder.setImageFormat(ImageFormat.PRIVATE);
65 // Hint that consumed images will only be read by GPU.
66 builder.setUsage(HardwareBuffer.USAGE_GPU_SAMPLED_IMAGE);
67 final ImageReader reader = builder.build();
68 reader.setOnImageAvailableListener(this.onImageAvailableListener, onImageAvailableHandler);
69 return reader;
70 }

◆ getHeight()

int io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget.getHeight ( )
inline

Implements io.flutter.plugin.platform.PlatformViewRenderTarget.

Definition at line 118 of file ImageReaderPlatformViewRenderTarget.java.

118 {
119 return this.bufferHeight;
120 }

◆ getId()

long io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget.getId ( )
inline

Implements io.flutter.plugin.platform.PlatformViewRenderTarget.

Definition at line 122 of file ImageReaderPlatformViewRenderTarget.java.

122 {
123 return this.textureEntry.id();
124 }

◆ getSurface()

Surface io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget.getSurface ( )
inline

Implements io.flutter.plugin.platform.PlatformViewRenderTarget.

Definition at line 136 of file ImageReaderPlatformViewRenderTarget.java.

136 {
137 return this.reader.getSurface();
138 }

◆ getWidth()

int io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget.getWidth ( )
inline

Implements io.flutter.plugin.platform.PlatformViewRenderTarget.

Definition at line 114 of file ImageReaderPlatformViewRenderTarget.java.

114 {
115 return this.bufferWidth;
116 }

◆ isReleased()

boolean io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget.isReleased ( )
inline

Implements io.flutter.plugin.platform.PlatformViewRenderTarget.

Definition at line 132 of file ImageReaderPlatformViewRenderTarget.java.

132 {
133 return this.textureEntry == null;
134 }

◆ release()

void io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget.release ( )
inline

Implements io.flutter.plugin.platform.PlatformViewRenderTarget.

Definition at line 126 of file ImageReaderPlatformViewRenderTarget.java.

126 {
127 closeReader();
128 // textureEntry has a finalizer attached.
129 textureEntry = null;
130 }

◆ resize()

void io.flutter.plugin.platform.ImageReaderPlatformViewRenderTarget.resize ( int  width,
int  height 
)
inline

Implements io.flutter.plugin.platform.PlatformViewRenderTarget.

Definition at line 103 of file ImageReaderPlatformViewRenderTarget.java.

103 {
104 if (this.reader != null && bufferWidth == width && bufferHeight == height) {
105 // No size change.
106 return;
107 }
108 closeReader();
109 bufferWidth = width;
110 bufferHeight = height;
111 this.reader = createImageReader();
112 }
int32_t height
int32_t width

The documentation for this class was generated from the following file: