Details
-
Suggestion
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
5.0.2, 5.1.0 , 5.1.1
Description
An example demonstrates:
var ctx = canvas.getContext('2d'); var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); nativeMethod(imageData.data, imageData.width, imageData.height);
Internally the Qt5V8 method "toVariant" is called to convert the array to a QVariant. Because this object is actually a custom type (and not a proper V8 Array type) it requires special handling which isn't implemented. Instead an empty QVariant is returned.
var copied = new Array(); for( var x=0; x < imageData.data.length; x++ ) copied[x] = imageData.data[x]; nativeMethod(copied, imageData.width, imageData.height);
This works as expected since the data is moved into a V8 "Array" first, but I'd rather not have to do this for hopefully obvious reasons.