Skip to content

Commit 72652bc

Browse files
authored
Added missing constructors to ImageData facade.
The ImageData spec references several constructors that scala-js-dom has omitted: https://developer.mozilla.org/en-US/docs/Web/API/ImageData/ImageData
1 parent efe1b87 commit 72652bc

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

dom/src/main/scala/org/scalajs/dom/ImageData.scala

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,46 @@ class ImageData extends js.Object {
2727

2828
/** Is an unsigned long representing the actual height, in pixels, of the ImageData. */
2929
def height: Int = js.native
30+
/**
31+
* Create an ImageData instance from an array of pixel data and a width.
32+
* @param data pixel data
33+
* @param width width in pixels
34+
*/
35+
def this(data: js.typedarray.Uint8ClampedArray, width: Int) = this()
36+
37+
/**
38+
* Create an ImageData instance from an array of pixel data, width, and height.
39+
* @param data pixel data
40+
* @param width width in pixels
41+
* @param height height in pixels
42+
*/
43+
def this(data: js.typedarray.Uint8ClampedArray, width: Int, height: Int) = this()
44+
45+
/**
46+
* Create a blank ImageData instance from specified width and height.
47+
*
48+
* @param width width in pixels
49+
* @param height height in pixels
50+
*/
51+
def this(width: Int, height: Int) = this()
52+
53+
/**
54+
* Create a blank ImageData instance from specified width, height, and settings object.
55+
*
56+
* @param width width in pixels
57+
* @param height height in pixels
58+
* @param settings image settings
59+
*/
60+
def this(width: Int, height: Int, setings: js.Object) = this()
61+
62+
/**
63+
* Create a blank ImageData instance from specified pixel data, width, height, and settings object.
64+
*
65+
* @param data pixel data
66+
* @param width width in pixels
67+
* @param height height in pixels
68+
* @param settings image settings
69+
*/
70+
def this(data: js.typedarray.Uint8ClampedArray, width: Int, height: Int, setings: js.Object) = this()
71+
3072
}

0 commit comments

Comments
 (0)