Skip to content

Commit cac5077

Browse files
committed
Images. Restore ImageBitmapSource [generated] (#2219)
1 parent 6f810f3 commit cac5077

File tree

4 files changed

+31
-34
lines changed

4 files changed

+31
-34
lines changed

kotlin-browser/src/jsMain/generated/web/canvas/CanvasImageSource.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
package web.canvas
44

5+
import web.images.ImageBitmapSource
6+
57
/**
68
* Union of:
79
* - `HTMLOrSVGImageElement`
@@ -11,4 +13,5 @@ package web.canvas
1113
* - `OffscreenCanvas`
1214
* - `VideoFrame`
1315
*/
14-
external interface CanvasImageSource
16+
external interface CanvasImageSource :
17+
ImageBitmapSource
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Automatically generated - do not modify!
2+
3+
@file:Suppress(
4+
"NOTHING_TO_INLINE",
5+
)
6+
7+
package web.images
8+
9+
import web.blob.Blob
10+
11+
/**
12+
* Union of:
13+
* - `CanvasImageSource`
14+
* - `Blob`
15+
* - `ImageData`
16+
*/
17+
external interface ImageBitmapSource
18+
19+
inline fun Blob.asImageBitmapSource(): ImageBitmapSource =
20+
unsafeCast<ImageBitmapSource>()
21+
22+
inline fun ImageBitmapSource.asBlobOrNull(): Blob? =
23+
asDynamic() as? Blob

kotlin-browser/src/jsMain/generated/web/images/ImageData.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ external class ImageData(
1414
sw: Int,
1515
sh: Int,
1616
settings: ImageDataSettings = definedExternally,
17-
) : TexImageSource {
17+
) : ImageBitmapSource,
18+
TexImageSource {
1819
constructor(
1920
data: Uint8ClampedArray,
2021
sw: Int,

kotlin-browser/src/jsMain/generated/web/images/createImageBitmap.kt

+2-32
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,17 @@
33
package web.images
44

55
import js.promise.Promise
6-
import web.blob.Blob
7-
import web.canvas.CanvasImageSource
86

97
/**
108
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/createImageBitmap)
119
*/
1210
external fun createImageBitmap(
13-
image: CanvasImageSource,
11+
image: ImageBitmapSource,
1412
options: ImageBitmapOptions? = definedExternally,
1513
): Promise<ImageBitmap>
1614

1715
external fun createImageBitmap(
18-
image: Blob,
19-
options: ImageBitmapOptions? = definedExternally,
20-
): Promise<ImageBitmap>
21-
22-
external fun createImageBitmap(
23-
image: ImageData,
24-
options: ImageBitmapOptions? = definedExternally,
25-
): Promise<ImageBitmap>
26-
27-
external fun createImageBitmap(
28-
image: CanvasImageSource,
29-
sx: Int,
30-
sy: Int,
31-
sw: Int,
32-
sh: Int,
33-
options: ImageBitmapOptions? = definedExternally,
34-
): Promise<ImageBitmap>
35-
36-
external fun createImageBitmap(
37-
image: Blob,
38-
sx: Int,
39-
sy: Int,
40-
sw: Int,
41-
sh: Int,
42-
options: ImageBitmapOptions? = definedExternally,
43-
): Promise<ImageBitmap>
44-
45-
external fun createImageBitmap(
46-
image: ImageData,
16+
image: ImageBitmapSource,
4717
sx: Int,
4818
sy: Int,
4919
sw: Int,

0 commit comments

Comments
 (0)