-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
73 lines (60 loc) · 2.97 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import ImageData = require('@canvas/image-data')
declare interface ErrorEvent {
readonly bubbles: false
readonly cancelable: false
readonly currentTarget: Image
readonly defaultPrevented: false
readonly eventPhase: 2
readonly target: Image
readonly timeStamp: number
readonly type: 'error'
}
declare interface LoadEvent {
readonly bubbles: false
readonly cancelable: false
readonly currentTarget: Image
readonly defaultPrevented: false
readonly eventPhase: 2
readonly target: Image
readonly timeStamp: number
readonly type: 'load'
}
export declare class Image {
/**
* @param width - The width of the image (i.e., the value for the `width` attribute).
* @param height - The height of the image (i.e., the value for the `height` attribute).
*/
constructor (width?: number, height?: number)
/** A boolean value which indicates whether or not the image has completely loaded. */
readonly complete: boolean
/** An integer value indicating the height of the image. */
height: number
/**
* An integer value indicating the intrinsic height of the image, in CSS pixels. This is the height at which the image is naturally drawn when no constraint or specific value is established for the image. This natural height is corrected for the pixel density of the device on which it's being presented, unlike the value of `height`.
*
* If the intrinsic height is not available—either because the image does not specify an intrinsic height or because the image data is not available in order to obtain this information, `naturalHeight` returns 0.
*/
readonly naturalHeight: number
/**
* An integer value indicating the intrinsic width of the image, in CSS pixels. This is the width at which the image is naturally drawn when no constraint or specific value is established for the image. This natural width is corrected for the pixel density of the device on which it's being presented, unlike the value of `width`.
*
* If the intrinsic width is not available—either because the image does not specify an intrinsic width or because the image data is not available in order to obtain this information, `naturalWidth` returns 0.
*/
readonly naturalWidth: number
/**
* This event handler will be called on the image element when an error occurs loading the image.
*/
onerror: ((event: ErrorEvent) => void) | null
/**
* This event handler will be called on the image element when the image has finished loading. If you change the image, the event will fire again when the new image loads.
*/
onload: ((event: LoadEvent) => void) | null
/** A string specifying the URL of the desired image. */
src: string
/** An integer value indicating the width of the image. */
width: number
}
export declare function getImageData (image: Image): ImageData | undefined
export declare function imageFromBuffer (buffer: Uint8Array): Promise<Image>
export declare function imageFromImageData (imageData: ImageData): Promise<Image>
export default Image