| 1 |
export interface CanvasKit { |
| 2 |
/** |
| 3 |
* This function says hello |
| 4 |
* |
| 5 |
* @param x some number |
| 6 |
* @param y some other number |
| 7 |
*/ |
| 8 |
sayHello(x: number, y: number): void; |
| 9 |
|
| 10 |
/** |
| 11 |
* publicExtension takes the number of rects and returns how |
| 12 |
* many of them have the point (5, 5) in them. |
| 13 |
* @param myRects |
| 14 |
* @ts publicExtension(myRects: InputFlattenedRectArray): void; |
| 15 |
*/ |
| 16 |
publicExtension(myRects: InputFlattenedRectArray): number; |
| 17 |
|
| 18 |
/** |
| 19 |
* This function does a public thing. |
| 20 |
* @param input an ice cream flavor |
| 21 |
*/ |
| 22 |
publicFunction(input: string): void; |
| 23 |
|
| 24 |
withObject(obj: CompoundObj): void; |
| 25 |
|
| 26 |
readonly Extension: ExtensionConstructor; |
| 27 |
readonly Something: SomethingConstructor; |
| 28 |
} |
| 29 |
|
| 30 |
export interface ExtensionConstructor { |
| 31 |
/** |
| 32 |
* Returns an extension with the provided property. |
| 33 |
* @param name - if not provided, use a default value |
| 34 |
*/ |
| 35 |
new(name?: string): Extension; |
| 36 |
} |
| 37 |
|
| 38 |
export interface SomethingConstructor { |
| 39 |
/** |
| 40 |
* Returns a Something with the provided name. |
| 41 |
* @param name |
| 42 |
*/ |
| 43 |
new(name: string): Something; |
| 44 |
} |
| 45 |
|
| 46 |
export interface Extension extends EmbindObject<Extension> { |
| 47 |
/** |
| 48 |
* Returns the associated property. |
| 49 |
*/ |
| 50 |
getProp(): string; |
| 51 |
/** |
| 52 |
* This sets the property with a prefix. |
| 53 |
* @param p |
| 54 |
*/ |
| 55 |
setProp(p: string): void; |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* The Something class is quite something. See SkSomething.h for more. |
| 60 |
*/ |
| 61 |
export interface Something extends EmbindObject<Something> { |
| 62 |
/** |
| 63 |
* Returns the associated name. |
| 64 |
*/ |
| 65 |
getName(): string; |
| 66 |
/** |
| 67 |
* This sets the name twice for good measure. |
| 68 |
* @param name |
| 69 |
*/ |
| 70 |
setName(name: string): void; |
| 71 |
} |
| 72 |
|
| 73 |
export interface CompoundObj { |
| 74 |
alpha: number; |
| 75 |
beta: string; |
| 76 |
/** |
| 77 |
* This field (gamma) should be documented. |
| 78 |
* @optional - default value is 1.0 |
| 79 |
*/ |
| 80 |
gamma?: number; |
| 81 |
} |
| 82 |
|
| 83 |
export type InputFlattenedRectArray = Float32Array | number[]; |
| 84 |
|
| 85 |
/** |
| 86 |
* CanvasKit is built with Emscripten and Embind. Embind adds the following methods to all objects |
| 87 |
* that are exposed with it. |
| 88 |
*/ |
| 89 |
export interface EmbindObject<T extends EmbindObject<T>> { |
| 90 |
clone(): T; |
| 91 |
delete(): void; |
| 92 |
deleteAfter(): void; |
| 93 |
isAliasOf(other: any): boolean; |
| 94 |
isDeleted(): boolean; |
| 95 |
} |