Sdílet prostřednictvím


ImageWriter.NewInstance Method

Definition

Overloads

NewInstance(Surface, Int32)

Create a new ImageWriter.

NewInstance(Surface, Int32, ImageFormatType)

Create a new ImageWriter with given number of max Images and format.

NewInstance(Surface, Int32)

Create a new ImageWriter.

[Android.Runtime.Register("newInstance", "(Landroid/view/Surface;I)Landroid/media/ImageWriter;", "", ApiSince=23)]
public static Android.Media.ImageWriter NewInstance (Android.Views.Surface surface, int maxImages);
[<Android.Runtime.Register("newInstance", "(Landroid/view/Surface;I)Landroid/media/ImageWriter;", "", ApiSince=23)>]
static member NewInstance : Android.Views.Surface * int -> Android.Media.ImageWriter

Parameters

surface
Surface

The destination Surface this writer produces Image data into.

maxImages
Int32

The maximum number of Images the user will want to access simultaneously for producing Image data. This should be as small as possible to limit memory use. Once maxImages Images are dequeued by the user, one of them has to be queued back before a new Image can be dequeued for access via #dequeueInputImage().

Returns

a new ImageWriter instance.

Attributes

Remarks

Create a new ImageWriter.

The maxImages parameter determines the maximum number of Image objects that can be be dequeued from the ImageWriter simultaneously. Requesting more buffers will use up more memory, so it is important to use only the minimum number necessary.

The input Image size and format depend on the Surface that is provided by the downstream consumer end-point.

Java documentation for android.media.ImageWriter.newInstance(android.view.Surface, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

NewInstance(Surface, Int32, ImageFormatType)

Create a new ImageWriter with given number of max Images and format.

[Android.Runtime.Register("newInstance", "(Landroid/view/Surface;II)Landroid/media/ImageWriter;", "", ApiSince=29)]
public static Android.Media.ImageWriter NewInstance (Android.Views.Surface surface, int maxImages, Android.Graphics.ImageFormatType format);
[<Android.Runtime.Register("newInstance", "(Landroid/view/Surface;II)Landroid/media/ImageWriter;", "", ApiSince=29)>]
static member NewInstance : Android.Views.Surface * int * Android.Graphics.ImageFormatType -> Android.Media.ImageWriter

Parameters

surface
Surface

The destination Surface this writer produces Image data into.

maxImages
Int32

The maximum number of Images the user will want to access simultaneously for producing Image data. This should be as small as possible to limit memory use. Once maxImages Images are dequeued by the user, one of them has to be queued back before a new Image can be dequeued for access via #dequeueInputImage().

format
ImageFormatType

The format of this ImageWriter. It can be any valid format specified by ImageFormat or PixelFormat.

Returns

a new ImageWriter instance.

Attributes

Remarks

Create a new ImageWriter with given number of max Images and format.

The maxImages parameter determines the maximum number of Image objects that can be be dequeued from the ImageWriter simultaneously. Requesting more buffers will use up more memory, so it is important to use only the minimum number necessary.

The format specifies the image format of this ImageWriter. The format from the surface will be overridden with this format. For example, if the surface is obtained from a android.graphics.SurfaceTexture, the default format may be PixelFormat#RGBA_8888. If the application creates an ImageWriter with this surface and ImageFormat#PRIVATE, this ImageWriter will be able to operate with ImageFormat#PRIVATE Images.

Note that the consumer end-point may or may not be able to support Images with different format, for such case, the application should only use this method if the consumer is able to consume such images.

The input Image size depends on the Surface that is provided by the downstream consumer end-point.

Java documentation for android.media.ImageWriter.newInstance(android.view.Surface, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to