Buffer Class

This type is an EasyAR Sense API in C#: Buffer . Some descriptions may not apply to Unity environment on this page.

Some parts of the Sense API may have already been wrapped into Unity components, and directly usages may not be necessary.

Description

Buffer stores a raw byte array, which can be used to access image data.

To access image data in Java API, get buffer from Image and copy to a Java byte array.

You can always access image data since the first version of EasyAR Sense. Refer to Image .


Methods

wrap

C#

public static Buffer wrap(IntPtr ptr, int size, Action deleter)

Wraps a raw memory block. When Buffer is released by all holders, deleter callback will be invoked to execute user-defined memory destruction. deleter must be thread-safe.

create

C#

public static Buffer create(int size)

Creates a Buffer of specified byte size.

data

C#

public virtual IntPtr data()

Returns raw data address.

size

C#

public virtual int size()

Byte size of raw data.

memoryCopy

C#

public static void memoryCopy(IntPtr src, IntPtr dest, int length)

Copies raw memory. It can be used in languages or platforms without complete support for memory operations.

tryCopyFrom

C#

public virtual bool tryCopyFrom(IntPtr src, int srcIndex, int index, int length)

Tries to copy data from a raw memory address into Buffer. If copy succeeds, it returns true, or else it returns false. Possible failure causes includes: source or destination data range overflow.

tryCopyTo

C#

public virtual bool tryCopyTo(int index, IntPtr dest, int destIndex, int length)

Tries to copy data from Buffer to user array. If copy succeeds, it returns true, or else it returns false. Possible failure causes includes: source or destination data range overflow.

partition

C#

public virtual Buffer partition(int index, int length)

Creates a sub-buffer with a reference to the original Buffer. A Buffer will only be released after all its sub-buffers are released.