Skip to content

charton API


charton API / @chart-on/core / index / ImageToolOptions

Interface: ImageToolOptions ​

Defined in: packages/core/src/drawing/image-tool.ts:11

Options of createImageTool.

Methods ​

load() ​

load(ref): ImageToolSource | Promise<ImageToolSource>

Defined in: packages/core/src/drawing/image-tool.ts:20

Turn a drawing's reference (its text: a URL, a file name, an id the app keys its own files by) into an image, a canvas, a bitmap or a Blob, or a promise of one. Called once per reference while its image is cached; the chart itself fetches nothing. A rejection, an image that fails to decode, or one of more than 32 megapixels marks the reference as failed: its drawings show a crossed box. A Blob over that size is refused before it is decoded.

Parameters ​

ref ​

string

Returns ​

ImageToolSource | Promise<ImageToolSource>


store()? ​

optional store(image): string | Promise<string>

Defined in: packages/core/src/drawing/image-tool.ts:27

Keep an image pasted from the system clipboard and return the reference load will know it by. The image arrives checked (a PNG, JPEG, GIF or WebP file of at most 2 MB and 32 megapixels), scaled down to at most 1024 px on its longer side and re-encoded. Without it the tool takes no pastes.

Parameters ​

image ​

Blob

Returns ​

string | Promise<string>