Package pyjsdl :: Module pyjsarray :: Class TypedArray

Class TypedArray

object --+
         |
        TypedArray

TypedArray is the base class that wraps the JavaScript TypedArray objects. The derived objects provides an interface to the JavaScript array objects. Typedarray implemented: Uint8ClampedArray, Uint8Array, Uint16Array, Uint32Array, Int8Array, Int16Array, Int32Array, Float32Array, Float64Array. The module contains an Ndarray class to instantiate N-dimensional arrays, ImageData and ImageMatrix classes that provide an interface to canvas ImageData, and BitSet classes that implement a bit array.
Instance Methods
 
__init__(self, data=None, offset=None, length=None, typedarray=None)
The TypedArray object is instantiated with either the array size, an array of TypedArray or Python type, or an existing ArrayBuffer to view, which creates a new TypedArray of size and included data as the specified type. Optional arguments include offset index at which ArrayBuffer data is inserted and length of an ArrayBuffer.
 
__str__(self)
str(x)
 
__iter__(self)
 
__getitem__(self, index)
 
__setitem__(self, index, value)
 
__len__(self)
 
filter(self, func)
Return typedarray filtered by provided function.
 
map(self, func)
Return typedarray of applying provided function across elements.
 
reduce(self, func)
Return result of applying provided accumlator function.
 
slice(self, i, j)
Return typedarray from indices i,j.
 
set(self, data, offset=0)
Set data to the array. Arguments: data is a list of either the TypedArray or Python type, offset is the start index where data will be set (defaults to 0).
 
subarray(self, begin=0, end=None)
Retrieve a subarray of the array. The subarray is a is a view of the derived array. Optional arguments begin and end (default to begin/end of the array) are the index spanning the subarray.
 
getLength(self)
Return array.length attribute.
 
getByteLength(self)
Return array.byteLength attribute.
 
getBuffer(self)
Return array.buffer attribute.
 
getByteOffset(self)
Return array.byteOffset attribute.
 
getBytesPerElement(self)
Return array.BYTES_PER_ELEMENT attribute.
 
getArray(self)
Return JavaScript TypedArray.
 
setArray(self, array)
Set JavaScript TypedArray.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, data=None, offset=None, length=None, typedarray=None)
(Constructor)

 
The TypedArray object is instantiated with either the array size, an array of TypedArray or Python type, or an existing ArrayBuffer to view, which creates a new TypedArray of size and included data as the specified type. Optional arguments include offset index at which ArrayBuffer data is inserted and length of an ArrayBuffer.
Overrides: object.__init__

__str__(self)
(Informal representation operator)

 
str(x)
Overrides: object.__str__
(inherited documentation)