Compartir a través de


ImageReader Class

Definition

The ImageReader class allows direct application access to image data rendered into a android.view.Surface

[Android.Runtime.Register("android/media/ImageReader", DoNotGenerateAcw=true)]
public class ImageReader : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.IAutoCloseable
[<Android.Runtime.Register("android/media/ImageReader", DoNotGenerateAcw=true)>]
type ImageReader = class
    inherit Object
    interface IAutoCloseable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
ImageReader
Attributes
Implements

Remarks

The ImageReader class allows direct application access to image data rendered into a android.view.Surface

Several Android media API classes accept Surface objects as targets to render to, including MediaPlayer, MediaCodec, android.hardware.camera2.CameraDevice, ImageWriter and android.renderscript.Allocation RenderScript Allocations. The image sizes and formats that can be used with each source vary, and should be checked in the documentation for the specific API.

The image data is encapsulated in Image objects, and multiple such objects can be accessed at the same time, up to the number specified by the maxImages constructor parameter. New images sent to an ImageReader through its Surface are queued until accessed through the #acquireLatestImage or #acquireNextImage call. Due to memory limits, an image source will eventually stall or drop Images in trying to render to the Surface if the ImageReader does not obtain and release Images at a rate equal to the production rate.

Java documentation for android.media.ImageReader.

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.

Constructors

ImageReader(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
DataSpace

The default dataspace of Image Images.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HardwareBufferFormat

The default HardwareBuffer format of Image Images.

Height

The default height of Image Images, in pixels.

ImageFormat

The default ImageFormat image format of Image Images.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
MaxImages

Maximum number of images that can be acquired from the ImageReader by any time (for example, with #acquireNextImage).

PeerReference (Inherited from Object)
Surface

Get a Surface that can be used to produce Image Images for this ImageReader.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Usage

The usage flag of images that can be produced by the ImageReader.

Width

The default width of Image Images, in pixels.

Methods

AcquireLatestImage()

Acquire the latest Image from the ImageReader's queue, dropping older Image images.

AcquireNextImage()

Acquire the next Image from the ImageReader's queue.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Close()

Free up all the resources associated with this ImageReader.

DiscardFreeBuffers()

Discard any free buffers owned by this ImageReader.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
NewInstance(Int32, Int32, ImageFormatType, Int32, Int64)

Create a new reader for images of the desired size, format and consumer usage flag.

NewInstance(Int32, Int32, ImageFormatType, Int32)

Create a new reader for images of the desired size and format.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetOnImageAvailableListener(ImageReader+IOnImageAvailableListener, Handler)

Register a listener to be invoked when a new image becomes available from the ImageReader.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to