941477276 / tablet Goto Github PK
View Code? Open in Web Editor NEWcanvas在线签名板
canvas在线签名板
浏览器大小发生改变的时候画布宽度会跟随动态变宽变窄,高度也会变 但是比例不是1:1变高或者变窄
`
tablet.getImageData = function() {
| let data = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
| return data.data;
| };
tablet.getImageColors = function() {
| // 获取像素数据
| let data = this.getImageData();
| function toHex(a){
| let hex = a.toString(16);
| if(hex.length == 1){
| return "0"+hex;
| } else {
| return hex;
| }
| };
| function toColor(r,g,b,a){
| let s = [];
| s.push(toHex(r));
| s.push(toHex(g));
| s.push(toHex(b));
| s.push(toHex(a));
| return s.join('');
| }
| let map={};
| for (let i = 0; i < data.length; i += 4) {
| let r = data[i];
| let g = data[i+1];
| let b = data[i+2];
| let a = data[i+3];
| let c = toColor(r,g,b,a);
| if(map[c]){
| map[c]++;
| } else {
| map[c]=1;
| }
| }
| return map;
| };
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.