Canvas.toTempFilePath
JS
Canvas.toTempFilePath(Object object)Saves the current canvas content as a temporary file.
Parameters
- Object object: Input parameters. See the table below for details.
object properties:
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| x | number | No | 0 | X coordinate of the top-left corner of the canvas region to capture |
| y | number | No | 0 | Y coordinate of the top-left corner of the canvas region to capture |
| width | number | No | canvas width | Width of the canvas region to capture |
| height | number | No | canvas height | Height of the canvas region to capture |
| destWidth | number | No | canvas width | Width of the output file; the captured region will be stretched or compressed to this value; only effective when fileType is jpg |
| destHeight | number | No | canvas height | Height of the output file; the captured region will be stretched or compressed to this value; only effective when fileType is jpg |
| fileType | string | No | png | Type of the output file; only png and jpg are supported |
| quality | number | No | 1.0 | Quality of the jpg image; only effective when fileType is jpg. Valid range is 0.0 (lowest) - 1.0 (highest), excluding 0. Values out of range are treated as 1.0 |
| success | function | No | Callback function for a successful API call | |
| fail | function | No | Callback function for a failed API call | |
| complete | function | No | Callback function for when the API call ends |
Parameters of the success callback function
- Object res: Returns the temporary file information
Temporary file information properties:
| Property | Type | Description |
|---|---|---|
| tempFilePath | string | Temporary file path generated by canvas (local path) |
