| 1 |
/// <reference path="load.ts" /> |
| 2 |
/// <reference path="memory.ts" /> |
| 3 |
/// <reference path="../bindings/extension.d.ts" /> |
| 4 |
/// <reference path="public_api.d.ts" /> |
| 5 |
// eslint-disable-next-line @typescript-eslint/no-unused-vars |
| 6 |
namespace Extension { |
| 7 |
// Module is the C++ module with the private (and some public) bindings on it. |
| 8 |
declare const Module: extension.Bindings; |
| 9 |
declare const CanvasKit: public_api.CanvasKit; |
| 10 |
load.afterLoad(() => { |
| 11 |
/** |
| 12 |
* publicExtension takes the number of rects and returns how |
| 13 |
* many of them have the point (5, 5) in them. |
| 14 |
* @param myRects |
| 15 |
* @ts publicExtension(myRects: InputFlattenedRectArray): void; |
| 16 |
*/ |
| 17 |
CanvasKit.publicExtension = (myRects: public_api.InputFlattenedRectArray) => { |
| 18 |
const rPtr = memory.copy1dArray(myRects, 'HEAPF32'); |
| 19 |
const num = Module._privateExtension(rPtr, myRects.length / 4); |
| 20 |
memory.freeIfNecessary(rPtr, myRects); |
| 21 |
return num; |
| 22 |
}; |
| 23 |
|
| 24 |
CanvasKit.withObject = (obj: public_api.CompoundObj) => { |
| 25 |
obj.gamma ||= 1.0; |
| 26 |
Module._withObject(obj); |
| 27 |
}; |
| 28 |
}); |
| 29 |
} |