Skip to content

dom/html: ImageData browser compatibility #2535

Closed
@rakudrama

Description

@rakudrama

ImageData is different on different browsers:

var image = context2d.createImageData(100, 200);

Chrome:
image is an ImageData object
image.data member is a CanvasPixelArray

FireFox 11:
image is a raw Object: {width: 100, height: 200, data: xxx}
image.data is a Uint8ClampedArray

We can wrap the image data to ensure the FF version is a valid Dart object. This would be a bit painful since it is also an input and would need to be unwrapped. Since the FF version is a raw object, presumably any object with the three properties would do - we could create a native class that has them but also has a prototype to attach Dart methods.

Not sure what to do to about .data property. To generate good code, dart2js would need to know that this has one of two disjoint types which have 'compatible' native methods.

Next action: explore other browsers.

Metadata

Metadata

Assignees

Labels

web-librariesIssues impacting dart:html, etc., libraries

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions