跳到主要内容

bn.canvasToTempFilePath

canvasToTempFilePath(options, compInst?): Promise<ToFilePathResult>

Parameters

NameType
optionsCanvasToTempFilePathOptions
compInst?ComponentInstance

Returns

Promise<ToFilePathResult>

CanvasToTempFilePathOptions

Ƭ CanvasToTempFilePathOptions: Object

Type declaration

NameTypeDescription
x?numberThe upper-left vertical position of the specified canvas area
y?numberThe upper-left horizontal position of the specified canvas area
width?numberWidth of the specified canvas area
height?numberHeight of the specified canvas area
destWidth?numberWidth of output picture
destHeight?numberHeight of output picture
canvasId?stringCanvas identity, passed in canvas Component canvas-id
canvas?CanvasCanvas identity, passed in canvas Component instance. This property is used when the canvas type="2d".
fileType?"png" | "jpg"Type of destination file, valid values are 'png' or 'jpg'
quality?numberThe quality of the picture is currently only jpg Effective. The range is (0, 1]. When not within the scope of 1.0 will be used.

Canvas

Ƭ Canvas: Object

Type declaration

NameType
widthnumber
heightnumber
createImage() => Image
createImageData() => ImageData
getContext(type: RenderingContextId) => null | RenderingContext
requestAnimationFrame(callback: FrameRequestCallback) => number
cancelAnimationFrame(handle: number) => void
styleany
toDataURL() => string
toTempFilePath(arg: any) => any
toTempFilePathSync(arg: any) => any

Interface: Image

NameTypeDescription
heightnumberThe real height of image
srcstringThe url of image support base64 data
widthnumberThe real width of image
onerror(...args): anyTriggered when error occurs during loading image
onload(...args): anyTriggered when image finishes loading

onerror

onerror(...args): any

Triggered when error occurs during loading image

Parameters

NameType
...argsany[]

Returns

any


onload

onload(...args): any

Triggered when image finishes loading

Parameters

NameType
...argsany[]

Returns

any

RenderingContextId

Ƭ RenderingContextId: "2d" | "bitmaprenderer" | "webgl" | "webgl2"

Interface: ComponentInstance

NameTypeDescription
idstringComponent id

ToFilePathResult

Ƭ ToFilePathResult: Object

Type declaration

NameTypeDescription
tempFilePathstringThe path of the image file