static generateLassoPreview(imagePath: string): Promise<APIResponse<LassoPreview>>;
| Parameter | Type | Description |
|---|---|---|
imagePath | string | Output path for the preview image |
APIResponse<T>:resultis a lasso preview object with the following structure:
| Field | Type | Description |
|---|---|---|
imagePath | string | Path of the generated preview image |
rect | Rect | Lasso area |
rotateDegree | number | Rotation angle |
Example
import { PluginCommAPI } from 'sn-plugin-lib';
/**
* Example: generate a preview image for lasso elements.
*/
export async function exampleGenerateLassoPreview() {
const res = await PluginCommAPI.generateLassoPreview('/storage/emulated/0/Note/out/lasso-preview.png');
if (!res.success) {
throw new Error(res.error?.message ?? 'generateLassoPreview call failed');
}
return res.result;
}