W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
將當(dāng)前 Canvas 保存為一個(gè)臨時(shí)文件,并生成相應(yīng)的臨時(shí)文件路徑。
繼承標(biāo)準(zhǔn)對象輸入,擴(kuò)展屬性描述:
屬性 | 類型 | 默認(rèn)值 | 是否必填 | 說明 |
---|---|---|---|---|
x | number | 0 | 否 | 截取 canvas 的左上角橫坐標(biāo) |
y | number | 0 | 否 | 截取 canvas 的左上角縱坐標(biāo) |
width | number | canvas 的寬度 | 否 | 截取 canvas 的寬度 |
height | number | canvas 的高度 | 否 | 截取 canvas 的高度 |
destWidth | number | canvas 的寬度 | 否 | 目標(biāo)文件的寬度,會(huì)將截取的部分拉伸或壓縮至該數(shù)值 |
destHeight | number | canvas 的高度 | 否 | 目標(biāo)文件的高度,會(huì)將截取的部分拉伸或壓縮至該數(shù)值 |
fileType | string | png | 否 | 目標(biāo)文件的類型 |
quality | number | 1.0 | 否 | jpg 圖片的質(zhì)量,僅當(dāng) fileType 為 jpg 時(shí)有效。取值范圍為 0.0(最低)- 1.0(最高),不含 0。不在范圍內(nèi)時(shí)當(dāng)作 1.0 |
值 | 說明 |
---|---|
jpg | jpg 文件 |
png | png 文件 |
canvas 生成的臨時(shí)文件路徑
canvas.toTempFilePath({
x: 20,
y: 20,
width: 200,
height: 150,
destWidth: 400,
destHeight: 300
success: (res) => {
console.log(res.tempFilePath)
}
})
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: