codecamp

Canvas.toTempFilePathSync

Canvas.toTempFilePathSync(Object object)

Canvas.toTempFilePath 的同步版本


输入

继承标准对象输入,扩展属性描述:

属性类型默认值是否必填说明
xnumber0截取 canvas 的左上角横坐标
ynumber0截取 canvas 的左上角纵坐标
widthnumbercanvas 的宽度截取 canvas 的宽度
heightnumbercanvas 的高度截取 canvas 的高度
destWidthnumbercanvas 的宽度目标文件的宽度,会将截取的部分拉伸或压缩至该数值
destHeightnumbercanvas 的高度目标文件的高度,会将截取的部分拉伸或压缩至该数值
fileTypestringpng目标文件的类型
qualitynumber1.0jpg 图片的质量,仅当 fileType 为 jpg 时有效。取值范围为 0.0(最低)- 1.0(最高),不含 0。不在范围内时当作 1.0
说明
jpgjpg 文件
pngpng 文件


示例代码

tempFilePath = canvas.toTempFilePathSync({
  x: 20,
  y: 20,
  width: 200,
  height: 150,
  destWidth: 400,
  destHeight: 300
});
Canvas.toTempFilePath
tt.loadFont
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

无标题目录

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题目录

无标题文章

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }