NativeMemoryRef Class

Definition

Namespace: P1.CameraSdk

A wrapper around a temporary reference to an block of unmanaged memory More…

public class NativeMemoryRef :  Stream

Remarks

A wrapper around a temporary reference to an block of unmanaged memory

This object references memory owned by the SDK subsystem, so you must Dispose() it as soon as you are done with it. Either manually call Dispose() or use a

using

block to ensure quick disposal of the referenced memory. (Do not rely on the garbage collector to eventually free the object.

Since the lower layers of this Camera SDK are written in C/C++, images are returned to CLR contexts as a reference to unmanaged memory. This allows you to avoid extraneous copies of the image data.

This class implements the Stream abstract class, so you can easily stream its content to a file or other destination stream.

The method ToArray copies the entire data buffer into a byte array (

byte[]

). This effectively transfers (copies) the data from unmanaged memory into managed.

See also:

INotificationEvent.Preview, INotificationEvent.LiveView, INotificationEvent.FullImage, INotificationEvent.Tile