博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
js生成图片
阅读量:4640 次
发布时间:2019-06-09

本文共 731 字,大约阅读时间需要 2 分钟。

var image = new Image();var c = document.getElementById("myCanvas");var ctx = c.getContext("2d");var img = document.getElementById("scream");ctx.font = "10px Arial";function createImg(name, zuowei, color) {    //  姓名    ctx.fillText(name, 93, 373);    ctx.fillText(name, 393, 370);    //  座位号    ctx.font = "bold 20px Arial";    ctx.fillText(zuowei, 216, 350);    ctx.fillText(zuowei, 393, 350);    //  座位颜色    ctx.font = "bold 20px Arial";    ctx.fillText(color, 264, 350);    ctx.fillText(color, 441, 350);    //  生成图片    image = c.toDataURL("image/png");    return image;}ctx.drawImage(img, 0, 0, 550, 520);var src = createImg(name, zuowei, color);$('#box').attr('src', src);

 

转载于:https://www.cnblogs.com/lvyueyang/p/8216668.html

你可能感兴趣的文章
Get MAC address using POSIX APIs
查看>>
bzoj2120
查看>>
基于uFUN开发板的心率计(一)DMA方式获取传感器数据
查看>>
【dp】船
查看>>
oracle, group by, having, where
查看>>
⑥python模块初识、pyc和PyCodeObject
查看>>
object-c中管理文件和目录:NSFileManager使用方法
查看>>
Kibana:分析及可视化日志文件
查看>>
nodejs pm2使用
查看>>
cocos2d-x 3.10 PageView BUG
查看>>
装饰器的基本使用:用户登录
查看>>
CSS选择器总结
查看>>
mysql中sql语句
查看>>
head/tail实现
查看>>
sql语句的各种模糊查询语句
查看>>
vlc 学习网
查看>>
Python20-Day05
查看>>
Real World Haskell 第七章 I/O
查看>>
C#操作OFFICE一(EXCEL)
查看>>
【js操作url参数】获取指定url参数值、取指定url参数并转为json对象
查看>>